Article View: rec.games.programmer
Article #1066Re: Software Pinball Machine
From: Tonio Loewald
Date: Wed, 11 Nov 1992 03:10
Date: Wed, 11 Nov 1992 03:10
69 lines
2801 bytes
2801 bytes
mgemmel@cs.vu.nl (Martin Gemmel) writes:
>Writing a pinball simulator is what I've been thinking of for a long
>time, too.
>f110019@hamlet.ucdavis.edu (Julian Burger) writes:
>} In other words, you would have a pinball-table description language which
>} would be parsed and a table created from it.
>The idea sounds good, but for the moment the most important question
>is just how to calculate ball motions and the effects of the various
>objects on the ball(s). I think a feature to read custom table
>descriptions could easily double the code, as you would have to
>precompute lots of data for each object (no doubt involving floating
>point operations).
>} For example:
>} bumper (50,30) { ; center position (virtual coordinates) in parens
>} size 20 ; relative to something
>} force 50 ; kicker force, or negative if absorbs energy
>} points 50
>} ...
>} etc
>I'm sure you don't want to have only bumpers, but how do you specify
>objects other than bumpers?
>Martin
My 2 cents worth:
Do the whole thing using an OOP language. Start with a base class:
CPost -- a simple object that collides with things as a point
source. Its behaviour serves as a template for any thing in the
machine (including the flippers and the spring-launcher).
A couple of obvious methods come to mind:
CPost.affectball(position,velocity,spin)
CPost.ignoreMe(position):boolean
And for construction:
CPost.placeMe
CPost.rotateMe
and so on...
The idea of the latter is to provide as rapid a method of
ignoring components as possible.
And if the ball has a CONTEXT as well as a position, velocity,
and spin, you can easily handle multi-level machines.
The best thing about all this is that it makes writing a
graphical construction utility a lot easier. You might
even write the construction utility using OOP and design it
to optimize out the OOP overhead during play.
Or you could write the whole thing in C++ and explicitly
call all the inherited functions, thus eliminating the OOP
overhead.
Tonio Loewald
--
Tonio Loewald | Ph 06 290 1594 | 13 Sabine Cl. Garran
tal691@huxley.anu.edu.au | Fax 06 290 1595 | ACT 2605 AUSTRALIA
"You can lie/You can cry/For all the good it'll do you, you can
die/But when it's done/And the police come/And they lay you down
Technical Details
Message-ID:
<tal691.721451453@huxley>Path:
arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!manuel.anu.edu.au!huxley!tal691References:
<1992Nov2.204624.24267@u.washington.edu> <18899@ucdavis.ucdavis.edu> <Bx8H5G.Gt7@cs.vu.nl>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!manuel.anu.edu.au!huxley!tal691 From: tal691@huxley.anu.edu.au (Tonio Loewald) Newsgroups: rec.games.programmer Subject: Re: Software Pinball Machine Date: 11 Nov 92 03:10:53 GMT Organization: Australian National University Lines: 69 Message-ID: <tal691.721451453@huxley> References: <1992Nov2.204624.24267@u.washington.edu> <18899@ucdavis.ucdavis.edu> <Bx8H5G.Gt7@cs.vu.nl> NNTP-Posting-Host: 150.203.2.12