Adding a new location to the worldmap

Sep 9, 2010, 8:57 pm
#1
Joined: Sep 8, 2010
Occupation: Petty Functionary
Location: Drinking pea soup in the world map
Interests: Mangoes
Posts: 1,192
Warning, parts of this may be a bit spoily, if you can decipher it.
I think holybanana intended on setting out a coding tutorial on this topic, but I decided to have a crack at it and have figured out how this is done. I reverse engineered it from differences between IVAN and LIVAN.

I will show how to add a new location to the worldmap. In this example I will add the rocket launch pad named Baikonur, situated amongst leafy forest. The parts I added are in bold.

1) In define.dat and in ivandef.h add the line: # define COSMODROME 5
i.e. I inserted into the following lines:
...
#define RANDOM 0
#define ELPURI_CAVE 1
#define ATTNAM 2
#define NEW_ATTNAM 3
#define UNDER_WATER_TUNNEL 4
[b]#define COSMODROME 5[/b]
#define UNDER_WATER_TUNNEL_EXIT 0x80
...

2) In wterras.h add an owterrain (over-world terrain) called cosmodrome (as per the other entries). For this example:
...
[b]OWTERRAIN(cosmodrome, owterrain)
{
 public:
  virtual const char* GetNameStem() const;
  virtual v2 GetBitmapPos(int) const;
  virtual int GetAttachedDungeon() const;
};[/b]
...

3) In wterras.cpp add a const char* cosmodrome (to the best of my knowledge, this adds the new location to IVAN, links the location bitmap to its position in wterra.pcx and attaches the relevant dungeon). Add the following lines of code:
...
[b]const char* cosmodrome::GetNameStem() const { return "The ancient rocket launch-pad, Baikonur, looms up from the forests"; }
v2 cosmodrome::GetBitmapPos(int) const { return v2(16, 64); } [i]// I have used the same bitmap for new attnam in wterra.pcx, for simplicity[/i]
int cosmodrome::GetAttachedDungeon() const { return COSMODROME; }[/b]
...

4) To worldmap.cpp add the CosmodromePos codes, the SetEntryPos(COSMODROME, CosmodromePos) and the GetWSquare. This is slightly more elaborate, I want the cosmodrome to be situated in a leafy forest, so I had to fix that in as well.
Firstly inside the function: void worldmap::Generate(), I added another condition in this for loop, and in the statements that follow I added a couple of other lines:
...
for(uint c = 1; c < Continent.size(); ++c)
      if(Continent[c]->GetSize() > 25 && Continent[c]->GetSize() < 1000
	 && Continent[c]->GetGTerrainAmount(EGForestType)
	 && Continent[c]->GetGTerrainAmount(SnowType)
	 [b]&& Continent[c]->GetGTerrainAmount(LForestType)[/b])
	PerfectForAttnam.push_back(Continent[c]);

if(!PerfectForAttnam.size())
      continue;

    v2 AttnamPos, ElpuriCavePos, NewAttnamPos, TunnelEntry, TunnelExit[b], CosmodromePos[/b];
    truth Correct = false;
    continent* PetrusLikes;

    for(int c1 = 0; c1 < 25; ++c1)
    {
      game::BusyAnimation();
      PetrusLikes = PerfectForAttnam[RAND() % PerfectForAttnam.size()];
      AttnamPos = PetrusLikes->GetRandomMember(EGForestType);
      ElpuriCavePos = PetrusLikes->GetRandomMember(SnowType);
      [b]CosmodromePos = PetrusLikes->GetRandomMember(LForestType);[/b]
...

Further along, still in worldmap.cpp, there is an if-statement after which is added:
...
if(!Correct)
      continue;

    GetWSquare(AttnamPos)->ChangeOWTerrain(attnam::Spawn());
    SetEntryPos(ATTNAM, AttnamPos);
    RevealEnvironment(AttnamPos, 1);
    GetWSquare(NewAttnamPos)->ChangeOWTerrain(newattnam::Spawn());
    SetEntryPos(NEW_ATTNAM, NewAttnamPos);
    SetEntryPos(ELPURI_CAVE, ElpuriCavePos);
    GetWSquare(TunnelEntry)->ChangeOWTerrain(underwatertunnel::Spawn());
    SetEntryPos(UNDER_WATER_TUNNEL, TunnelEntry);
    GetWSquare(TunnelExit)->ChangeOWTerrain(underwatertunnelexit::Spawn());
    SetEntryPos(UNDER_WATER_TUNNEL_EXIT, TunnelExit);
    [b]GetWSquare(CosmodromePos)->ChangeOWTerrain(cosmodrome::Spawn());
    SetEntryPos(COSMODROME, CosmodromePos);[/b]
    [i]PLAYER->PutTo(NewAttnamPos);[/i]
    CalculateLuminances();
    CalculateNeighbourBitmapPoses();
    break;
...

SPOILER ALERT. Click here to see text.
In the above codeblock in italics note the line: PLAYER->PutTo(NewAttnamPos);
Could be useful to change this to your desired world map location for testing purposes.


5) Then hit the Compile button. IVAN will crash if you enter into the location and haven't added the dungeon in dungeon.dat

6) Finally add the dungeon to dungeon.dat, from this position it is only a matter of scripting the dungeon to your hearts content. DON'T forget to increment the number of dungeons and levels! Enjoy.
Nov 29, 2013, 6:05 pm
#2
Joined: Nov 22, 2013
Occupation: Unemployed bastard
Location: Chile
Interests: Gaming, Modding
Posts: 64
I've been interested in adding a new town and dungeons... This will definitely help. There are some files I don't recognize, though. Like ivandef.h and wterras.h so I'm guessing this can only be done in LIVAN, right?
Nov 29, 2013, 6:35 pm
#3
Joined: Dec 2, 2007
Location: New Attnam
Interests: bananas
Posts: 2,261
No, it means you need the source code, not just a binary. So after you make changes you would have to recompile the code too.
Nov 29, 2013, 6:39 pm
#4
Joined: Sep 8, 2010
Occupation: Petty Functionary
Location: Drinking pea soup in the world map
Interests: Mangoes
Posts: 1,192
First off, to create a new location you will need some means of compiling the source files.
You can use IVAN CVS or LIVAN as a starting point, or you can also use CLIVAN, but personally I think it too buggy.
The header files like ivandef.h and wterras.h etc are part of the source.

To avoid compiling, there is a precooked map location in LIVAN.
What you can do, is use a normal distribution of LIVAN, and simply use the dragon tower (which is an unfinished location) on that map and use the script files to develop a whole new dungeon to your heart's content. Wizard mode to find this location.
In this way, you can help contribute to IVAN development by creating an exciting new dungeon for people to play. The dungeon script files are fun and confusing. But mostly fun. IVAN will crash a couple of times before you get it right. See if you can work out what ``BoundedRandom'' does. If you understand how it works, then you know the right shit for making beautiful dungeons with high replayability. The original devs were so clever. Hardest thing is to balance the levels, but if you use a spreadsheet and some rough calculations you will be sweet.
Batman? wrote
its been so long since i had gotten that far i didnt think it through. arrrr!!!!!!
Nov 29, 2013, 7:38 pm
#5
Joined: Dec 11, 2008
Posts: 1,770
The dragon tower shows up outside of wizard mode too - but good luck finding the thing, damn. Reminds me of the times I've gotten lost trying to find Attnam and starved.
System would indicate in graphic if person is mounted on horse or not.
Same system also show if person mounted on boar, elephant, polar bear etc.
Or if person mounted on ass.
Ivan find mounting on ass funny.
Nov 29, 2013, 8:39 pm
#6
Joined: Nov 22, 2013
Occupation: Unemployed bastard
Location: Chile
Interests: Gaming, Modding
Posts: 64
I got LIVAN and went into Wizard Mode but I can't find it. I can only find the vanilla locations. Anyways, I wanted to add more than one location like a town and a dungeon but since I can only do this with scripting, I guess I can do both in one. Typical town with an infested cave or temple. If I can find the place, that is.

Another easier way to add a town would be like adding it as a simple dungeon lvl. An underground village or something like that. It's probably easier that way too.

I've trying the dungeon.dat to see how complicated it was and, after some crashes, I managed to add a new General Store in New Attnam. It works with no problems.


Nov 29, 2013, 9:44 pm
#7
Joined: Dec 11, 2008
Posts: 1,770
Chiko wrote
Typical town with an infested cave or temple. If I can find the place, that is.

Another easier way to add a town would be like adding it as a simple dungeon lvl. An underground village or something like that. It's probably easier that way too.
A la Dwarven Vault.

A good place to do this would be to have a dungeon below Attnam or New Attnam seeing as they're already established locations.
For example, New Attnam already has the sumo ring set up as a dungeon level as it is, so you could put some sort of horrible ancient catacombs of the Tweraifian ancestors down there or something, and have the entrance hidden in the sumo ring somewhere in the walls.
Of course to get there you'd have to sneak past (or kill) the sumo so as not to trigger challenging him to a match.
Play it off as the sumo being the guardian of the tomb or something?

Chiko wrote
I've trying the dungeon.dat to see how complicated it was and, after some crashes, I managed to add a new General Store in New Attnam. It works with no problems.
Well done!
System would indicate in graphic if person is mounted on horse or not.
Same system also show if person mounted on boar, elephant, polar bear etc.
Or if person mounted on ass.
Ivan find mounting on ass funny.
Nov 29, 2013, 11:26 pm
#8
Joined: Dec 2, 2007
Location: New Attnam
Interests: bananas
Posts: 2,261
4zb4 wrote
The dragon tower shows up outside of wizard mode too - but good luck finding the thing, damn. Reminds me of the times I've gotten lost trying to find Attnam and starved.

You know you can 'l'ook to find it right? I starved many times as well but then I read about that on here.
Nov 30, 2013, 4:32 pm
#9
Joined: Dec 11, 2008
Posts: 1,770
Does it? I could swear I've had it spawn in the most backward ass-end of the world then.
System would indicate in graphic if person is mounted on horse or not.
Same system also show if person mounted on boar, elephant, polar bear etc.
Or if person mounted on ass.
Ivan find mounting on ass funny.
Dec 2, 2013, 1:07 pm
#10
Joined: Sep 8, 2010
Occupation: Petty Functionary
Location: Drinking pea soup in the world map
Interests: Mangoes
Posts: 1,192
It's possible to generate extremely large continents. So yes, it's not surprising that you'd have difficulty finding the dragon tower, or that it be a long way off. The worldmap generation system is awful, and so probably needs to be looked at with some due consideration.
Batman? wrote
its been so long since i had gotten that far i didnt think it through. arrrr!!!!!!
Feb 18, 2014, 5:05 pm
#11
mutant ass


Joined: Feb 5, 2014
Occupation: Sysnet Tech Support
Location: Dublin, Ireland
Interests: Computers
Posts: 59
I'd like to have a good mess with that location stuff add a few forests locations similar to say....hunting grounds.

I wandered onto the atheist gods land....starving I went and attacked the nearest animal only to be chopped into little pieces by invisible things as punishment for not silently starving to death.
Ivan's Still Alive and Kicking!
Feb 19, 2014, 12:37 pm
#12
Joined: Sep 8, 2010
Occupation: Petty Functionary
Location: Drinking pea soup in the world map
Interests: Mangoes
Posts: 1,192
Yeah the people and animals on that level are all on the same team.
Batman? wrote
its been so long since i had gotten that far i didnt think it through. arrrr!!!!!!
Feb 19, 2014, 1:12 pm
#13
Master mine stomper


Joined: Dec 16, 2007
Occupation: Shoveling. But metal.
Location: Blazing in the steppes
Interests: Absolutely fuck-all.
Posts: 2,049
Hehe... In the genuine IVAN style.
Jump to