I'm getting back to an AS2 game that had some fairly serious performance issues. Early on there were no inidications that anything was wrong. It's a God's eye view of space, with a turret in the center (that's you, the player). Merchant ships appear on the left cent of the screen and travel to the right, then go back. Trade ships start at the top center, run down and go back up. Pirates appear in the upper left, raiders in the upper right, invaders in the lower right, and buccaners in the lower left - these all move diagonally.
Ship shapes are simple - geometric: circle, star, rectangle... There's no bullets, just lasers that shoot when a particilar vessel gets in range of another (pirate shoots merchant, then the merchant shoots back). Everything is drawn using vectors.
From what I can tell, the issue centers around several effects I made: smoketrail (made when a ship exceeds a level of damage - 3 levels), explosion (lots of fast moving particles that happen when you shoot/hit a ship), shrapnel (happens when a round of damage exceeds a level), and the lasers. I think the worst offender is smoketrail. When you see the slowdown and kill off a ship with a smoketrail, many times the performance returns to normal.
I've started by changing the effects into separate classes. I've almost got the explosion class done and will tackle SmokeTrail next. There's over 1300 lines of code just in the framescript. There's at least twice that much in the class files.
Any suggestions would be appreciated.
Page 1 of 1
0 Replies - 2641 Views - Last Post: 05 April 2013 - 01:42 PM
Page 1 of 1