aliens

Author Topic: outdated terrain generation proposal  (Read 15277 times)

Offline davide

  • Commander
  • *****
  • Posts: 565
    • View Profile
On this topic I needs HELP
« Reply #15 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);
}
}
}
}
« Last Edit: November 05, 2014, 07:18:27 pm by davide »

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: [PLEASE do not reply to this post because I need some time to complete it]
« Reply #16 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.

Offline davide

  • Commander
  • *****
  • Posts: 565
    • View Profile
Re: [PLEASE do not reply to this post because I need some time to complete it]
« Reply #17 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


Offline davide

  • Commander
  • *****
  • Posts: 565
    • View Profile
Siberia
« Reply #18 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
« Last Edit: November 15, 2014, 10:45:57 pm by davide »

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: [PLEASE do not reply to this post because I need some time to complete it]
« Reply #19 on: November 20, 2014, 12:24:41 am »
this is what i was hinting at. :)

Offline davide

  • Commander
  • *****
  • Posts: 565
    • View Profile
Re: [PLEASE do not reply to this post because I need some time to complete it]
« Reply #20 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 :-[


Offline davide

  • Commander
  • *****
  • Posts: 565
    • View Profile
A little request
« Reply #21 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

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: A little request
« Reply #22 on: November 21, 2014, 03:54:15 am »
Could you add optional custom size to mapScripts entity to override alien deployment size ?

done,

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]