The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Design for frame based system

How are the applications that are frame based designed?
What I mean by frame based is something like vector animations etc. The screen is rendered frame-by-frame based on the properties of the objects in the screen.
One thing I'd also like to know is how are different timelines maintained in the same application? Here in this case of various timelines, an object can have it's own timeline maintaining it's own frames.
How are these designed? Threads? Timers?

Tuesday, August 14, 2007
 
 
I once wrote a screen saver that displayed planets that moved based on gravitational pull they had towards eachother (email me if you want a link to download ;-).

I just used a game-loop that rendered one scene at a time. If you have something like 20-30 frame per second you have a decent 'movie' (or game).

I did no threading (because the calculas involved was real simple) but I can see using background processing for more complex things. I also didn't use a timer for triggering the frame renderings, just a simple while(true) loop.

If you have multiple timelines (at different resolutions?), you will have to merge them into one timeline that is being rendered to the screen.

If you're on the .NET platform check out XNA or DirectX(3D) if you use C++ on Windows.
Marc Jacobi Send private email
Tuesday, August 14, 2007
 
 
I guess that a way might be to have a single event queue as follows:

class Event
{
 Time timeInTheFuture;
 Object objectToBeUpdated;
};

typedef Queue<Event> Events;

When an object wants to have more more processing done on itself or or another object at some time in the future, it creates an Event object which it initializes to the specified time, and puts it on the queue.

One or more threads can then dequeue Event instances and process them. A naive implementation would dequeue events in sequence, a more sophisticated one might have several queues based on priority and/or include a hint in each event to how much processing may be required (so that if an event will require a lot of processsing a thread can start work on it early).
Christopher Wells Send private email
Tuesday, August 14, 2007
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz