Preloading sprites into Video Memory issues

Discussion and feedback on Construct 2

Post » Mon Nov 24, 2014 4:55 am

@80bit

In my case, the player has an attack that 'spawns' about 16 bullets per tick. These are pointed at random angles, and fired off at a constant speed. When they hit an enemy, or the edge of the screen, they are 'destroyed'. So, their 'lifetime' is pretty short, <1 second.

In short: Bullets start offscreen, inactive. They go back offscreen when 'destroyed'. For 'spawning', I move them onscreen and reorient them.

If I hold down on this attack button on a blank screen, I get a maximum onscreen count of ~1500 bullets.

Here's a thread with more discussion of this:

viewtopic.php?f=146&t=117573

Your game looks awesome BTW. :D
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Post » Mon Nov 24, 2014 9:24 pm

Thanks so much @TiAm! I was curious though, does that mean you are creating 1500 bullets in your layout? I feel like my game might be able to use this optimization to help with CPU load but im not sure the practice. I should read the thread you posted haha.
Made Cosmochoria - www.cosmochoria.com
Currently working on Slayaway Camp - www.slayawaycamp.com
B
27
S
8
G
3
Posts: 384
Reputation: 5,020

Post » Mon Nov 24, 2014 9:31 pm

Yes, and storing them offscreen. This is not without some cost as well, because they have to be 'checked' for drawing every tick (or so I understand). So, when I go this route, I have more cpu usage at idle.

However, the most demanding part of the game is when I've got all those bullets onscreen, and in that situation I come out ahead. YMMV.
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Previous

Return to Construct 2 General

Who is online

Users browsing this forum: BackendFreak, htmlgames, tarek2 and 28 guests