ForumsProgramming ForumNeed advice on how to optimize script

12 3963
rytherix
offline
rytherix
68 posts
Nomad

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?

  • 12 Replies
Klaushouse
offline
Klaushouse
2,770 posts
Nomad

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!

rytherix
offline
rytherix
68 posts
Nomad

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

Klaushouse
offline
Klaushouse
2,770 posts
Nomad

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?

Klaushouse
offline
Klaushouse
2,770 posts
Nomad

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.

rytherix
offline
rytherix
68 posts
Nomad

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

Klaushouse
offline
Klaushouse
2,770 posts
Nomad

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?

rytherix
offline
rytherix
68 posts
Nomad

2 enemies at the least and up to 25 at max

Klaushouse
offline
Klaushouse
2,770 posts
Nomad

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

dank
offline
dank
983 posts
Peasant

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.

rytherix
offline
rytherix
68 posts
Nomad

yay dank is here!
however you people need to stop bashing on my ownage 60fps game. I figured out how to fix my problem tho, and now it runs at 45-55fps so great success

see, I have a XFX GeForce8800GT so I am used to running games at 60fps lol, funny thing is tho my fancy ass expensive graphix card doesnt do a damn towards my flash benchmark because flash runs purely through your processor since its all vector math lol

Klaushouse
offline
Klaushouse
2,770 posts
Nomad

LMAO. Howd you fix it.

dank
offline
dank
983 posts
Peasant

Still don't see why you need that high FPS. Why do you need it so high?

Showing 1-12 of 12