Shooter with no spawning bullets.

UtopianGamesUtopianGames Member Posts: 5,692
edited November -1 in Working with GS (Mac)
I have been testing a shooting game that doesn't use spawn bullets and destroy bullets.

As most know spawning a lot of bullets really effects performance (even on the iPad) so during my bout of toothache (not had a lot of sleep for a week) i decided to give it a go and i reckon it's very possible to make a fast smooth action packet Shooter with GS.



Darren.

Comments

  • ToastKittenToastKitten Member Posts: 360
    This is really interesting, I'm gonna try and wrap my mind around this!

    Excited to see more and more workarounds :D
  • ToastKittenToastKitten Member Posts: 360
    Oh snap, why didn't I think of that xD

    I'm guessing that each bullet has a numeric identifier and is called back to the blue rectangle's x,y positions and is given its velocity again ONCE the game variable matches it's unique number. Once it hits an enemy it goes off screen, turns invisible, and is stopped so that it can be called by the shooter again. So yeah like TShirt said, they're never destroyed or spawned, always on the screen. Recycling :D

    This is all theory, but its making good sense in my head at the moment x]
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    ToastKitten said:
    Oh snap, why didn't I think of that xD

    I'm guessing that each bullet has a numeric identifier and is called back to the blue rectangle's x,y positions and is given its velocity again ONCE the game variable matches it's unique number. Once it hits an enemy it goes off screen, turns invisible, and is stopped so that it can be called by the shooter again. So yeah like TShirt said, they're never destroyed or spawned, always on the screen. Recycling :D

    This is all theory, but its making good sense in my head at the moment x]

    Exactly what i was thinking
  • UtopianGamesUtopianGames Member Posts: 5,692
    Yeah that's correct guys, not tested on device (plan to do so in a mo) but i'm sure this way will be better.

    I also have the 10 hidden bullets with movable off so it should work with high fps.

    Edit...running at 60fps on 2nd gen touch when moving and shooting as fast as i can (it won't run so smooth when you have enemies moving and shooting and BGs scrolling or whatever but fps is good so far:P).

    Darren.
  • gazjmgazjm Member Posts: 578
    I started making a shark shooter game a few months ago, which I've kind of lost my way with, but I had a similar setup on that, didn't spawn just had 8 bullets and an attribute to cycle through, when it was the bullets number and fire was true, it fired, then back to the shooter when destroyed etc. Although my way would have been a bit more intensive on memory as I was using move! Didn't think of interpolate!
  • TwistedMechTwistedMech Member Posts: 408
    Darren, can you add this to your template pack?

    I need to add this to my shooter but would like to know how you did the timing after the actor was told to move to start x/y.
    Does each bullet have an after 0.1, after 0.2 type of setup?

    You are a god send :-)
  • TwistedMechTwistedMech Member Posts: 408
    had a few mins to think about this and will try the following.

    set game.turretX and game.turretY to actor who wants to shoot the bullet.
    set game.counter to value 1 to max bullets (10)

    have max-bullets (10)x bullet actors on screen and in each one...

    if self.active = true then
    do fire move process
    else
    init the setup of actor so move it off screen and wait.
    endif

    for each bullet actor duplicated on scene...

    if game.counter=1 then self.active = true

    As the turret will have a timer like every 0.5, game.counter=game.counter + 1, each bullet actor will get called into action every 0.5 seconds if its self.active = false. it just needs to loop from 1-10 every 0.5.
  • simo103simo103 Member, PRO Posts: 1,331
    Hi Darren .. cool looking demo. I have a question ... my project presently spawns numerous actors continuously and the gameplay is to redirct those actors in various ways. I have them being destroyed offscreen. My fps is about 30 on a 2nd gen iPod Touch and I still plan to add a few more actors/behaviours to the screen like zoom in/out etc. The background is stationary and the other actors are touched and dragged to move (so no free moving enimies etc)

    I have seen some discussion of the perils of spawning actors ... and the fps. Is there a lower limit that you would attempt on a 2nd gen Ipod?

    Also if in your opinion what I am attempting to do above by spawning is the wrong route ... any chance you could let me know if this new solution is going to be a part of the platform you are selling or a different deal. Got a feeling I might be wasting my time in the wrong direction.

    thanks.
  • UtopianGamesUtopianGames Member Posts: 5,692
    @TwistedMech There's no timers involved in this example.

    I do think spawning a lot of actors is a bad thing and it looks like this method is better but it's early days atm.

    No it wont be part of my platform template pack.

    Imo 30 fps for a shooter is pretty good going using GS but im sure with a few tweaks it could rise to 45 fps.

    Darren.
  • TwistedMechTwistedMech Member Posts: 408
    I converted my turrets to use 10 bullets as a test and 10 small explosions which were activated if any of those bullets hit an object. Works ok and no timers just game.Boolean flag and integer 1-10 to activate bullet when available.

    Only problem now it seems to crash faster on the ipad than the old spawn/destroy method.

    For me, I will have to make a decision on dropping gamesalad for shooters as no matter what I do, it's always unstable on the ipad.

    Tomorrow I will add a few enemies to your platform template and leave it running overnight to see how it runs. I will add a few particles to see if there is a leak there.

    Gs helpdesk have one of my crap concept games which crashes after 180 seconds. Its been with them a couple of weeks and they have not yet isolated the problem. It's one of those things where I would avoid all the unstable rules if I knew which ones they were. :-(
Sign In or Register to comment.