Game Development Question

Started by
0 comments, last by DevLiquidKnight 21 years, 6 months ago
Up to this point I usually put all my AI and ect into one huge game and it runs fine. However when I move my AI ect I usually use loops to update the an ARRAY of AI as well as bullets and as well as partical type systems. I was wondering about this because it seems like if you had too many loops it would like cause each frame to take forever to update. And it slows my games down is there a differnt way of doing this to update AI? bullets ect? that im not seeing its kinda bothering me because I don''t exactly know. Or are all the games like this? Or do they use multithreading some how? I just was wondering because it seems like it would eventually cause tons and tons of lag after time. To give you a basics on how my game works I show you a digram. WndMain(processes beginning of window as well as transfering all messages to WndMainClass) -> WndMainClass (does all the basic window stuff) -> GameMain (handles most of the frame updates loops direct x stuff) from game main i have somthing like. ...........-->CAi (controls AI movement) ........../ GameMain - ..........\ ...........-->CPlayer (does update type of stuff for the player)
Advertisement
You''re creating a simplified world model in stuctures that you can easily apply ai logic to, right?

What I''d do is try and split what needs ''detecting'' into X groups that take approximately the same time to calculate and then only build structure X, every X frames. In other terms, you''re filling a one of your structures every frame in a cycle, and you''re AI is working on data that is on average X/2 frames old.

This way you avoid your framerate jumping if you were calculating everything every X frames, and you avoid the irritations of multithreading.
-----------------------------www.assimsoft.com

This topic is closed to new replies.

Advertisement