Building - Center calculation

Building - Center calculation

Postby Flipflop » 16 Feb 2013, 12:59

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"
   modelpath="models/buildings/training/trainingpole.j3o"
   materialpath="models/buildings/training/trainingpole.j3m" rotation="rota" >

  <env:drawcondition>
   ((ACenterBuildingInfo)$object.getProperty("tileInfo")).getCenterType() == CenterType.CENTER
  </env:drawcondition>

</env:object3d>   


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
Patterns
Cases.JPG (29.26 KiB) Viewed 14711 times



And as an Example for Pattern1 the Algorithm with visualization:

algo.JPG
Algo


Hope you understand everything ^^

- Flipflop
User avatar
Flipflop
 
Posts: 181
Joined: 19 Dec 2012, 13:31
Location: Hamburg, Germany

Re: Building - Center calculation

Postby Kardananaal » 17 Feb 2013, 12:50

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?
Kardananaal
 
Posts: 3
Joined: 17 Feb 2013, 12:44

Who is online

Users browsing this forum: No registered users and 1 guest