Forums

ForumsProgramming Forum

Need advice on how to optimize script

Posted Jun 25, '08 at 1:52am

rytherix

rytherix

71 posts

I am currently working on a game, but I find that when the player buys some AI run allies, the fps drops from around 35-45 to 20-25. How can I fix this?

 

Posted Jun 25, '08 at 2:51am

Klaushouse

Klaushouse

2,853 posts

Wow I'd love to know what you're making that needs 35-45 fps... thats just not a good FPS to be running at. Care to fill me in?
PS: Your game should be 20-25!

 

Posted Jun 25, '08 at 3:36am

rytherix

rytherix

71 posts

my current project is running at 60FPS
I usually run things in 30fps, but for this game I wanted super smoothness. However, I am not going to run any future games at such high fps because it not only creates optimization problems, but hittest issues as well.
But as I said earlier this game needs to run at a smooth 35-50 not 20-25

 

Posted Jun 25, '08 at 3:47am

Klaushouse

Klaushouse

2,853 posts

Well my presumption is that the AI run allies do a ton of things at the same time and probably a bunch of it, it doesn't need to be doing. Cutting down on the if statements if there are many cause it checks them all. Not sure what to tell you. You have way too much going on the screen at the same time. But hell if this game runs at 60fps I am hoping big! Is it some sort of sequel to your other game?

 

Posted Jun 25, '08 at 3:49am

Klaushouse

Klaushouse

2,853 posts

BTW by AI I hope you don't mean you have some complex thinking process going in like a true AI type thing, cause that would be pretty hardcore. And bad cause your flash game would never run.

 

Posted Jun 25, '08 at 3:58am

rytherix

rytherix

71 posts

The AI I am referring to is just autonomous targeting/tracking/guiding artificial intellegence, it is able to find a target, lock onto to it, track it and fire a missile that guides to the target
its not a sequel (I am workin on that afterwards =D) its just another game, its pretty cool though

 

Posted Jun 25, '08 at 4:12am

Klaushouse

Klaushouse

2,853 posts

Well don't know how you went about doing that so that it wreckes 20 fps? Just if an MC witch certain name passes a boundary find the angle with sin cos tan and launch a missile? I have some code to have an MC track another one and follow it exactly that I used for a game. Or just go online and search heat seeking missile tuts. They will give you the most efficient way. How many MC or enemies or whatever do you have on the screen at the same time?

 

Posted Jun 25, '08 at 4:53am

rytherix

rytherix

71 posts

2 enemies at the least and up to 25 at max

 

Posted Jun 25, '08 at 5:07am

Klaushouse

Klaushouse

2,853 posts

That's quite alot and at 60 fps thats ridiculous.. most systems can't handle that dude.

 

Posted Jun 25, '08 at 7:08am

dank

dank

1,043 posts

Knight

You're going overboard with your framerate. You don't need anything above 30, everything past there will just be overload, unless you have some sort of code related thing where you need it to execute many times.

 
Reply to Need advice on how to optimize script

You must be logged in to post a reply!