City File Format, Draft V1

advertisement
City File Format, Draft v2
The file format is a comma-separated list of integer values, a new line for each new item. It is split into
three sections. The file at present is in text format (i.e. you can load it into a text editor and see what
values are present). It is possible that it may be converted to binary at a later date.
Section 1
This section is used to give relative scale to the city. It is specified as X,Y. At present it has not been
decided how these values are going to be used, so just use two arbitrary values for now.
I expect that the value will give some sort of mapping of real world meters to world co-ordinate
distance, i.e. how many world co-ordinate squares/real world meters.
Section 2
This section describes the zones within the city. This section begins with the line:
Zones
Each line is then in the form:
<zone type>,ref#,<list of points>
The zone type can be any of the following:
1
2
3
4
Residential
Commercial
Industrial
Other
Then we give it a unique reference number. The last is a comma-separated list of pairs of values,
describing the points that mark the boundary of the zone. The zone is a essentially a polygon, in world
co-ordinates.
Section 3
Each object in the city, is an AC3D model. This section describes each of the objects and areas that
exist in the city. The use of a description and separate placing means that the city file size can be
reduced.
Each line of this section represents a new object and has the general form:
<object type>,ref#,<filename>,length,width,height,direction
The first value is the object type, it can be any of the following.
1
2
3
4
5
6
7
Buildings
Road
Trees
Rivers
Furniture
Land
Composite
The second value is the object reference; it is used later in the file to refer to the object.
Following this is the path and filename of the object file used as this object. Then we describe the
length, width and height of the object. The last value is the direction the object is facing, a value of 0360 degrees.
The reference number is a unique id given to each object described. There is no reason for the
items to appear in section 2 in order of their ids, but they must not share an id.
An example line might be:
building,3,./objects/lamppost.ac,1,1,4,90
As everything is a model we have no need to describe anything more about the model than what it is
and where it can be found. For instance the previous file version would give the building a type. This
is not needed as any number of buildings can be used by specifying which model to use.
Section 3
This section takes each of the objects described in section 2, and places them in the city. The coordinate positions given are in Maverik ‘World Co-ordinates’. Some scaling will be used to decide if
they map directly, or are scaled first.
This section is separated from the others by the word:
Positions
What follows are triplets of values:
2,4,5,0
1,3,7,0
The first value is the id of the object described in section 2. So now we know what object it is, and
what size it is (amongst other things). The next two values are the X and Z positions within the city.
The last value is the Y value, which is the height above the ground the object is.
This allows you to refer to and place a standard object many times on the grid, thus saving space (i.e. if
we had described its position in section 2).
The Future
Scaling hasn’t yet been dealt with, as it’s not clear if it will be needed, or how it will be used. Expect
to see this dealt with in the future.
Also what hasn’t been discussed yet is the Composite object. This will be defined later when we can
handle the other stuff. The composite object is a way of creating a ‘macro’ to speed up city creation,
and shorten the description. In it we will list all the objects that exist in an area, and their local
positions within the area (i.e. not relative to the city 0,0). You will then in section 3 be able to place
these composites. So for instance you could describe a park, with trees, ponds etc. And then define
this as a composite and use one line to place copies of the park around the city.
As you’ve seen previously, this format tries to reduce the size of the description, initially by allowing
you place copies of the same object, so that you don’t have to define them over and over again. The
Composite object type is another move in this direction.
For examples see some of the cities being used with City Editor and City Generator Prototypes.
Download