Sign in to follow this  
Stru

Crazy? Design Question

Recommended Posts

I am not sure if this belongs here or Software Engineering. But I have a question about the design of my game engine. Most code I have seen measures the time that has passed and then calls something like an Update(timestep) method on each game object. However, I am planning to implement a very different system in my game. I don't know if other games use it (it seems similar to Dead Reckoning but I am not sure, since Dead Reackoning seems to me to be mostly about predicting positions of objects over a network and not event times). My plan is to only update objects at the time at which an in-game event occurs on that object. For example, user input or collisions. There will be no time-step. Of course, the renderer would still extrapolate the object positions for the purpose of displaying them at the current time. The biggest problems I see with this implementation are that collision detection will get significantly more complex and hard to optimize. I would need to calculate IF and WHEN two objects collide. Also the abstractness of it all could be too much for my brain, since there is no game state for the current time (Just thinking about it makes my head hurt). Rather, you have a bunch objects at different positions with different velocities at different times. You also cannot optimize based on object position since objects (especially bullets) could travel all the way across the map between events. One advantage would be that you could in a limited way, backcalculate (is that the right word?) events in order to compensate for network lag. And you can eliminate the need to send object positions over the network. You could also de "bullet-time" type effects very easily or speed up the system to as fast as the computer can compute the events. Do other games use a system like this? If so are there any problems/things I should plan for? I know collision detection will probably be very very hard, but I am good at Geometry and Physics and I would really like to implement this system in my game. My game idea is relatively simple its 2D rendered with polygons (complexity on the level of Subspace or Soldat). I think I will make an online pong game using this design before I start on my game, just so I get a feel for the issues/problems. Any pointers? I would particularly like to know about any other games that work like this.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I don't really see a need for it but why not - could be done.

Of course you can do bullet time otherwise too. Just slow down time.

Share this post


Link to post
Share on other sites
I know of no 3D engines that work like this. It just seems impractical to me. You're not really going to end up saving CPU cycles, but rather wasting them on predictions (like a cache miss), because of the random nature of some AI and of the human players.

The closest I have seen to this is Quake 2. Instead of updating the AI every frame, it stores the time the next update is scheduled... So the AI can "sleep" for a fraction of a second, for example. This saves CPU cycles in some situations. Its useless for a monster to really check if it sees enemies every single frame, for example... You could make it perform a check every 0.2 second instead. Same for homing missiles. They can be updated every 0.08 second, etc. This delay can also vary depending on the state of the AI, so its not a constant.

Share this post


Link to post
Share on other sites
But for each object you could do one collision prediction per object. And you would only have to re-predict objects that change and only when they change. A bullet for example would only have to predict its collision with the level once, since the bullet doesn't change trajectory mid-flight and the level is stationary. And it would only have to repredict its collisions with players when they change their input.

Yes, the collisions are more computationally expensive, and harder to code. But you do a lot less of them while the game is running. At least thats how I see it, but I may be wrong.

I have been reading about it on wikipedia and I believe that it is called priori collision detection as opposed to posteriori collision detection that most games use.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this