Potential lag issues with side scroller?

brett-nortonbrett-norton Member, BASIC Posts: 64

Im currently making a side scroller and will have different types of enemy actors with up to 3 of the same enemy actor on screen at once the scene will be about 10000 wide.

im considering a spawn actor spawning in the enemy off screen and then destroying once hit with player actor.

My question is will this cause me lag issues re spawning and destroying?

Im really struggling to code in recycle enemy, my main issue is when i have 3 enemy actors all of the same prototype the first enemy can hit and damage me but if i was to then hit an enemy the other enemy from then on cant damage me.

Comments

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    Spawing will not cause lag. That was a very old issue, like 4 years ago. @Socks did a bunch of tests using hundreds of spawning actors with no lag. Generally, lag is from bloated code. See my custom collision shape videos and I spawn and destroy actors every .10th of a second.

  • brett-nortonbrett-norton Member, BASIC Posts: 64

    Thats great news then.. i had the code working fine with spawn and destroy and then must of ran into some old posts from 2012 advising not to do it that way.. so i spent the last 2 days trying to figure out the code to recycle. Thanks for the advice gamesalad_guru much appreciated.

Sign In or Register to comment.