[x]

deviantART

 
About Me Member Programmer Ross18/Male/United Kingdom Recent Activity Deviant for 1 Year
Needs Premium Membership
Statistics 10 Deviations
747 Comments
3,520 Pageviews

Co-operative Multitasking in Games

Sat May 30, 2009, 5:50 PM
Since January, I have been working on an engine alongside a game for college. I've added some interesting functionality that I haven't implemented before, such as making the main engine and game components event-driven, and separating the player's perception of the world from the underlying simulation. While I'm sure there are better methods I could have used, I am under time pressure, which is a new phenomenon for me (in the context of game development).

The current issue involves co-operative multitasking. I am working on a task manager that will be accessible to any system that needs it.
In essence, a task is any action that needs to be updated either continually, or on a basis determined by an interval in milliseconds. A task can start a new task, or kill another task. It can even kill itself. Due to this, intricate sequences of tasks can be woven together in order to produce very interesting results.

An example would be a rocket launcher in a shooter. When the user clicks the mouse button, the game responds by performing some tasks, such as a gun recoil animation, a rocket movement task, a particle emitter task, and probably quite a few more. The rocket movement task would be written in such a way that when the rocket collides with an obstacle, it kills the rocket movement task, and starts an explosion task. This would progress, and as the explosion volume increases, a test for collision would be performed on objects in the scene. As those objects are destroyed, so are any tasks associated with them.

Of course, all of this is simple enough to explain in the abstract, but the implementation is somewhat tricky. If anyone has any experience with this kind of system and can lend some advice, or can point me to an article that explains a potential solution, I would be very grateful.

Thanks,
Ross.

EDIT:

I have been up all night designing this, and just finished implementing it. It completely rocks. I can now do rendering and logic completely asynchronously. In fact, I can do logic itself asynchronously, and decrease the interval for more important tests. For example, in Regalia, a MoveCharacter task will be updated fairly regularly, as it does character and tile collision detection. However, if I want to add some AI pathfinding, the path generation task could run faster or slower than the movement. Hmm... I see potential multi-threading in the future.

  • Mood: Daily Needs
  • Listening to: The Margretville Dance by Prize Fighter Inferno

deviantID

No deviantID yet.

Devious Info

  • Current Residence: Howwood, Scotland
  • Interests: Programming, Guitar, Gaming, Electronics
  • Favourite movie: The Matrix
  • Favourite band or musician: Coheed and Cambria
  • Favourite genre of music: Progressive Rock
  • Favourite style of art: Technology
  • Operating System: Linux (ubuntu 8.10), Windows XP Home
  • Favourite game: Dragon Warrior Monsters
  • Favourite gaming platform: Linux PC, PS3
  • Tools of the Trade: Computer, Compiler and lots of books. Oh, and a guitar.

deviantART Notice

[x]

Comments


thanks for the watch!

--
Clubs I'm in: [link] < DesertPrinceQuatre [link] < yaoi-empire ~kyoukaramaou [link] < sunsets
Hi, its me. made my new account with owls on ^^

--
too-wit too-woo
Heya :)

--
Aim high. Work hard. Achieve often.
*loves*
why not put up your game character vector things? They were really good ^^

--
too-wit too-woo
I'm going to put Regalia up in one go when it's done :)

--
Aim high. Work hard. Achieve often.
:iconblushingplz:
Hi :giggle:
Thanks for the watch :blowkiss:

--
...in my panties :noes:
Welcome :D

--
Aim high. Work hard. Achieve often.
I didn't feel like making a new journal entry, so I'm just sending this to those I'd like to see the answer from. ^^

[link]

--
I'm never serious. Seriously.
cool!! we're the same age, except your a programmer and I'm not. :(
hahaha

--
super_cow_license ()
{
insert_object_name$ = "signature"

You may use this insert_object_name$ for any purpose, even if said purpose is beyond the capabilities of said insert_object_name$ (i.e. give you super cow powers)
}

Site Map