[4.5.X] I can't have 4 objects on screen without slowdown?

JayJayHux

Active member
Im hoping to get some help or advice on allowing my game to run at least 4 objects or hopefully more at the same time without slow down?
At the moment i have my playerObject and he has a swordObject attached to him at all times. so thats 2 constant objects that will always be there. He also has a projectile but I have now changed it from an object to a DrawSprite with a couple of variables and it works well. If I add 2 more objects onto the screen even if the are just static there is noticable slowdown. All my playerObject/swordObjects movement and collisions are coded myself as I find it easier to control whats happening or debug/fix glitches. I can do the same with the monsters/moving platforms but id like to be able to place them using the GUI.
So basically im wondering if theres anyway to make the objects more efficient and remove some unused code or something so i can have at least 2 enemies on screen without slowdown?
Any help or advice appreciated.
Thankyou NESmakers.
 

tbizzle

Well-known member
Oh yeah, that'll slow it down. What you can do instead, if it isn't going to set you back, is to just make the sword part of the player sprite and to just create an invisible melee object using an input script.
 

JayJayHux

Active member
Oh yeah, that'll slow it down. What you can do instead, if it isn't going to set you back, is to just make the sword part of the player sprite and to just create an invisible melee object using an input script.
Thanks for the reply Tbizzle.
I had considered that but whats the different between an object and a melee object? like i decided to just have the swordObject there always because if i use the object(attack) it will become 2 objects anyway(player and sword) so then i would reach slowdown everytime i use my sword anyway? and if i do make my sword a sprite im still only limited to 3 objects max on screen without slowdown. It seems like there must be alot of unessecary stuff going on in the background?
 

tbizzle

Well-known member
It would be much better to have the melee object only appear when in use. It is better for the slowdown to only occur when you attack, rather than all the time.
 

JayJayHux

Active member
It would be much better to have the melee object only appear when in use. It is better for the slowdown to only occur when you attack, rather than all the time.
Maybe, it wont solve the issue though of only having 3 objects max, and having slowdown everytime i press b is not really going to work either.
 

JayJayHux

Active member
So is it just normal that 3 objects is the max without slowdown? Im abit confused about this. I feel like ive seen nesmaker games and joes tutorials with like 4, 5, 6 objects before slowdown? Also how are 4 player games made without slowdown?
Any advice please? Im just trying to determine my best option moving forward.
 

smilehero65

Well-known member
One big thing Joe recommends on his videos on shooter module is replace the animation system - which consumes most of the CPU. The result is that you need to manually draw the sprites on screen, not through UI. Doing this will definetly remove slowdown, but it's a long and tedious process – and sadly there is not a detailed tutorial on this aside from:


Also, on a different topic, you may try and optimize the object handling system.

 

JayJayHux

Active member
One big thing Joe recommends on his videos on shooter module is replace the animation system - which consumes most of the CPU. The result is that you need to manually draw the sprites on screen, not through UI. Doing this will definetly remove slowdown, but it's a long and tedious process – and sadly there is not a detailed tutorial on this aside from:


Also, on a different topic, you may try and optimize the object handling system.

Thanks for the reply Smilehero.
They both seem like options that can help me in the right direction. I will check them both out and im sure it will help me figure out my best option. Even if its inconvenient i think it will be worth it.
 

JayJayHux

Active member
I had seen all the videos related to platformers and the 12 days/13 bytes videos, but I didnt bother with the shooter videos as im not making a shooter but the advanced video it seems has exactly what i need to reduce slowdown whilst still placing objects with the gui. It will be time consuming to reverse engineer a few things ive done already but this should be a really big help to increase my objects on screen. Thanks @smilehero65!
 

dale_coop

Moderator
Staff member
Yeah, NESmaker 4.5.9 is really cpu consumming. That's a bummer. Personally I try to hard code all the easy animations (weapons, simple monsters, ...) it's a lot painful specific code to write but it reduces a little bit the slowdowns. and I skip 2 or 4 frames for object collisions (depending of the pace fo the gameplay of the game)
 

JayJayHux

Active member
Yeah, NESmaker 4.5.9 is really cpu consumming. That's a bummer. Personally I try to hard code all the easy animations (weapons, simple monsters, ...) it's a lot painful specific code to write but it reduces a little bit the slowdowns. and I skip 2 or 4 frames for object collisions (depending of the pace fo the gameplay of the game)
Thanks for the reply Dale.
It is unfortunate that the objects are so CPU heavy. Im just hoping if i write all the object sprite draw code copying Joes example from the shooter tutorial, that I can increase objects on screen without slowdown from 3 to maybe 5?? is that realistic?
For projectiles or similar i just use DrawSprite with my own variables so that hopefully helps abit too. It might be hard for me to reduce the collision frames though because im trying to make a precise platformer with one way platforms etc.
 

SHLIM

Active member
Thanks for the reply Dale.
It is unfortunate that the objects are so CPU heavy. Im just hoping if i write all the object sprite draw code copying Joes example from the shooter tutorial, that I can increase objects on screen without slowdown from 3 to maybe 5?? is that realistic?
For projectiles or similar i just use DrawSprite with my own variables so that hopefully helps abit too. It might be hard for me to reduce the collision frames though because im trying to make a precise platformer with one way platforms etc.
check out the bullet routine script on the forums! that will help and will also help understand howto bypass & write your own collisions
 
Top Bottom