 |
Radiopatrullen: Technical stuff
|
 |
Not wanting to spend more time than necessary on the graphics, I decided to draw
each car just once and rotate it inside the program, to get all the directions
needed for turning. I'd done something similar in Car Jam,
but that game only had two directions for each car. This one required 16 (except
for the ambulance, which you never see turning and thus gets by with just four).
Here is the full set of images the player car's pixel data gets turned into. If you
look closely, you will notice that it's not only a matter of rotation. In some cases
the images have also been "flipped" for consistency with light coming in from
the left.
I should point out that the game was written according to the Java 1.0.2 standard,
where there aren't any fancy built-in rotational tools. This all had to be done
pixel by pixel, using linear algebra and trigonometric functions.
But pixel manipulation wasn't the hard part of the programming. Far from it.
The real challenge was maintaining the illusion of a city full of people
and cars. I soon realized that I couldn't use the technique from Urbanoids,
where I had a small, fixed set of robots, each "patrolling" a designated rectangle
of the map. There would either be too few other cars that way, or they'd
have to be equipped with some mighty sophisticated artificial intelligence in
order not to run into each other. (It wouldn't look right to have a car
occasionally driving on top of another car without crashing.)
My solution was to use only one other car, which would be inserted at a random
point just outside the visible region at regular intervals, each time with a
new look. It interacts with the background and objects for as long as it remains
within a couple of inches from the player car. When it gets further away and
disappears from sight, it also disappears literally. The pedestrians behave
the same way, except that there are more of them.
|