Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > General > Gaming and Game Development

Reply
 
Thread Tools Rate Thread Display Modes
Old 04-14-2012, 07:42 AM   #1
jwhechler
Registered User
 
Join Date: Apr 2012
Posts: 11
Exclamation Reusing Premade Objects.

Greetings all,

I'm new to this site, but not really new to flash. Wasn't quite sure where to post this question so I figured here was as good as any. If I'm in the wrong section, please let me know I don't want to confuse anyone. Any help at all is appreciated as I've been struggling with this problem for a while now. Ok, so here goes...

The Program: I've been designing and programming a flash game from scratch ever since October. It started out as my senior project and has since turned into a long and drawn out process. Of course that is to say, I've been doing everything by myself and I also have a full-time job at night. Therefore the production schedule is rather non-existent. I work on it when I have the time and patience to deal with developing bugs. I code everything in ActionScript 3 and nothing is coded into any of the frames on flash, all graphics are images that are imported after I made them in a separate program. They are mostly *jpgs and *pnps. The game is structured so that I have a multiple class set up, such as a main, enemy, avatar, and projectiles class. If more info is needed I will provide, but that should give most a basic understanding of what I'm doing. So with that said...

The Situation: A few months ago I noticed the game dragging a lot. Once the "enemies" start accumulating on screen. I judge this, in part, was due to the real-time creation and deletion of enemies. After doing a general search on optimization techniques it occurred to me to try and "pre-render" a set number of enemies to use over and over, thereby decreasing the strain on flash to "reassemble" new enemies from scratch every time. As per the norm, the main class judges when to add enemies and respawn the player and such. The way I have this set up is a set number of enemy objects are created right away and the attributes are passed to an object array to keep track of locations and states and what not. When an enemy is called there is a search done of the object array to determine which type of enemy is needed and it's ID is returned. The ID is then passed to another public variable that the enemies class then checks to determine which enemy is being called, which then changes the state of the enemy with that particular ID corresponding. Now, ya got all that?

The (Current) Problem: For one, the game still lags horribly, and now the enemies aren't even working correctly. I've run tracers on the enemies and discovered that even though only one enemy ID is called, several of the "inactive" enemies turn up as "active". This may not be the cause of the lag, but it may be why the enemies are not "behaving" correctly. This bug is one I consider to be an error simply because I cannot figure out why multiple enemies are active when the tracers show only one enemy is singled out.

So if anyone has any ideas as to why I'm having this problem, please don't hesitate to contact me or respond. Again I appreciate any help at all. Thanks again.

Sincerely,

J aka "Onyx"
jwhechler is offline   Reply With Quote
Old 04-15-2012, 03:42 AM   #2
TJRobertson86
Registered User
 
Join Date: Apr 2012
Posts: 37
Default

Unfortunately, I'm too new to actionscript to help you with your specific problem, but maybe I can help you get the help you need :P

First of all, the best place to post this question would probably be in General > Gaming and Game Development. (I made my first post here, and it got moved there... they'll probably move it for you)

Secondly, I think you'll need to post a link to your fla, or at least some of the code where you're having issues before people will be able to help you.

Hope that helps, sorry I'm not more knowledgeable in actionscript

TJ
TJRobertson86 is offline   Reply With Quote
Old 04-15-2012, 06:21 AM   #3
jwhechler
Registered User
 
Join Date: Apr 2012
Posts: 11
Default

TJ,

Thanks for your advice. I appreciate it immensly. I'll be sure to make the corrections.

Sincerly,

J
jwhechler is offline   Reply With Quote
Old 04-15-2012, 06:37 AM   #4
jwhechler
Registered User
 
Join Date: Apr 2012
Posts: 11
Exclamation Reusing Premade Objects.

*Note: This thread moved from separate category.

Greetings all,

I'm new to this site, but not really new to flash. Wasn't quite sure where to post this question so I figured here was as good as any. If I'm in the wrong section, please let me know I don't want to confuse anyone. Any help at all is appreciated as I've been struggling with this problem for a while now. Ok, so here goes...

The Program: I've been designing and programming a flash game from scratch ever since October. It started out as my senior project and has since turned into a long and drawn out process. Of course that is to say, I've been doing everything by myself and I also have a full-time job at night. Therefore the production schedule is rather non-existent. I work on it when I have the time and patience to deal with developing bugs. I code everything in ActionScript 3 and nothing is coded into any of the frames on flash, all graphics are images that are imported after I made them in a separate program. They are mostly *jpgs and *pnps. The game is structured so that I have a multiple class set up, such as a main, enemy, avatar, and projectiles class. If more info is needed I will provide, but that should give most a basic understanding of what I'm doing. So with that said...

The Situation: A few months ago I noticed the game dragging a lot. Once the "enemies" start accumulating on screen. I judge this, in part, was due to the real-time creation and deletion of enemies. After doing a general search on optimization techniques it occurred to me to try and "pre-render" a set number of enemies to use over and over, thereby decreasing the strain on flash to "reassemble" new enemies from scratch every time. As per the norm, the main class judges when to add enemies and respawn the player and such. The way I have this set up is a set number of enemy objects are created right away and the attributes are passed to an object array to keep track of locations and states and what not. When an enemy is called there is a search done of the object array to determine which type of enemy is needed and it's ID is returned. The ID is then passed to another public variable that the enemies class then checks to determine which enemy is being called, which then changes the state of the enemy with that particular ID corresponding. Now, ya got all that?

The (Current) Problem: For one, the game still lags horribly, and now the enemies aren't even working correctly. I've run tracers on the enemies and discovered that even though only one enemy ID is called, several of the "inactive" enemies turn up as "active". This may not be the cause of the lag, but it may be why the enemies are not "behaving" correctly. This bug is one I consider to be an error simply because I cannot figure out why multiple enemies are active when the tracers show only one enemy is singled out.

So if anyone has any ideas as to why I'm having this problem, please don't hesitate to contact me or respond. Again I appreciate any help at all. Thanks again.

Sincerely,

J aka "Onyx"

P.S. Code snippets soon to be added.
jwhechler is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:30 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.