00:00
00:00
WarpZone

Age 45, Male

Joined on 1/26/05

Level:
14
Exp Points:
2,084 / 2,180
Exp Rank:
30,280
Vote Power:
5.63 votes
Rank:
Police Officer
Global Rank:
13,327
Blams:
268
Saves:
454
B/P Bonus:
10%
Whistle:
Bronze
Trophies:
1
Medals:
721

Comments

Good Flash code is an oxymoron.

Did I say this would make your code good?

I'll be happy if you write ugly code that doesn't break the 500th time an enemy fires a shot.

You can force garbage collection if you know you'll have some time where frame skipping doesn't matter (end of a level, menu, etc) with flash.system.pauseForGCIfCollectionImminent(). I've never had a problem with it though.

Good tips, especially copyPx

Sometimes, "I've never had a problem" is the problem.

Having said that, I've seen your games, and performance-wise, they seem pretty solid.

If you don't mind my asking, what's the main loop look like in Juggernaut?

Working on the sequel now, main loop looks like this https://twitter.com/msghero16/status/426441560570347520

Consists of:
Update current state (some states have collisions and movement, some just animations, some nothing)
Render current state, I use a mix of sprites and copyPx that suits performance and clickability.

Only when entering a new city does the performance ever rise, and only for a single frame.

You mean that if you use Movie Clips and don't take into accout the framerate lag, then game objects will get stuck in walls? That's clearly not the reason for bugs. Maybe performance - yes. But not bugs.

Okay, I didn't spell it out in the image, but what I think is going on here is that it's using addChildAt to layer all the bullets and enemies and things as MovieClips on the stage. If you code this in a slackish manner and don't test it by running the game for as long as an actual player would run the game, you won't realize that at some point that int you keep incrementing either wraps or hits the built-in child limit and defaults to something else. Now your code is trying to update bullets that don't exist, and the bullets that do exist just appear in mid-air and don't move.

So, yes. If they used BitmapDatas instead, they could have avoided this.

They could also have avoided it by keeping track of their child layers and being wary of the limitations and testing it thoroughly and finding a graceful way of establishing a practical ceiling on child layers and handling it nicely when that ceiling is reached... but essentially you get all that and more if you just implement Object Pooling.

...real gamer.

Yeah, you know. A real flesh-and-blood human being who is playing your game. I.E. not playing like a developer running a test case on a single feature.

An end-user. A player. A consumer. An operator. Take your pick.

dat list

Damn, I wish I knew what you were talking about, or even how to apply it.

Google is the genie that can make your wish come true!

Perform the following Google searches and read as much as you can:

AS3 bitmap display programming
AS3 delta timing
AS3 object pooling
AS3 performance optimization
AS3 garbage collection problems

Good luck!

Thank you very much!
Really good reading.