Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

Beta testing for BrazSonic 2, for troubleshooting - new build released


Godmaster

Recommended Posts

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

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

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

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

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

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

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).

  • Like 1
Link to comment
Share on other sites

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.

  • Like 2
Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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 :P

(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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...