VRAM questions

This forum is currently in read-only mode.
  • Well heres the deal.

    I have the Level layout.

    In this layout, which is the game main layout there is the player controled object and the enemies.

    I have about 22 enemy types. All with diffrent graphics.

    Theres virtualy no way that all of them will ever be on one Layout, at once.

    At first i though i can handle this with Unique Sprites plugin and load the needed graphics as they are put in use, to spare the VRAM. But US plugin end up being quite buggy and risky to use. So i replaced it with regular Sprite object.

    Now, as i tried to avoid using Fammilies, i though that i might use one Sprite object which has all the graphics for all the enemies. But as the object is created - all of it frames and graphics are loaded into the VRAM. Regardless are they being used or not.

    This wouldnt be such a big deal if i would have less enemies. But with 22 enemies, where each has graphics wourth of +/- 4-5mb VRAM this ends up with some nasty high VRAM usage. And as i said - theres never a situation where theres more then 4 diffrent enemy types on the level. So the rest would just trash the VRAM with needless graphics.

    So i though - maybe i have to split the enemies into seperate Sprite Objects. Sure, itll be anoying to set all the PVs and whatnot for each and every one of them, but oh well - no one said GameDeving is sweets&suger. I though that i might store them on a diffrent Storage kind Layout and make sprites global.

    This way i can easly spawn the enemies i need, at the given moment, without wasting VRAM.

    BUT.

    First problem is setting up events for all of them. 22 Objects means all the events x 22. So i though that i might have to use Fam's after all. And just control the Enemy Objects with the Fam's based events. But... i am a bit affraid how well itll handle it. Its not just collision detection. Its PV's control mainly. ALOT of PV's control.

    Additionaly i dont really know how it will impact the CPU.

    I mean the graphics are being constantly loaded and unloaded as the enemies are being created and destroyed. The enemies graphics arent that big. At worst, we are talking about 15 frames TOTAL, where biggest are 128^2.

    So the question are:

    1. Will this constant loading/unloading hurt the CPU?

    2. Will it work if ill replace the exact sprites objects with Fam?

    3. Will it work for EACH of the enemy or for all of them?

    4. Do you know any other (better) way of doing this?

    5. Or maybe is there an option to Force/Set CC so he loads only the selected Animations from the Sprite Object? that would be the perfect solution. Letting me avoid Fammilies and having all the graphics nicely organised within one sprite object.

    If anything is unclear - please ask. I still havent drink my morning coffee so i am a bit sleepy and i might not wrote everything enough clear.

  • I'm concerned I may have made you fearful of using families from the other thread. Really, there's nothing to worry about as long as you don't delete family variables or try to rename them. It's not as annoying as I thought it would be to have unused variables laying around. Definitely use families instead of recoding the events for every enemy!

    4 to 5 MB of VRAM isn't actually that much. Modern, and even not modern graphics cards have tons of VRAM � sometimes into the gigabytes. Even old graphics cards shouldn't have a problem with a 100-150mb VRAM game. A lot of weaker computers use their RAM as VRAM so even though they have weak graphics cards, they actually have gigs of VRAM to work with.

    The only thing you really have to be concerned about is textures being unloaded from memory when all instances of that object are deleted from the layout � because then when you create another object of that type, it will reload those textures, which can potentially cause the game to have a slight pause while it sends the textures from RAM to the graphics card. If you want to keep that from happening, simply make sure that there is an instance in the layout somewhere that never gets destroyed. It can be offscreen and invisible, and you can deactivate all its behaviors and use a variable make sure it is unaffected by events.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thank you Arima.

    You clarified preety much everything i was concerned about.

    I resumed my work :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)