Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411279 Posts in 69323 Topics- by 58380 Members - Latest Member: bob1029

March 28, 2024, 03:36:16 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Release a sprite sheet texture from the animator
Pages: [1]
Print
Author Topic: Release a sprite sheet texture from the animator  (Read 691 times)
DrHogan
Level 0
***



View Profile WWW
« on: June 14, 2017, 11:06:32 PM »

Hello guys,

I have a bit of a weird problem. Our game allows for a lot of zoom, and therefore to have smooth animations we need to have pretty large 2d spritesheet.

One thing that is killing me is our artilleries. They rotate and shoot in each direction, and to maintain the visual quality we need each sheet is 4k. So each direction has a 4k sheet for shooting, and a 2k sheet for reloading, plus all together a single spritesheet for rotation.

This one is the main culprit.


As I noticed through the profiler that when the artillery is built, there is just the base state it's in loaded in memory. Once actions are taken, i.e. rotate reload and shoot in other directions, the other spritesheets are loaded in memory, but then they are kept there all the time.

Being as they are large as hell, and given that if the tower is facing direction X it will not be needing the shoot animation in direction Y at that moment, is there a way to unload those sheets when not needed, for example at the end of the animation or when rotation moves away from there?

Cheers,
Logged

Dr.Hogan-Lead Developer at H&R Games
------------------------------------------------------
Empires in ruins
epcc
Level 1
*


View Profile
« Reply #1 on: June 15, 2017, 05:46:44 AM »

Unloading and loading textures this large will cause lag spikes that will be noticeable to player.
If you're running out of video memory, I'd recommend replacing most of those huge spritesheets with actual 3d models.
Logged

Wilson Saunders
Level 5
*****


Nobody suspects the hamster


View Profile WWW
« Reply #2 on: June 15, 2017, 08:09:44 AM »

I can't tell if you are doing this already, but you aren't, you may want to split the cannon into multiple smaller sprites thus saving on unused white space on the sprite sheet. For example if the base of the cannon does not move, render that separately from a single sprite and have the rotating turret rendered as a second sprite on top of it. Like wise the gunpowder bloom coming out of the cannon doesn't need to be centered on the cannon but can be rendered with the appropriate offset values
Logged

Play my games at http://monkeydev.com/
DrHogan
Level 0
***



View Profile WWW
« Reply #3 on: June 18, 2017, 11:53:36 PM »

Unloading and loading textures this large will cause lag spikes that will be noticeable to player.
If you're running out of video memory, I'd recommend replacing most of those huge spritesheets with actual 3d models.


Hi! Actually the artillery has the following animator basically 8 directions of rotation, 8 directions of shooting and 8 of reloading. My idea would be, should i find the way, to load async a given shooting and reloading only when rotating in that direction. Do you think it would still cause lag spikes? Rotation takes a couple of seconds, so i would have that time as a freebie for loading.

The problem is that i can't find a way to handle the unloading of a specific animator spritesheet and animation.

As for the 3D models, we would like to try to preserve the full pre-rendered 2d look and pipeline to try and stay true to the "classics".
Logged

Dr.Hogan-Lead Developer at H&R Games
------------------------------------------------------
Empires in ruins
DrHogan
Level 0
***



View Profile WWW
« Reply #4 on: June 18, 2017, 11:55:05 PM »

I can't tell if you are doing this already, but you aren't, you may want to split the cannon into multiple smaller sprites thus saving on unused white space on the sprite sheet. For example if the base of the cannon does not move, render that separately from a single sprite and have the rotating turret rendered as a second sprite on top of it. Like wise the gunpowder bloom coming out of the cannon doesn't need to be centered on the cannon but can be rendered with the appropriate offset values

Hi Wilson, some stuff is already on separate sheets, and we are trying to do that further. The tower for example is a separate one, with the rotating part independent. We are now removing the gunpowder bloom from it (it's a pain to pre-render it and pack it with a proper fixed pivot when set into separate spritesheets).
Logged

Dr.Hogan-Lead Developer at H&R Games
------------------------------------------------------
Empires in ruins
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic