Page 1 of 1

Building - Center calculation

PostPosted: 16 Feb 2013, 12:59
by Flipflop
Hey Guys.

I just want so show here the concepts of the calculation for one Building that detects wheter it is an Center(then the game loads the Building like Hatchery) or just normal Part of an Building, so just Ground.
Its not 100% finished yet, thats why you dont find it right now in the SVN.

First how the Center-Building is loaded, as an example the Training-Pole:

{l Code}: {l Select All Code}
<env:object3d width="0.3" height="0.3" depth="0.3" x="0" y="0" z="0"
   materialpath="models/buildings/training/trainingpole.j3m" rotation="rota" >

   ((ACenterBuildingInfo)$object.getProperty("tileInfo")).getCenterType() == CenterType.CENTER


You can see the Drawcondition is asking wheter this concrete Tile is CenterType.CENTER.

So but how we calculate that CenterType?

Here are the three CenterPattern:

Cases.JPG (29.26 KiB) Viewed 15580 times

And as an Example for Pattern1 the Algorithm with visualization:


Hope you understand everything ^^

- Flipflop

Re: Building - Center calculation

PostPosted: 17 Feb 2013, 12:50
by Kardananaal
I would suggest two stages:

1. Calculate all may-center tiles, i.e. all tiles of the same room, with all 8 neighbours being tiles of the same room.

2. Mark may-center tiles, such that no two center tiles are neighbours. This can be trivially done by walking through the may-center tiles and removing all 8 neigbours from the may-center tiles list, as a may-center tile is marked as center.

It is however important, that the center tiles do NOT affect the game mechanics. Otherwise players had to build such that they have as many center tiles as possible which is a bit akward. If I recall correctly, most of the rooms would not follow this strategy anyway. It is just placing of houses in the hatchery and tables in the casino, am I right?