Tuesday, February 14, 2006

Objects.

As I've said before, an empty universe isn't very interesting. There needs to be some kind of object or objects in it. Since "object" is such a generic term, I'm going to start with a simple one with only one property; it's position.

class Particle
{
private:
int x_pos;
int y_pos;
public:
Particle(int x, int y);
set_position(int x, int y);
};

This can be related to other topics already discussed.
I haven't considered the possibility that space itself may be expanding or contracting. It's an interesting notion that I will have to set aside.
I also haven't considered the possibility of considering parts of space versus the while of space, but will gave to set this aside.
If particles positions or other properties do not change with time, they may form a static, unchanging universe. Most generally, it is useful to have some objects that are static, and some that can move, but motion will be discussed later.
It's necessary to consider whether a particle is actually in the space. In placing or moving it, the position has to be within the range of possibilities for the space.
For now, I am limiting the consideration to particles that have only one position. The larger the space, the more particle-like a body will seem. Extended bodies will be considered later.
Also, for now, I am adopting a rule of exclusion: Only one particle may occupy a given position at a time. There is the possibility of having overlapping bodies, but this is another topic that has to be set aside.
For now, I am considering whether particles can be created or destroyed; added to or removed from a space. If they can, the space represents an "open" world; if not, it represents a "closed" world. Most games include, at least implicitly, open worlds.
I can also consider whether the universe is "full" or "empty". For a finite universe with non-overlapping objects, there are no more objects possible than members of the space. If they can overlap, there is no upper limit to the number of objects.

This gives rise to the question of whan and how objects are placed in this artificial world. Establishing an initial configuration of objects that cannot be moved within a game or simulation is a very common procedure and is typically done by a separate editor program. This is typically done in order to set up a "map" of space
In order to add, or remove objects, it is necessary to have some means of specifying the position, and if the objects do not overlap, whether there is something already in a desired position, plus what happens if there is something in a desired position.
For simple spaces, it can be useful to describe each point in space, whether or not it is empty, and perhaps which object is there. For larger spaces, this becomes impractical and it becomes more useful to maintain a list of objects and their positions. This may require techniques for handling lists of unspecified length, and to determine whether a given position is empty or not may require processing the list of objects, the "map" of space, or sometimes both.
All this requires a little more programming than I have done so far, and still not produced anything useful. But at least a non-empty universe is more interesting.

0 Comments:

Post a Comment

<< Home