Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Game Events and Scripting

by samtregar (Abbot)
on Jun 15, 2007 at 22:08 UTC ( [id://621532]=note: print w/replies, xml ) Need Help??


in reply to Game Events and Scripting

There are many good books about game/simulation design, although most are going to show their examples in other languages. I recommend you pick one up anyway - the concepts will be highly portable and it definitely looks like you need to do some research before starting this project!

On the other hand, maybe all you need is a hint. Here's one - most simulations use a global loop which increments every object once per pass and then updates the screen with the results. Something like:

my $ticks = 0; while (1) { $_->update($ticks) foreach (@objects); $screen->draw(@objects); $ticks++; }

Each object is responsible for updating its state and exposes some kind of standard interface used by $screen to do the output (x, y, color, texture, etc). I don't know why you'd bother with XML and log files, but you could consider outputting them similar to re-drawing the screen.

-sam

Replies are listed 'Best First'.
Re^2: Game Events and Scripting
by bladx (Chaplain) on Jun 15, 2007 at 23:11 UTC
    Thanks for the hint! I remember learning a little about that in a class a long while ago... but I didn't think about how it could still apply for this type of thing as well.

    The reason why I'd even be outputting something to some type of data file... is (like I mentioned in the reply above this,) because this isn't a simulation that both runs and shows a graphical display of what is going on all that same time. I'm purposely trying to break it up into "episodes" so that when the information/data is turned into a Flash movie (or whatever is doing the graphical display side of things...) it can be a manageable size.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://621532]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-04-26 00:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found