Jump to content
Sign in to follow this  
Nyerguds

C&C building grids study

Recommended Posts

One of the things that has always bothered me in C&C and RA1 is the fact there are no decent-sized civilian buildings to build a big city...

 

I've known for ages that the first two unknown Long entries of the structures had something to do with the placement grid of structures (and the third one seemed to be connected to buildings producing land units), but I never found out how it worked.

 

post-7-1184016872.png

 

 

Well, 2 days ago, I looked at it again, experimented a bit by switching them around and stuff like that. It seemed to work, but there didn't seem to be any logic in them, like in the Dune 2000 grid. The only logic I could find was that odd numbers crashed the game, and every time I added 2 to an existing grid, one more cell of it went away, starting from the first cell down to the last, until an empty unplacable grid remained.

 

So finally I said "screw it, I'll test the values one by one." And it seemed to be the only good way, too. The grids in C&C1 are a freaking LIST :shock:

 

 

Anyway, on to the good stuff. I'll post more when I map & document it:

 

 

 

Grid classes

 

Building grids in C&C are used for three things: a placement grid, a refresh grid and an exit grid.

 

In the game data, you will first find the refresh grid, then the placement grid and then the exit grid.

 

 

1. Placement grid

The placement grid determines which cells form the impassable building foundation. Only the cells on this grid are refreshed by the game.

 

Note that the bib can give a very wrong image of this grid. For example, the placement grid of the refinery is this:

 

 X 

XXX

BBB

BBB

 

X are placement grid cells (only 4!)

B are bib cells

 

Note that all of the bib area is passable for the refinery.

 

 

2. Refresh grid

This gives the game an additional grid of cells that aren't included in the building grid, but which also need to refreshed. The easiest example of this is the top part of the GDI Weapons factory. These cells are passable but still have building graphics drawn on them.

 

For the refinery in the grid above, the refresh grid is:

 

RXR

XXX

RRR

 

X are placement grid cells

R are the additional refreshing cells

 

This is because the graphics of the building go on in the upper corners, and go down an entire row below the grid (over the bib).

 

 

3. Exit grid

This grid apparently tells a building that produces ground units where the units can go to after exiting the building. These grids have the odd property that they usually start on negative offsets. For example, when placing down a GDI barracks, your mouse cursor will hold the upper left corner of the grid. However, if you would use the Barracks exit grid as placement grid and wanted to place it down, you would see this:

 

XXXX

Xm X

X  X

XXXX

 

m: mouse cursor position (no grid)

X: grid tiles

 

The mouse cursor seems to hold cell (1,1) instead of (0,0). However, in reality the grid simply starts on (-1,-1) so it can fit around the building.

 

 

 

That's it for now... I'm still mapping, documenting and testing the values for now.

 

Things I got so far:

 

-The grid value is stored in 2 bytes. The remaining 2 bytes of the typical C&C 4-byte value are 00 00 in DOS C&C, but 80 00 in C&C95. Since the 00 80 value never seems to change I'm ignoring these 2 bytes though. All DOS and C&C95 values seem to match perfectly (with a contant relative difference between the DOS and C&C95 values).

 

-When using odd values, the game crashes when you click the icon to place the building. Only multiples of 2 can be used as values, which means internally that the last bit of the value should always be left 0.

 

-The value itself is only valid between 11140 and 11700. All others crash the game when you click the icon to place the building.

(Koen, note that the beta we worked on shows the full 4-byte value, which is 0x500000 or dec 5242880 higher)

 

-As I said at the start, these values act a bit like 'grid IDs', each number corresponing to a grid seemingly without much logic to it. I will post the list of mapped grids as soon as possible.

Share this post


Link to post

Values

 

 

Now, here's the real stuff. Here you will find the values I have tested ingame.

 

Unfortunately, the grids don't seem to be generated from this value. Instead, the game seems to contain a large list of internal grids, which are accessed by these numbers. This also means it is not possible to make 100% customized grids.

 

However, there are a few rules that can help with grid customization.

 

 

Each value between 11140 and 11700 represents a certain grid configuration. Values outside this range crashes the game. I haven't tested if there's a certain bitrate pattern that can explain this.

However, the last bit should always be 0. Uneven values crash the game from the moment you click on an icon to place dow a building.

 

 

I divided the grids into five value ranges:

 

 

1. problematic line (11142-11152)

These five grids all appear as a normal straight line of 6x1, but when you try placing them down they act as if they need more open cells around them. I wouldn't advice using them, since the section #2 values offer a perfectly working alternative.

All of these values seem to act in exactly the same way though.

 

 

2. Straight line (11154-11238)

This section contains a normal, perfectly placable 6x1 grid. When you increase the value with steps of 2, cells randomly disappear from the grid until a normal 1x1 remains:

11154-11186 - 6x1 XXXXXX

11188-11220 - 6x1 X_XXXX

11222-11224 - 6x1 X_X_XX

11226-11228 - 6x1 X_X__X

11230-11236 - 6x1 X____X

11238 - 1x1 X_____

 

 

3. Strange exit grid (11244-11316)

This is a weirdly-shaped grid, with theoretic dimensions of

(-1..6)x(-1..3)

or 7x4

 

This is what it looks like:

 

   -1012345



-1  XXXX

0  XMXXXXX   (with M the [filled] mouse cursor position 0,0)

1  X  X

2  XXXX

 

Like with the straight line, cells will randomly disappear by increasing the value of the grid number. However, all cells seem to disappear from row 0.

 

These are the values at which cells disappear:

 

value - cell - state of row #0

 

11274 (4,0) XXXXX_X

11286 (1,0) XX_XX_X

11306 (3,0) XX_X__X

11314 (0,0) X__X__X

11316 (5,0) X__X___

 

On value 11316 the strange grid has seamlessly faded into an existing exit grid, namely that of the GDI Barracks.

 

 

4. Exit grids (11316-11422)

As explained in the first section, these grids start with negative offsets, to fit around structures.

 

11244-11390 are grids that surround a building, and thus their first cell starts at postions (-1,-1) relative to the cell placed down with the mouse cursor.

 

Again, like with the straight line, cells will randomly disappear by building on the value of the grid number, until an unplacable 0x0 grid remains.

 

value - dim+description

11316 - 4x4 ring around 2x2 building (PYLE)

11344 - 4x4 ring around 2x2 building shifted down 1 cell (HAND)

11370 - 2x5 U-shape around bottom of 3x2 building shifted down 1 cell (WEAP)

11390 - 6x4 ring around 4x2 building (AFLD)

 

 

5. placement and refresh grids (11424-11698)

After 11424, the following rule applies:

adding 2 to a grid value takes away the first cell of the grid.

Keep adding 2 to break down the grid one cell at the time, until the grid is completely empty.

After an empty grid, the next full grid configuration will appear.

 

 

Normally, these grids start on position 0x0. The only exception to this is 11424, the SAM site refresh grid, which refreshes the 2 cells above the building. This is probably because of the turret that pops out.

 

Since the normal grids never exceed 4x3, I have 'drawn' the grids on one line with '_' and 'X', as simply a visual representation of the grid.

For example, the repair bay's _X__ XXX_ _X__ becomes

 

 _X__     X

XXX_ or XXX

_X__     X

 

11424 - XX__ ____ ____ - 2x1 shifted 1 cell to the top (refresh above SAM)

11430 - XXX_ XXX_ ____ - 3x2 (FACT)

11444 - ____ XX__ ____ - 2x1 2nd row (refresh PYLE)

11450 - XX__ ____ ____ - 2x1 (SILO/PYLE)

11456 - _X__ XXX_ _X__ - 3x3 '+' shape (FIX)

11468 - XX__ ____ ____ - 2x1 (SILO)

11474 - XX__ XX__ ____ - 2x2 (HPAD/HOSP/BIO)

11484 - XXXX XXXX ____ - 4x2 (AFLD)

11502 - _XXX _XXX ____ - 3x2 shifted 1 cell to the right (V37)

11516 - X___ X___ ____ - 1x2 (refresh of V37)

11522 - X___ XX__ ____ - 2x2 |_ (HQ)

11530 - XX__ ____ ____ - 2x1 (SILO/SAM)

11536 - ____ XXX_ XXX_ - 3x2 shifted 1 cell down (WEAP)

11550 - ____ X___ ____ - 1x1 shifted 1 cell down (OBLI)

11554 - ____ XX__ _X__ - 2x2 '| shifted 1 cell down (HAND)

11562 - ____ XXX_ XXX_ - 3x2 shifted 1 cell down (TMPL)

11576 - ____ XX__ ____ - 2x1 shifted 1 cell to the right (WEAP)

11582 - XX__ _X__ ____ - 2x2 '|

11590 - XX__ ____ ____ - 2x1

11596 - X___ ____ ____ - 1x1 (GUN)

11600 - XX__ ____ ____ - 2x1

11606 - ____ X___ ____ - 1x1 shifted 1 cell down (OBLI)

11610 - X___ ____ ____ - 1x1 (GTWR)

11614 - _X__ ____ ____ - 1x1 shifted 1 cell to the right (refresh NUKE/HQ)

11618 - _X__ XX__ ____ - 2x2 _|

11626 - X___ XX__ ____ - 2x2 |_ (NUKE)

11634 - _X__ XXX_ ____ - 3X2 _|_ (PROC)

11644 - X_X_ ____ XXX_ - 3x3 (refresh PROC)

11656 - X_X_ ____ X_X_ - 3x3 (refresh FIX)

11666 - XXX_ ____ ____ - 3x1 (refresh WEAP)

11674 - _X__ ____ ____ - 1x1 shifted 1 cell to the right (refresh HQ)

11678 - X___ ____ ____ - 1x1 (GTWR)

11682 - XX__ X___ X___ - 2x3 '| (refresh HAND)

11692 - XXX_ ____ ____ - 3x1 (refresh TMPL)

11700 - CRASH

Share this post


Link to post

The final document is now included in the new version (2.6) of C&C95 UGE over at CnCWorld.

 

(ignore the wrong version number on the download page - CnCWorld is switching to a new downloads system)

Share this post


Link to post

I just found out these values are nothing but pointers to the locations in C&C95 where the real grids are.

The actual address is calculated as [pointer] - 410000h + 400h

 

The foundation values are simply cells that work like map coordinates... for example, the repair bay's grid is (in hex):

 

01 00 40 00 41 00 42 00 81 00

(there's some value like "FE FF" or something to close the structure. Don't know exactly, and I'm writing this in school)

 

40h is 64, which is the width of the map in C&C95. Like on missions, the map wraparound makes the Value+64 appear on the next row on the map.

 

All values are 2 bytes long, so the actual cells here are 01h, 40h, 41h, 42h, 81h

which, as cells, is this:

 

__ 01 __

40 41 42

__ 81 __

 

It seems the possibilities of Tiberian Dawn are becoming quite limitless :)

Share this post


Link to post
Guest Rabbit

Unfortunately, I don't have admin powers anymore, but, I think this should be moved to the other editing guide section. :)

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×