Godmaster Posted February 19, 2008 Author Report Share Posted February 19, 2008 anyone? Link to comment Share on other sites More sharing options...
Spike Posted February 19, 2008 Report Share Posted February 19, 2008 In all honesty, Godmaster, I have been using GM since 2001 and I have no idea what to do about this. I am on the verge of giving up on it too. But I looked at Super Sonic Knockout, and that game uses 190MB of RAM. That was just in a FIGHT. Small room, a few objects, and it still uses that much. I'm starting to think that there is no way to get the memory usage to an acceptable level. Link to comment Share on other sites More sharing options...
Godmaster Posted February 20, 2008 Author Report Share Posted February 20, 2008 I had tested Sonic Nebulous, and that only consumed less than 5% of my computer processor and memory. Even that being in a early stage of development,that use big graphics and mp3 sounds... But I'll be saved if I got my game to use less processor ^^ Link to comment Share on other sites More sharing options...
Kain Posted February 20, 2008 Report Share Posted February 20, 2008 Q: what's the best image kind to load? BMP, PNG or GIF? A: Doesn't make a difference for in-game RAM. Q: only one object for all characters (with every code inside, including the draw events) works slower than a player object for each character? A: Slightly, but if you organize it well, it should only be like one or two if statements for each event at most. It's good to remove unneeded repetition of code if possible and using a single object could possibly help that. Q: I use to draw parallax backgrounds using draw_sprite instead of draw_background, because I load the background parts from an animated gif. Is this correct? A: Sure. Makes no real difference using them that way. Q: multiple parents works slower than separates collisions? like this hierarchy: solid > walls > platform A: Interesting question. I'm actually not sure of the answer. I'm pretty sure it's not significant, but I'll bet it is a tiny bit slower. Q: some of last complains about its running wasn't about the ram, was about the processor usage from the game... that wasn't supposed to consume 100% of the CPU... (you notice that I you're running on an 1.8 Ghz processor). A: Look for any processor-intensive functions. Certain functions like string_execute, and variable_local_get, and such can be extremely slow. And of course deactivating objects and lowering collision checks will help with speed issues. I don't know if any of this applies to you, but it's a start. Q: I'm gathering all level tiles into only one tileset depending on their dimensions. For instance: I have for each level 32x32 tileset, now I'm put all 32x32 tiles in a single tileset, to avoid loading tons of tilesets. I'm doing right? A: Hmm... It's actually probably better to have them as separate tilesets depending on how much you have. Some computers don't work well with images that are too big, plus if you have them separate, then you can unload the ones you aren't using and re-load them when you do use them (although the only way I know of doing this is deleting the resource then re-loading it from an external file). Link to comment Share on other sites More sharing options...
USC Posted February 20, 2008 Report Share Posted February 20, 2008 Q: what's the best image kind to load? BMP, PNG or GIF?A: Doesn't make a difference for in-game RAM. Really? I remember reading in a few places that the compression used for GIFs and PNGs (and work necessary to decompress them) makes them a less efficient format. Of course, I couldn't imagine it making MUCH difference, but it might help out a bit. Link to comment Share on other sites More sharing options...
Kain Posted February 21, 2008 Report Share Posted February 21, 2008 Well, they might take slightly more time to load, but GM stores everything as uncompressed 32-bit bitmaps in-game, so it doesn't really matter how they were compressed before. Link to comment Share on other sites More sharing options...
Godmaster Posted February 22, 2008 Author Report Share Posted February 22, 2008 Oh man, I has just found an old backup from BrazSonic 2 that I can only import the scripts from the current version to make something lighter. Maybe I use few and larger solid objects to avoid the cpu overflow, and... I though about using direct3d to make easier parallax backgrounds. That would be save more memory from drawing separated background parts. So, if I do that, I will use thin 3d shapes to give a 2.5d impression. What do you guys think about this? Link to comment Share on other sites More sharing options...
Spike Posted February 23, 2008 Report Share Posted February 23, 2008 It may not look very good, but go for it if it lowers the RAM usage. How much have you been able to lower it since you started? I've managed to lower mine from 260MB to 190MB. Still not great, but better. Link to comment Share on other sites More sharing options...
Godmaster Posted February 23, 2008 Author Report Share Posted February 23, 2008 It may not look very good, but go for it if it lowers the RAM usage. How much have you been able to lower it since you started? I've managed to lower mine from 260MB to 190MB. Still not great, but better. In my new pc, that has 2GB of RAM, that used to ran on 1GB when I didn't started to unbloat my game, now that consumes between 500 and 400 MB. Now I'm trying to remake that I a simpler way, less animations, less objects, etc. But I got a little trouble when I change the action state to rolling, that stops so quickly and doesn't speed up on slopes properly, here's the STEP code from gameplay (the most important for now): if (action<=1){ // If the player pressed any direction, change if (KEY_LEFT) { if abs(hsp)<=1 xdir=-1; } if (KEY_RIGHT) { if abs(hsp)<=1 xdir=1; } // After checking if the player is on the ground, we apply the deacceleration based on the actual angle. if (ground) { hsp-=dsin*(dcc*2.1); } // Accelerate or deaccelerate if the player pressed the keys if (KEY_LEFT) { if (hsp>=0) hsp-=acc*4; // If the player pressed the left key and the player was moving to the right, deaccelerate faster if (hsp<0 && hsp>-hspm) hsp-=acc; // otherwise, do normal acceleration } else if (KEY_RIGHT) { if (hsp<=0) hsp+=acc*4; // Same for the right, deaccelerate faster if (hsp>0 && hsp<hspm) hsp+=acc; // or do normal acceleration } else // If any of these two keys hasn't been pressed, deaccelerate { if (hsp>0) hsp-=dcc; // While going to the right, deaccelerate if (hsp<0) hsp+=dcc; // While going to the left, deaccelerate if (hsp>0 && hsp<dcc) hsp=0; // If the speed is lower than deacceleration, set to 0. if (hsp<0 && hsp>-dcc) hsp=0; } } // Check for collisions on the sides. If those are true, set the speed to 0. if (collision_sensor_right(obstacle_layer | high_layer | low_layer,MaskExtraLarge) && hsp>0) hsp=0; if (collision_sensor_left(obstacle_layer | high_layer | low_layer,MaskExtraLarge) && hsp<0) hsp=0; // Now do vertical Movement. if (!ground) { // If we aren't on the ground and we are falling and the bottom sensor is colliding, land if (vsp>=0 && collision_sensor_bottom(obstacle_layer | high_layer | low_layer,MaskLarge)) { ground=1; vsp=0; if (action==1) action=0; // If we were jumping, deactivate jump } } else { // Otherwise, if we are on the ground and the bottom sensor isn't colliding, fall. if (!collision_sensor_bottom(obstacle_layer | high_layer | low_layer,MaskLarge)) { ground=0; } } if (!ground) { // Apply forces if we are falling vsp+=vfr; } //crouch/roll if (ground) { if (KEY_DOWN) { if abs(hsp)>1 { if action==0 {action=4; hsp=xdir*1.25;} } else { if action==0 { if abs(hsp)==0 action=2; } } } } if !KEY_DOWN { switch (action) { case 2:{action=0};break; case 3:{action=4; hsp=xdir*spincharge; spincharge=0};break; } } if action==4 { if angle != 0 { hsp+=(sin(degtorad(angle)) * slope_decc_factor * 1.2)*xdir; } else {if hsp==0 action=0} } // Jump/spindash if (PRESS_A && ground) { if !(KEY_DOWN) { ground=0; vsp=dcos*jmp-dsin*hsp; // Calculate the speed hsp=dcos*hsp+dsin*jmp; angle=0; dcos=1; // Values at angle 0 dsin=0; action=1; // Set action to Jump } else { if action==2 action=3; if spincharge<20 spincharge+=3 } } // Here could go your action scripts //... The problem is in the "if action==4" condition, where the character doesn't roll properly, stopping so fast and doesn't accelerating on slopes. Obs: action=0 means normal state action=1 means jump state action=2 means crouch state action=3 means spin charge state action=4 means rolling state Link to comment Share on other sites More sharing options...
Godmaster Posted February 24, 2008 Author Report Share Posted February 24, 2008 Here's it, a new build from the game. This still using the old engine, and I believe that this can use less CPU and RAM. http://www.mediafire.com/?dw0twxfuz29 This isn't a true demo release, it's only for testing purposes. Thanks in advance 1 Link to comment Share on other sites More sharing options...
Spike Posted February 24, 2008 Report Share Posted February 24, 2008 This one still uses up about 260MB. That wouldn't play well on any computer that has less than 1GB of RAM or so. Link to comment Share on other sites More sharing options...
Godmaster Posted February 24, 2008 Author Report Share Posted February 24, 2008 This one still uses up about 260MB. That wouldn't play well on any computer that has less than 1GB of RAM or so. I got it running fine on my older one (that has 512MB of RAM), I really think that RAM consume varies from computer to computer. However, I'm still shrinking the memory usage from images. Link to comment Share on other sites More sharing options...
Spike Posted February 24, 2008 Report Share Posted February 24, 2008 Ah, I see. I'm going to try it on my old 256MB of RAM computer. Link to comment Share on other sites More sharing options...
Godmaster Posted February 25, 2008 Author Report Share Posted February 25, 2008 Omg, I hope that doesn't crash your pc, because I tried on my oldest one (with 320MB of RAM and 650Mhz processor) and that ran much more slower than the SAGE demo in normal computers... Link to comment Share on other sites More sharing options...
Spike Posted February 25, 2008 Report Share Posted February 25, 2008 Actually, it worked fine. It had a little bit of lag when switching between rooms, but it worked. Used about 75MB on average. Link to comment Share on other sites More sharing options...
Godmaster Posted February 25, 2008 Author Report Share Posted February 25, 2008 Actually, it worked fine. It had a little bit of lag when switching between rooms, but it worked. Used about 75MB on average. Whoa, this can be good! But, your processor must be over than 1Ghz to run that even with 256MB. Link to comment Share on other sites More sharing options...
Spike Posted February 25, 2008 Report Share Posted February 25, 2008 Yes, it was 1.80GHz. Link to comment Share on other sites More sharing options...
Kain Posted February 25, 2008 Report Share Posted February 25, 2008 This build definitely ran tons better. The ram usage was still like 130MB, but the loading time was next to nothing in comparison and it ran twice as smooth. Edit: If I haven't mentioned already, my computer has 512MB RAM. Link to comment Share on other sites More sharing options...
Godmaster Posted February 25, 2008 Author Report Share Posted February 25, 2008 This build definitely ran tons better. The ram usage was still like 130MB, but the loading time was next to nothing in comparison and it ran twice as smooth.Edit: If I haven't mentioned already, my computer has 512MB RAM. Oh, I feel much better now, but what's your processor? It used to consume nearly 90% two weeks ago in my 3Ghz pc (not this one that I use often). 1 Link to comment Share on other sites More sharing options...
Kain Posted February 25, 2008 Report Share Posted February 25, 2008 It's using all 50% of my dual-processor (which I think is a combined 3 GHz or something. Which maybe means equivalent to a 1.5GHz processor I don't really know how the numbers work) meaning it was experiencing some slight slowdown but was still getting a nearly-constant 58-60 FPS. It might run bad for lower-end computers, but it's running great for me. Thing is the engine shouldn't be slowing it down that much and I'm not noticing any drawing methods that would do it either. I wonder what's taking up so much processing power. 2 Link to comment Share on other sites More sharing options...
Spike Posted February 25, 2008 Report Share Posted February 25, 2008 I'm going to rep you for this topic, Godmaster. If it weren't for this, I never would have guessed that the RAM usage varied between each computer. I would probably still be picking away at it. Thanks! (My game may run at around 200MB on this computer, but on my old one it only takes 50-60.) Edit: You too, Kain. You're being helpful as always. 1 Link to comment Share on other sites More sharing options...
Godmaster Posted February 26, 2008 Author Report Share Posted February 26, 2008 I'm going to rep you for this topic, Godmaster. If it weren't for this, I never would have guessed that the RAM usage varied between each computer. I would probably still be picking away at it. Thanks!(My game may run at around 200MB on this computer, but on my old one it only takes 50-60.) Edit: You too, Kain. You're being helpful as always. I rep you, Spike, Kain and the other people who tested this, for testing these last builds, you're the few ones that have chosen this experience (damn, I can't praise everyone in a day) So, I changed my mind and decided to continue BrazSonic 2 on GM. But I'll be still searching and learning a true programming language to make BrazSonic 3 in a near future. I'll release another with alternate character's external sprites loading soon. This can reduce even more the RAM usage. Link to comment Share on other sites More sharing options...
Spike Posted February 26, 2008 Report Share Posted February 26, 2008 Just tell me if you need me to test anything else, then. Link to comment Share on other sites More sharing options...
Ayling Posted February 26, 2008 Report Share Posted February 26, 2008 Well, BrazSonic 2 doesn't even work on my computer. it gets to the first cutscene and the whole computer stops working. That must mean it's going over 1GB of RAM. Can you make a hardware accelerated version? Link to comment Share on other sites More sharing options...
Kain Posted February 26, 2008 Report Share Posted February 26, 2008 I'm glad you were able to successfully reduce the problems. BrazSonic 2 is a really big game and it's nice to know it IS possible to manage in GM, if a little bit of trouble. Link to comment Share on other sites More sharing options...
Recommended Posts