OpenXcom Forum

Contributions => Programming => Topic started by: davide on September 11, 2014, 10:55:35 am

Title: outdated terrain generation proposal
Post by: davide on September 11, 2014, 10:55:35 am

Hi,

I would like to offer my contribute to  extend the engine algorithm to support generation terrain map for OpenTFTD
and expose the new features by ruleset to allows modders to use it.

I wish that my contribute will be merged into main source code branch therefore
all thing that I will make will be undergo to developer Boss review


The TFTD vanilla needs that I recognize:


I  can follow any additional requirements/needs too.

I suppose that skilled modders will be interested to use these new features with current OpenXCom too.

As example for recover UFO2000 terrains named Siberia, Sand Storm and Normandy.





Title: A case study with Ufo2000 terrain Normandy
Post by: davide on September 11, 2014, 11:01:37 am
It has a lot of requirements such as TFTD terrain.


An image could be more clear that my little english
(http://)

The  ruleset fragment:
Code: [Select]
terrains:
  - name: NORMANDY
    mapDataSets:
      - BLANKS
      - BON1
      - BON2
      - BON3
    largeBlockLimit: 20
    width: [60. 40, 80]
    length: [60, 60, 60]
    craftPositions:
      - [0, 40, 60, 20]
    mapBlocks:
     - name: BON_1
       width: 10
       length: 20
       type: 1
       subType: 0
     - name: BON_3
       width: 10
       length: 10
       type: 1
       subType: 0
     - name: BON_4
       width: 10
       length: 10
       type: 1
       subType: 0
       onY: [40]
     - name: bon_5
       width: 20
       length: 10
       type: 1
       subType: 0
     - name: bon_2
       width: 10
       length: 10
       onY: [50]
     - name: bon_51
       width: 20
       length: 10
       onY: [50]
     - name: bon_52
       width: 20
       length: 10
       onY: [50]
     - name: bon_53
       width: 20
       length: 10
       onY: [50]
     - name: bon_54
       width: 20
       length: 10
       onY: [50]
     - name: bon_61
       width: 10
       length: 10
       onY: [40]
     - name: bon_62
       width: 10
       length: 10
       onY: [40]
     - name: bon_63
       width: 10
       length: 10
       onY: [40]
     - name: bon_64
       width: 10
       length: 10
       onY: [40]
     - name: bon_65
       width: 10
       length: 10
       onY: [40]
     - name: bon_66
       width: 10
       length: 10
       onY: [40]
     - name: bon_71
       width: 20
       length: 10
       maxCount: 1
       onlyEvenX: true
       onY: [30]
     - name: bon_72
       width: 20
       length: 10
       maxCount: 1
       onlyEvenX: true
       onY: [30]
     - name: bon_73
       width: 20
       length: 10
       maxCount: 1
       onlyEvenX: true
       onY: [30]
     - name: bon_74
       width: 20
       length: 10
       maxCount: 1
       onlyEvenX: true
       onY: [30]
     - name: bon_81
       width: 20
       length: 20
       maxCount: 1
       onlyEvenX: true
       onY: [10]
     - name: bon_82
       width: 20
       length: 20
       maxCount: 1
       onlyEvenX: true
       onY: [10]
     - name: bon_83
       width: 20
       length: 20
       maxCount: 1
       onlyEvenX: true
       onY: [10]
     - name: bon_84
       width: 20
       length: 20
       maxCount: 1
       onlyEvenX: true
       onY: [10]
     - name: bon_91
       width: 20
       length: 10
       maxCount: 1
       onlyEvenX: true
       onY: [0]
     - name: bon_92
       width: 20
       length: 10
       maxCount: 1
       onlyEvenX: true
       onY: [0]
     - name: bon_93
       width: 20
       length: 10
       maxCount: 1
       onlyEvenX: true
       onY: [0]
     - name: bon_94
       width: 20
       length: 10
       maxCount: 1
       onlyEvenX: true
       onY: [0]
Title: Re: [PLEASE do not reply to this post because I need some time to complete it]
Post by: davide on September 11, 2014, 11:23:30 am
I am sorry :-[

I come back later to enum the

-New terrain attribute
-New maps attribute
-some general note about the algorithm
Title: MapBlock entity
Post by: davide on September 11, 2014, 12:54:26 pm
MapBlock entity has new optional attributes exposed to ruleset:


One value is randomly selected from onX and one from onY vectors when the vector size is greater than one
Title: RuleTerrain entity
Post by: davide on September 11, 2014, 01:20:12 pm
The original attribute largeBlockLimit in the previous algorithm was the max number of maps of size 20x20
in mine proposal it drive maps of size 20x10 and 10x20 too.
"Vanilla" terrains are not affected because the rectangular maps were not supported.

I add new optional attributes


One value is randomly selected from width and from lenght vectors when the vector size is greater than zero.
When both vectors are defined, only one index will be randomize (in range 0 to minSize) and used to select a couple of w and l

In the first prototipe,craftX and craftY are single value: them could will be vectors.
I adopted same rule to select craftX and craftY.

The syntax of vector attributes craftX and craftY were refactored/merged to the new matrix attribute craftPositions

I adopted the optional attribute ufoPositions too

and added the new roadPositions and for a second set of road, roadPositions2

Title: Re: [PLEASE do not reply to this post because I need some time to complete it]
Post by: davide on September 11, 2014, 04:30:45 pm
Please do not add other comment for the moment because I am preparing a proposal for Warboy

The problem is very difficult and I have to explain him what I already made

I seek a compromise between the features needed by TFTD and new opportunity of modding.
I seek to remain near to the structure of the original algorithm to render more simple a review to a Boss and minimize the risk to introduce regressions
I seek to cover already existing terrain types before plan to add new features that was not request by map makers

If Warboy will be interested about my work is it possible that the discussion will be open to all

Do you write c++ code runnable that implement the map generation algorithm with your ruleset
or you only project the syntax of the new ruleset ?
Title: A case study with Ufo2000/TFTD terrain Plane Crash site
Post by: davide on September 12, 2014, 07:36:36 pm
I lose a wing ... for now  ;)(I fixed the ruleset)

Probably the map composition is not vanilla ... :-[

Lightinight craft map dimension block a lot of positions

The  ruleset fragment:

Code: [Select]
  - name: PLANECRASH
    mapDataSets:
      - BLANKS
      - PC_SANDS
      - PC_BIRD
      - PC_DUMMY
    largeBlockLimit: 2
    width: [60]
    length: [60]
    craftX: [0,10,40,50,40]
    craftY: [0,0,0,0,40]
    mapBlocks:
     - name: PLANE00
       width: 10
       length: 10
       type: 1
       subType: 0
     - name: PLANE01
       width: 10
       length: 10
     - name: PLANE02
       width: 10
       length: 10
     - name: PLANE03
       width: 10
       length: 10
     - name: PC_PLANE04
       width: 10
       length: 10
       maxCount: 1
       onX: [50]
       onY: [30]
     - name: PC_PLANE05
       width: 10
       length: 10
       maxCount: 1
       onX: [50]
       onY: [30]
     - name: PC_PLANE06
       width: 10
       length: 10
       maxCount: 1
       onX: [30]
       onY: [30]
     - name: PC_PLANE07
       width: 10
       length: 10
       maxCount: 1
       onX: [10]
       onY: [30]
     - name: PC_PLANE08
       width: 10
       length: 10
       maxCount: 1
       onX: [40]
       onY: [30]
     - name: PC_PLANE09
       width: 10
       length: 10
       maxCount: 1
       onX: [40]
       onY: [30]
     - name: PC_PLANE10
       width: 10
       length: 10
       maxCount: 1
       onX: [20]
       onY: [30]
     - name: PC_PLANE11
       width: 10
       length: 10
       maxCount: 1
       onX: [20]
       onY: [30]
     - name: PLANE12
       width: 10
       length: 10
       maxCount: 1
       onX: [0]
       onY: [30]
     - name: PLANE13
       width: 20
       length: 20
       maxCount: 1
       onX: [20]
       onY: [10]
     - name: PLANE14
       width: 20
       length: 20
       maxCount: 1
       onX: [20]
       onY: [10]
     - name: PLANE15
       width: 20
       length: 20
       maxCount: 1
       onX: [20]
       onY: [40]
     - name: PLANE16
       width: 20
       length: 20
       maxCount: 1
       onX: [20]
       onY: [40]
     - name: PLANE17
       width: 10
       length: 10
       maxCount: 1
       onX: [10]
       onY: [20]
     - name: PLANE18
       width: 10
       length: 10
       maxCount: 1
       onX: [10]
       onY: [20]
     - name: PLANE19
       width: 10
       length: 10
       maxCount: 1
       onX: [10]
       onY: [40]
     - name: PLANE20
       width: 10
       length: 10
       maxCount: 1
       onX: [10]
       onY: [40]
Title: Cargo Ship
Post by: davide on September 13, 2014, 01:04:06 pm
Some troble with routes

There is a unique map and  try to use it as landing maps

The  pilot of my cfraft needs some lessons of driving school ...
He throw down the bulwark of ship



I have to load its route file but I found a bug into TileEngine::voxelCheck:
I add a check for valid index:

   https:// first we check terrain voxel data, not to allow 2x2 units stick through walls
   for (int i=0; i< 4; ++i)
   {
      MapData *mp = tile->getMapData(i);
      if (tile->isUfoDoorOpen(i))
         continue;
      if (mp != 0)
      {
         int x = 15 - voxel.x%16;
         int y = voxel.y%16;
         int idx = (mp->getLoftID((voxel.z%24)/2)*16) + y;
         if (idx < _voxelData->size() && (_voxelData->at(idx) & (1 << x)))
         {
            return i;
         }
      }
   }


 but there are some old post in the forum about route problem ...

Code: [Select]
terrains:
  - name: CARGOSHIP1
    mapDataSets:
      - BLANKS
      - SEA
      - CARGO1
      - CARGO2
      - XBITS
      - CARGO3
    width: [30]
    length: [70]
    craftY: [0]
    craftX: [0]
    mapBlocks:
     - name: CARGO00
       width: 30
       length: 70
       type: 1
       subType: 0
Title: Cruise Ship
Post by: davide on September 14, 2014, 10:40:51 am
big parking problem !

I can move to an other starting block
but remains unit offset depends on specific craft
 (fortunately TFTD crafts are well alligned to craft map rear but those of UFO are not ....)
Avenger for example, look its map ...I have to crop some tiles to minimize collisions to ship structure
I have to reserve 2 tile in the rear to allows robots to move
I think that I can try to do it by code ...
after that I think that there is already same code that remove some tiles overlapped to craft ...

Code: [Select]
  - name: CRUISESHIP1
    mapDataSets:
      - BLANKS
      - DECKC
      - LINERA
      - LINERB
      - LINERC
      - LINERD
    width: [30]
    length: [70]
    craftPositions:
      - [0, 0, 10, 20]
    mapBlocks:
     - name: LINERT01
       width: 30
       length: 50
       type: 1
       subType: 0
       craftOffsetX: 10
     - name: LINERT00
       width: 30
       length: 20
       onX: [0]
       onY: [50]
Title: Cargo Ship well parked
Post by: davide on October 14, 2014, 04:23:14 pm
Code: [Select]
  - name: CARGOSHIP1
    mapDataSets:
      - BLANKS
      - SEA
      - CARGO1
      - CARGO2
      - XBITS
      - CARGO3
    width: [30]
    length: [70]
    craftPositions:
      - [0, 0, 10, 20]
    mapBlocks:
     - name: CARGO00
       width: 30
       length: 70
       type: 1
       subType: 0
       craftOffsetX: 5
       craftOffsetY: 1
Title: Island
Post by: davide on October 14, 2014, 04:24:43 pm
Code: [Select]
  - name: ISLAND
    mapDataSets:
      - BLANKS
      - SEA
      - ISLAND1
      - ISLAND2
      - ISLAND3
    width: [50]
    length: [50]
    largeBlockLimit: 3
    craftPositions:
      - [0, 0, 50, 20]
    mapBlocks:
     - name: ISLAND00
       width: 10
       length: 10
       type: 1
       subType: 0
     - name: ISLAND01
       width: 10
       length: 10
       type: 1
       subType: 0
     - name: ISLAND02
       width: 20
       length: 20
       maxcount: 1
     - name: ISLAND03
       width: 20
       length: 20
       maxcount: 1
     - name: ISLAND04
       width: 20
       length: 20
       onY: [30]
       maxcount: 1
     - name: ISLAND05
       width: 20
       length: 20
       onY: [30]
       maxcount: 1
     - name: ISLAND06
       width: 20
       length: 20
     - name: ISLAND07
       width: 10
       length: 10
       onY: [40]
       even: true
     - name: ISLAND08
       width: 10
       length: 10
     - name: ISLAND09
       width: 10
       length: 10
     - name: ISLAND10
       width: 10
       length: 10
     - name: ISLAND11
       width: 10
       length: 10
     - name: ISLAND12
       width: 10
       length: 10
     - name: ISLAND13
       width: 10
       length: 10
     - name: ISLAND14
       width: 10
       length: 10
Title: Port
Post by: davide on October 14, 2014, 04:25:24 pm
Code: [Select]
  - name: PORT
    mapDataSets:
      - BLANKS
      - SEA
      - PORT01
      - PORT02
    width: [50]
    length: [50]
    mapBlocks:
     - name: PORT00
       width: 10
       length: 10
       type: 1
       subType: 0
     - name: PORT01
       width: 10
       length: 10
       type: 1
       subType: 0
     - name: PORT02
       width: 10
       length: 10
       onX: [40]
     - name: PORT03
       width: 10
       length: 10
       onX: [40]
     - name: PORT04
       width: 10
       length: 10
       onX: [40]
     - name: PORT05
       width: 10
       length: 10
       onX: [40]
     - name: PORT06
       width: 10
       length: 10
       onX: [40]
     - name: PORT07
       width: 10
       length: 10
       onX: [40]
     - name: PORT08
       width: 10
       length: 10
       onX: [40]
     - name: PORT09
       width: 10
       length: 10
       onX: [40]
     - name: PORT10
       width: 10
       length: 10
     - name: PORT11
       width: 10
       length: 10
     - name: PORT12
       width: 10
       length: 10
     - name: PORT13
       width: 10
       length: 10
     - name: PORT14
       width: 10
       length: 10
     - name: PORT15
       width: 10
       length: 10
     - name: PORT16
       width: 10
       length: 10
     - name: PORT17
       width: 20
       length: 20
     - name: PORT18
       width: 20
       length: 20
     - name: PORT19
       width: 20
       length: 20
     - name: PORT20
       width: 20
       length: 20
       onX: [0,10,20]
       onY: [0]
Title: Landing on Alien Base
Post by: davide on October 14, 2014, 04:26:40 pm
Code: [Select]
  - name: ALIENBASE1
    mapDataSets:
      - BLANKS
      - SAND
      - UEXT2
      - UEXT3
      - ORGANIC1
      - ENTRY
    width: [60]
    length: [60]
    largeBlockLimit: 9
    craftPositions:
      - [0, 0, 10, 20]
      - [0, 40, 10, 20]
      - [40, 0, 10, 20]
      - [40, 40, 10, 20]
    mapBlocks:
     - name: ENTRY00
       width: 20
       length: 20
       type: 1
       subType: 0
       craftOffsetX: 10
       onY: [0]
       onX: [0]
     - name: ENTRY01
       width: 20
       length: 20
       onY: [0]
       onX: [20]
     - name: ENTRY02
       width: 20
       length: 20
       type: 1
       subType: 0
       onY: [0]
       onX: [40]
     - name: ENTRY03
       width: 20
       length: 20
       onY: [20]
       onX: [0]
     - name: ENTRY04
       width: 20
       length: 20
       onY: [20]
       onX: [20]
     - name: ENTRY05
       width: 20
       length: 20
       onY: [20]
       onX: [40]
     - name: ENTRY06
       width: 20
       length: 20
       type: 1
       subType: 0
       craftOffsetX: 10
       onY: [40]
       onX: [0]
     - name: ENTRY07
       width: 20
       length: 20
       onY: [40]
       onX: [20]
     - name: ENTRY08
       width: 20
       length: 20
       onY: [40]
       onX: [40]
       type: 1
       subType: 0
Title: Alien Base step2
Post by: davide on November 05, 2014, 01:39:42 am
 :o
How to connect the maps ?
 :-\
Title: Re: [PLEASE do not reply to this post because I need some time to complete it]
Post by: Falko on November 05, 2014, 06:03:15 am
remove the dirt portion in the map where the normally "door creation-magic" happens ?
Title: On this topic I needs HELP
Post by: davide on November 05, 2014, 06:00:05 pm
Do you mean that I should made as same as Ufo Alien Base ...  ???

I wish describe these "magic actions" in the ruleset ...

with a new attribute with internal code name "Open Sesame" .. ::).

I think that a dual attribute for close corridors on terrain border sides could be usefull
(I think to Sand Mountain and Siberia terrain)

The base terrain generation required some mandatory maps, I can describe it but
the pain point is the making passages between blocks in a base map, the source code is here:

At the begginnig there are four parameters well isolated:
      int ewallfix = 14; https://  north wall
      int swallfix = 13; https:// west wall
      int ewallfixSet = 1;
      int swallfixSet = 1;
They could be new ruleset attributes of specific terrain

What are they ?
Tile index ?

What are the correct number for TFTD terrain: Alien Base 2, Artifact level 2, TLeth 1 - 3)

but there are some magic index too, as example what is this:
_save->getTile(Position((i*10)+3,(j*10)+9,0))->setMapData(_terrain->getMapDataSets()->at(1)->getObjects()->at(63), 63, 1, MapData::O_FLOOR);


Code: [Select]
/* making passages between blocks in a base map */
if (_save->getMissionType() == "STR_BASE_DEFENSE" || _save->getMissionType() == "STR_ALIEN_BASE_ASSAULT" || _save->getMissionType() == "STR_MARS_THE_FINAL_ASSAULT")
{
int ewallfix = 14;
int swallfix = 13;
int ewallfixSet = 1;
int swallfixSet = 1;
if (_save->getMissionType() == "STR_ALIEN_BASE_ASSAULT" || _save->getMissionType() == "STR_MARS_THE_FINAL_ASSAULT")
{
ewallfix = 17; https://  north wall
swallfix = 18; https:// west wall
ewallfixSet = 2;
swallfixSet = 2;
}

MapDataSet *mds = _terrain->getMapDataSets()->at(ewallfixSet);
MapBlock *dirt = _terrain->getRandomMapBlock(10, MT_DIRT);
for (int i = 0; i < (_mapsize_x / 10); ++i)
{
for (int j = 0; j < (_mapsize_y / 10); ++j)
{
if (blocks[i][j] == dirt)
continue;

https:// general stores - there is where the items are put
if (storageBlocks[i][j])
{
for (int k = i * 10; k != (i + 1) * 10; ++k)
{
for (int l = j * 10; l != (j + 1) * 10; ++l)
{
https:// we only want every other tile, giving us a "checkerboard" pattern
if ((k+l) % 2 == 0)
{
Tile *t = _save->getTile(Position(k,l,1));
Tile *tEast = _save->getTile(Position(k+1,l,1));
Tile *tSouth = _save->getTile(Position(k,l+1,1));
if (t && t->getMapData(MapData::O_FLOOR) && !t->getMapData(MapData::O_OBJECT) &&
tEast && !tEast->getMapData(MapData::O_WESTWALL) &&
tSouth && !tSouth->getMapData(MapData::O_NORTHWALL))
{
_save->getStorageSpace().push_back(Position(k, l, 1));
}
}
}
}
https:// let's put the inventory tile on the lower floor, just to be safe.
_craftInventoryTile = _save->getTile(Position((i*10)+5,(j*10)+5,0));
}

https:// drill east
if (i < (_mapsize_x / 10)-1
&& blocks[i+1][j] != dirt
&& _save->getTile(Position((i*10)+9,(j*10)+4,0))->getMapData(MapData::O_OBJECT)
&& (!_save->getTile(Position((i*10)+8,(j*10)+4,0))->getMapData(MapData::O_OBJECT)
|| (_save->getTile(Position((i*10)+9,(j*10)+4,0))->getMapData(MapData::O_OBJECT)
!= _save->getTile(Position((i*10)+8,(j*10)+4,0))->getMapData(MapData::O_OBJECT))))
{
https:// remove stuff
_save->getTile(Position((i*10)+9,(j*10)+3,0))->setMapData(0, -1, -1, MapData::O_WESTWALL);
_save->getTile(Position((i*10)+9,(j*10)+3,0))->setMapData(0, -1, -1, MapData::O_OBJECT);
_save->getTile(Position((i*10)+9,(j*10)+4,0))->setMapData(0, -1, -1, MapData::O_WESTWALL);
_save->getTile(Position((i*10)+9,(j*10)+4,0))->setMapData(0, -1, -1, MapData::O_OBJECT);
_save->getTile(Position((i*10)+9,(j*10)+5,0))->setMapData(0, -1, -1, MapData::O_WESTWALL);
_save->getTile(Position((i*10)+9,(j*10)+5,0))->setMapData(0, -1, -1, MapData::O_OBJECT);
if (_save->getTile(Position((i*10)+9,(j*10)+2,0))->getMapData(MapData::O_OBJECT))
{
https://wallfix
_save->getTile(Position((i*10)+9,(j*10)+3,0))->setMapData(mds->getObjects()->at(ewallfix), ewallfix, ewallfixSet, MapData::O_NORTHWALL);
_save->getTile(Position((i*10)+9,(j*10)+6,0))->setMapData(mds->getObjects()->at(ewallfix), ewallfix, ewallfixSet, MapData::O_NORTHWALL);
}
if (_save->getMissionType() == "STR_ALIEN_BASE_ASSAULT" || _save->getMissionType() == "STR_MARS_THE_FINAL_ASSAULT")
{
https://wallcornerfix
if (!_save->getTile(Position((i*10)+10,(j*10)+3,0))->getMapData(MapData::O_NORTHWALL))
{
_save->getTile(Position(((i+1)*10),(j*10)+3,0))->setMapData(mds->getObjects()->at(swallfix+1), swallfix+1, swallfixSet, MapData::O_OBJECT);
}
https://floorfix
_save->getTile(Position((i*10)+9,(j*10)+3,0))->setMapData(_terrain->getMapDataSets()->at(1)->getObjects()->at(63), 63, 1, MapData::O_FLOOR);
_save->getTile(Position((i*10)+9,(j*10)+4,0))->setMapData(_terrain->getMapDataSets()->at(1)->getObjects()->at(63), 63, 1, MapData::O_FLOOR);
_save->getTile(Position((i*10)+9,(j*10)+5,0))->setMapData(_terrain->getMapDataSets()->at(1)->getObjects()->at(63), 63, 1, MapData::O_FLOOR);
}
https:// remove more stuff
_save->getTile(Position(((i+1)*10),(j*10)+3,0))->setMapData(0, -1, -1, MapData::O_WESTWALL);
_save->getTile(Position(((i+1)*10),(j*10)+4,0))->setMapData(0, -1, -1, MapData::O_WESTWALL);
_save->getTile(Position(((i+1)*10),(j*10)+5,0))->setMapData(0, -1, -1, MapData::O_WESTWALL);
}
https:// drill south
if (j < (_mapsize_y / 10)-1
&& blocks[i][j+1] != dirt
&& _save->getTile(Position((i*10)+4,(j*10)+9,0))->getMapData(MapData::O_OBJECT)
&& (!_save->getTile(Position((i*10)+4,(j*10)+8,0))->getMapData(MapData::O_OBJECT)
|| (_save->getTile(Position((i*10)+4,(j*10)+9,0))->getMapData(MapData::O_OBJECT)
!= _save->getTile(Position((i*10)+4,(j*10)+8,0))->getMapData(MapData::O_OBJECT))))
{
https:// remove stuff
_save->getTile(Position((i*10)+3,(j*10)+9,0))->setMapData(0, -1, -1, MapData::O_NORTHWALL);
_save->getTile(Position((i*10)+3,(j*10)+9,0))->setMapData(0, -1, -1, MapData::O_OBJECT);
_save->getTile(Position((i*10)+4,(j*10)+9,0))->setMapData(0, -1, -1, MapData::O_NORTHWALL);
_save->getTile(Position((i*10)+4,(j*10)+9,0))->setMapData(0, -1, -1, MapData::O_OBJECT);
_save->getTile(Position((i*10)+5,(j*10)+9,0))->setMapData(0, -1, -1, MapData::O_NORTHWALL);
_save->getTile(Position((i*10)+5,(j*10)+9,0))->setMapData(0, -1, -1, MapData::O_OBJECT);
if (_save->getTile(Position((i*10)+2,(j*10)+9,0))->getMapData(MapData::O_OBJECT))
{
https:// wallfix
_save->getTile(Position((i*10)+3,(j*10)+9,0))->setMapData(mds->getObjects()->at(swallfix), swallfix, swallfixSet, MapData::O_WESTWALL);
_save->getTile(Position((i*10)+6,(j*10)+9,0))->setMapData(mds->getObjects()->at(swallfix), swallfix, swallfixSet, MapData::O_WESTWALL);
}
if (_save->getMissionType() == "STR_ALIEN_BASE_ASSAULT" || _save->getMissionType() == "STR_MARS_THE_FINAL_ASSAULT")
{
https:// wallcornerfix
if (!_save->getTile(Position((i*10)+3,(j*10)+10,0))->getMapData(MapData::O_WESTWALL))
{
_save->getTile(Position((i*10)+3,((j+1)*10),0))->setMapData(mds->getObjects()->at(swallfix+1), swallfix+1, swallfixSet, MapData::O_OBJECT);
}
https:// floorfix
_save->getTile(Position((i*10)+3,(j*10)+9,0))->setMapData(_terrain->getMapDataSets()->at(1)->getObjects()->at(63), 63, 1, MapData::O_FLOOR);
_save->getTile(Position((i*10)+4,(j*10)+9,0))->setMapData(_terrain->getMapDataSets()->at(1)->getObjects()->at(63), 63, 1, MapData::O_FLOOR);
_save->getTile(Position((i*10)+5,(j*10)+9,0))->setMapData(_terrain->getMapDataSets()->at(1)->getObjects()->at(63), 63, 1, MapData::O_FLOOR);
}
https:// remove more stuff
_save->getTile(Position((i*10)+3,(j+1)*10,0))->setMapData(0, -1, -1, MapData::O_NORTHWALL);
_save->getTile(Position((i*10)+4,(j+1)*10,0))->setMapData(0, -1, -1, MapData::O_NORTHWALL);
_save->getTile(Position((i*10)+5,(j+1)*10,0))->setMapData(0, -1, -1, MapData::O_NORTHWALL);
}
}
}
}
Title: Re: [PLEASE do not reply to this post because I need some time to complete it]
Post by: Warboy1982 on November 06, 2014, 04:00:53 am
yeah, don't worry about this, i'm working on it. any questions or issues you have here will soon become redundant.
Title: Re: [PLEASE do not reply to this post because I need some time to complete it]
Post by: davide on November 06, 2014, 10:53:47 am
Do you want to see mine source code ?
 (the file involved are BattlescapeGeneration.cpp and MapBlock and RuleTerrain only)

For the map constraint position I have not use your syntax but I plan to adopt it and convert mine two map vector attributes onX[] and onY[] to one  map matrix mapPositions such as craftPositions

Title: Siberia
Post by: davide on November 15, 2014, 04:32:25 pm
Two set of roads, optional cross road between the two set

Code: [Select]
enum MapBlockType {
        MT_UNDEFINED = -1, MT_DEFAULT, MT_LANDINGZONE,
        MT_EWROAD, MT_NSROAD, MT_CROSSING,
        MT_DIRT, MT_XCOMSPAWN, MT_UBASECOMM, MT_FINALCOMM ,
MT_EWROAD2 = 32, MT_NSROAD2, MT_CROSSING2, MT_EWROAD2_CROSSING_NSROAD, MT_NSROAD2_CROSSING_EWROAD
};

Code: [Select]
- name: SIBERIA
    mapDataSets:
      - BLANKS
      - POLAR
      - XBASE1
      - BARN
    width: [60]
    length: [60]
    roadTypeOdds: [0, 0]
    roadTypeOdds2: [100, 0]
    roadPositions:
      - [10, 10, 40, 40]
    roadPositions2:
      - [10, 10, 40, 40]
    mapBlocks:
     - name: SIBERIA00
       width: 10
       length: 10
       type: 3
     - name: SIBERIA01
       width: 10
       length: 10
       type: 3
     - name: SIBERIA02
       width: 10
       length: 10
       type: 3
     - name: SIBERIA03
       width: 10
       length: 10
       type: 3
     - name: SIBERIA04
       width: 10
       length: 10
       type: 3
     - name: SIBERIA05
       width: 10
       length: 10
       type: 3
     - name: SIBERIA06
       width: 10
       length: 10
       type: 3
     - name: SIBERIA07
       width: 10
       length: 10
       type: 3
     - name: SIBERIA08
       width: 10
       length: 10
       type: 3
     - name: SIBERIA09
       width: 10
       length: 10
       type: 3
     - name: SIBERIA10
       width: 10
       length: 10
       type: 3
     - name: SIBERIA11
       width: 10
       length: 10
       type: 3
     - name: SIBERIA12
       width: 10
       length: 10
       type: 3
     - name: SIBERIA13
       width: 10
       length: 10
       type: 3
     - name: SIBERIA14
       width: 10
       length: 10
       type: 3
     - name: SIBERIA15
       width: 10
       length: 10
       type: 2
     - name: SIBERIA16
       width: 10
       length: 10
       type: 2
     - name: SIBERIA17
       width: 10
       length: 10
       type: 2
     - name: SIBERIA18
       width: 10
       length: 10
       type: 2
     - name: SIBERIA19
       width: 10
       length: 10
       type: 2
     - name: SIBERIA20
       width: 10
       length: 10
       type: 2
     - name: SIBERIA21
       width: 10
       length: 10
       type: 2
     - name: SIBERIA22
       width: 10
       length: 10
       type: 2
     - name: SIBERIA23
       width: 10
       length: 10
       type: 2
     - name: SIBERIA24
       width: 10
       length: 10
       type: 4
     - name: SIBERIA25
       width: 10
       length: 10
       type: 4
     - name: SIBERIA26
       width: 10
       length: 10
       type: 4
     - name: SIBERIA27
       width: 10
       length: 10
       type: 32
     - name: SIBERIA28
       width: 10
       length: 10
       type: 32
     - name: SIBERIA29
       width: 10
       length: 10
       type: 32
     - name: SIBERIA30
       width: 10
       length: 10
       type: 32
     - name: SIBERIA31
       width: 10
       length: 10
       type: 32
     - name: SIBERIA32
       width: 10
       length: 10
       type: 32
     - name: SIBERIA33
       width: 10
       length: 10
     - name: SIBERIA34
       width: 10
       length: 10
     - name: SIBERIA35
       width: 10
       length: 10
     - name: SIBERIA36
       width: 10
       length: 10
     - name: SIBERIA37
       width: 10
       length: 10
     - name: SIBERIA38
       width: 10
       length: 10
     - name: SIBERIA39
       width: 10
       length: 10
     - name: SIBERIA40
       width: 10
       length: 10
     - name: SIBERIA41
       width: 10
       length: 10
       type: 1
       subType: 0
     - name: SIBERIA42
       width: 10
       length: 10
     - name: SIBERIA43
       width: 10
       length: 10
       type: 1
       subType: 0
     - name: SIBERIA44
       width: 10
       length: 10
     - name: SIBERIA50
       width: 10
       length: 10
       type: 35
Title: Re: [PLEASE do not reply to this post because I need some time to complete it]
Post by: Warboy1982 on November 20, 2014, 12:24:41 am
this (https://github.com/SupSuper/OpenXcom/commit/6e8eef44e16e3bf613353a3ae7770cb64d3c65ba) is what i was hinting at. :)
Title: Re: [PLEASE do not reply to this post because I need some time to complete it]
Post by: davide on November 20, 2014, 12:24:16 pm
thank you very much for your post

I am reading your commit ... very very impressive ... :o

I will try to apply it to the Ufo2000 terrains

what do you think about this very little suggestion for BattlescapeGenerator::getTerrain ?

https://openxcom.org/forum/index.php?topic=2358.msg35313#msg35313 (https://openxcom.org/forum/index.php?topic=2358.msg35313#msg35313) :-[

Title: A little request
Post by: davide on November 20, 2014, 12:59:30 pm
Could you add optional custom size to mapScripts entity to override alien deployment size ?

simple int attributes: (width, length, height)

 ::)

Thanks
Title: Re: A little request
Post by: Warboy1982 on November 21, 2014, 03:54:15 am
Could you add optional custom size to mapScripts entity to override alien deployment size ?

done (https://github.com/SupSuper/OpenXcom/commit/1ba0c7fe83a3941c09822420965abeb7e4c33a00),

to resize the map to 40x40:
  - type: resize
    size: 4

or for 40x50:
  - type: resize
    size: [4, 5]

or to make it 7 tall without altering the x or y:
  - type: resize
    size: [0, 0, 7]