Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: 2D sprites actor - How to improve performance when more than 2 in 1 scene?  (Read 3360 times)

0 Members and 1 Guest are viewing this topic.

diegoquarantine

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 50
    • View Profile
    • Buenos Aires Quarantine Studio


Hello everyone. First of all, just to be clear:  wintermute rules!

Now, with that being said. I wanted to post a problem to see if anyone can help me with this one. I´m making an adventure in wme, and I´m using 2D sprite characters. The game resolution is at 1280x720 so characters go around 600 x 400 aprox. They need a big area to be able to move around, pick up things, fire weapons or die. I´m using alpha channels with them, and animations have an average of 20 frames per animation, per direction.
So the thing is that when I have 1 actor and 1 or 2 extras, that have limited movement, I have no problem, but when I needed to put on the scene 2 full actors on 8 directions, the debugging consolos prints an error of frames not being loaded and then when the game loads, the second character is at half of its animations.

How can I improve this?. I would love to use 3D realtime characters, but I couldn´t understand how to make them work so I started working with sprites.
I tried shrinking the sprites resolutions and scale the sprite by code to compensate, and you gain some memory but still is not enough.
Using the 1 bit magenta channel as alpha is more optimized than using the 8 bit alpha channel from the PNG files? or is it the same.
Thanks!
 

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site

the debugging consolos prints an error of frames not being loaded
What error, "out of memory" I suppose?


How can I improve this?. I would love to use 3D realtime characters, but I couldn´t understand how to make them work so I started working with sprites.
I tried shrinking the sprites resolutions and scale the sprite by code to compensate, and you gain some memory but still is not enough.
That's the only way. Do some math: frame width * frame height * 4 * number of frames = number of bytes of memory used. Memory isn't bottomless.


Using the 1 bit magenta channel as alpha is more optimized than using the 8 bit alpha channel from the PNG files? or is it the same.
In memory the alpha will be 8 bits anyway.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

diegoquarantine

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 50
    • View Profile
    • Buenos Aires Quarantine Studio

Thanks Mnemonic!

Yes I know there´s a limit in memory but I didn´t know how to calculate that usage.  Thanks for that.

So I did that calculation, and my main character has more or less 800 frames at 640 x 400 pixels.
That´s why it looks so good in motion. But, if I get your calculation right, I should multiply  640X400 then X4 and then X800 frames. Which would be 819200000 bytes, which according to a google translator of digital storage this would be 0.75Gb of memory.
Is this right?.

And if it is, I know that allocating almost 1 gigabyte on the main character is insane, but anyway, how is it that the game prints an out of memory error when I´m testing in a 16gb pc?.

Thanks!!!!.

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site

Because you're most likely running out of *video* memory, i.e. the memory on your video card. Simply put, to render one frame, the video card needs all the necessary information uploaded to its own (fast) memory. In case of WME that's mainly texture data, 3D games upload to video memory also geometry, shaders etc.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

diegoquarantine

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 50
    • View Profile
    • Buenos Aires Quarantine Studio

Oh. That memory. Yeah it figures, I have 2GB. I was eating it all I suppose.  Well I have to be more  careful.

I chopped down the transparency margins of each frame and I got rid of the "global" shadow, which was the main reason for that transparency, It looked really cool, but too expensive. And Cut down animation lengths to 5 to 10 frames aprox. Now the game loads much faster and If I manage the same specs I can load 3 full characters in the same scene!. Animation looks kind of choppy for my taste, but I think players are going to live with that.

To be sure of one more thing. The game only retains in memory the main actor and the items collected right?.  From scene to scene, everything else gets washed out?

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site

Yes, that's right.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave
 

Page created in 0.033 seconds with 19 queries.