Author Topic: Around the World V1.1  (Read 1167 times)

Offline dave_erald

  • Sr. Member
  • ****
  • Posts: 252
Around the World V1.1
« on: November 21, 2016, 10:52:26 AM »
So I am trying my hand at balancing current multiplayer maps. A lot of the current maps do not offer a good balance of common ore and rare ore placement, nor do they offer base locations relatively similar across the board.

So with that in mind I tried to follow this basic setup here (not all of this will work for all maps but this one at the very least is similar across all bases)

  • All base layouts i.e. where buildings and vehicles are, all the same (for now anyways)
  • All Common ore mines are same variant and yields in same locations
  • All Rare mines are same variant and yield
  • All Common mines are on fast passable 2 ground one next to smelter, the other 12 tiles up from base towards middle of the map
  • All Rare mines are on medium passable 2 ground and at the back end of the base
  • Each base has a fumarole same location (for those playing as EDEN)
  • Currently setup as three bases North end of map, three bases South end of map

I have had to modify the existing Around the World map so you will have to download the updated map.
It is currently setup with rare ore research done, and victory conditions turned off so that you can put it in your OP2 folder, run it in debug mode (press 'd' at the op2 start screen) and look it over.

Hoping to get feedback on this, whether it's going in the right, wrong direction, wrong map choice etc.etc.etc...

FYI (I compressed the map file with 7-zip to get the file size down due to the individual file size limit of 512kb, hopefully unzip and it comes out fine. There's a first for everything with me so be patient)

P.S. I now realize the size of this file means it may be missing dependencies req'd for some people to run in debug let alone regular play. Always something...

EDIT: Currently this has been tested on my own Local Network, I wrote in the Last Player left Trigger and sent the .dll file to my Windows 10 laptop. Game fired right up, base locations were randomly chosen, either of my computers give up and the other wins the scenario. All is good thus far 2016-11-21
« Last Edit: November 21, 2016, 11:45:25 PM by dave_erald »
I wrote a novella on this site, I can sorta code...

Outpost2 - Life at the End- 2015
Edits will show up in red

- David R.V.

Offline dave_erald

  • Sr. Member
  • ****
  • Posts: 252
Re: Around the World V1.1
« Reply #1 on: November 21, 2016, 12:03:06 PM »
For easier discussion

  • Common mine near smelter is a 2 bar, Reg variant yield mine
  • Common mine towards middle of map is a 1 bar, High yield mine
  • Rare ore mine is a 2 bar, Reg yield mine

What I had in mind was to add for each base location further towards the map a 3 Bar high yield Common and a 3 bar high yield Rare ore mine. So essentially it would be so many tiles away from each base on the same fast passable ground, not so far away that you have to build a command center, but far enough you have to build in that direction or run one long tube line to reach it, essentially adding another dynamic to the multiplayer game.

This would be in an effort to extend bases farther and rewarding players that build out further and move from there base.

One more thought was to put up a 'dead' city of buildings in the large middle of the map and have the entire area paved ground, again, more depth to the map and now adding a faster battle ground to play on. sections of disabled or beaten down Advanced Labs, Tokamaks that could randomly blow up and cause EMP waves, stuff like that

Thoughts?
I wrote a novella on this site, I can sorta code...

Outpost2 - Life at the End- 2015
Edits will show up in red

- David R.V.

Offline Vagabond

  • Sr. Member
  • ****
  • Posts: 451
Re: Around the World V1.1
« Reply #2 on: November 21, 2016, 10:38:33 PM »
Dave,

I downloaded the scenario and it worked fine for me.

I like how you standardized placing a geothermal vent with each colony. Perhaps set the vent to only appear if playing as Eden? This way it doesn't take up space in a Plymouth base

Maybe consider placing a magma well standard inside an Eden base on top of the the geothermal vent. This would also give Eden an advantage on Rare Ore intake during a long game.

Have you thought about how you want to handle disasters yet? You could setup safe rectangles around starting locations to keep large meteors and vortexes from wiping out a base. Or maybe not include either disaster to keep unfair events to a minimum. Black Box made up some decent disaster code in the scenario Plymouth Cold War.

What benefit do you get by using the built in Outpost 2 debug mode for multiplayer maps?

Quote from: dave_erald

One more thought was to put up a 'dead' city of buildings in the large middle of the map and have the entire area paved ground, again, more depth to the map and now adding a faster battle ground to play on. sections of disabled or beaten down Advanced Labs, Tokamaks that could randomly blow up and cause EMP waves, stuff like that

I think this is a great idea for a new scenario. You could even add some randomization to where the damaged tokamaks and labs start to make the battlefield different each scenario. If you are trying to make a new standard for balanced Last One Standing scenarios, it might be best to leave this out though.
« Last Edit: November 21, 2016, 10:42:22 PM by Vagabond »

Offline dave_erald

  • Sr. Member
  • ****
  • Posts: 252
Re: Around the World V1.1
« Reply #3 on: November 21, 2016, 11:07:03 PM »
Awesome thanks for looking that over!

So for me anyways, I comment out the CreateOnePlayerLeft Trigger, and add MarkResearchComplete(5110) and run the scenario in debug mode simply for looking at the map with all of the bases on it, and all of the ore beacons up so I can see very easily and very quickly if everything lines up the way it should...and also if I put Structure Factory code in wrong and cause your highlighted Structure Factories last letter in the name "Structure" to just be a rolling digit (starts with a [] and then rolls quickly thru all of the numbers and all of the letters of the alphabet and then starts over, weird shit man...)

I am going to attach the Main.cpp file and the BaseData header file so that everyone can see what I am doing and where improvements can be made or removed. Most of this is still largely fresh out of the SDK and not very complicated, in fact it could probably be compacted more.


As far as this map is concerned in particular as it is a bit unique, and lets face it quite large, is a I think what I would like to end up doing is making a list of possible building locations in the center and then have the code randomly select from a list of buildings to put in those spots. Not anything outrageously wild of course meaning a 100 different spots but enough to give people stuff to drive around, add a new dynamic to the map to keep it alive.

Part of the above would also be to add disaster code (which you, BlackBox or Bomber may be able to shed some light on) to just the center area of the map. Nothing over powering or spamming like say meteors all of the time (I think that would drive anyone mental...) but just a little could go a long way.


SIDE NOTE - I would like to see some kind of standardization come from this for future maps, maybe not the spread out nature of the base mind you, but rather number of ore deposits, yield and locations being similar for all bases.
I wrote a novella on this site, I can sorta code...

Outpost2 - Life at the End- 2015
Edits will show up in red

- David R.V.

Offline Vagabond

  • Sr. Member
  • ****
  • Posts: 451
Re: Around the World V1.1
« Reply #4 on: November 22, 2016, 12:08:59 AM »
Dave,

If you want to make a 'third party' junkyard colony, I believe it will require dropping to 5 human players. You will have to reserve one player for the junkyard, unless someone knows of a way to add a seventh player which I don't think is possible.

You can actually test the scenario by opening two instances of Outpost 2 on a single computer. That will let you ditch opening it in a second computer.

I'd be happy to generate some basic disaster code as a starting place. I'll make it dependent on a time trigger so disasters are not 'spammed', but occur over a time interval that is slightly random. It will take me a couple of days to deliver though. I'll try to encapsulate in a separate file so it can be 'dropped' into any multiplayer scenario for basic disasters.

I noticed in your locations, you are not using the map offsets of (31, -1). Applying this offset will make the positions correspond to the actual (X,Y) position on the map in game.

For Example:
Code: [Select]
TethysGame::CreateBeacon(mapMiningBeacon, 140 + 31, 194 - 1, 0, 2, 2);

You can also use the constants that are contained in OP2Helper.h to handle the offset (which I prefer because I think it looks a little cleaner).

Code: [Select]
// X and Y offset consts
const int X_ = 31; // +32-1
const int Y_ = -1; // -1

Using these, you can write the code as:

Code: [Select]
TethysGame::CreateBeacon(mapMiningBeacon, 140 + X_, 194 + Y_, 0, 2, 2);

Using either of these methods will make it when you highlight the space in Outpost 2, the displayed grid coordinate will actually match the value (140,194).

Offline dave_erald

  • Sr. Member
  • ****
  • Posts: 252
Re: Around the World V1.1
« Reply #5 on: November 22, 2016, 08:04:24 AM »
...
I noticed in your locations, you are not using the map offsets of (31, -1). Applying this offset will make the positions correspond to the actual (X,Y) position on the map in game.
...

I have to do this when I dig into regular maps, the World Maps should be written as ( X-1, Y-1 ) which I forgot to do here. Whoops

...
I'd be happy to generate some basic disaster code as a starting place. I'll make it dependent on a time trigger so disasters are not 'spammed', but occur over a time interval that is slightly random. It will take me a couple of days to deliver though. I'll try to encapsulate in a separate file so it can be 'dropped' into any multiplayer scenario for basic disasters.
...

This is a great idea and would be a big leg up for me. It's doubtful anyone will ever set disasters on, but when this gets released in a more official Map Pack it would be encouraged to give it a try given the details about disasters only happening in select regions of the map (I think this would be more beneficial and if only to avoid a vortex falling on your colony at mark 50 thereby deleting you from a multiplayer game)

The other added bonus of this is if there is a block of disaster starter code that can be dropped in to any new multiplayer map it would make for a quicker setup. Especially if it has a small labeled block indicating the field of disaster



And yeah, the bit about running two instances of OP2 on one computer never occurred to me (FYI, just tried it and it runs a game on LAN like it would if there were two seperate computers, so odd...)

I wrote a novella on this site, I can sorta code...

Outpost2 - Life at the End- 2015
Edits will show up in red

- David R.V.

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 3965
Re: Around the World V1.1
« Reply #6 on: November 23, 2016, 05:30:11 AM »
Code: [Select]
I am going to attach the Main.cpp file and the BaseData header file so that everyone can see what I am doing and where improvements can be made or removed.

I love it when people are looking to improve.


Ok, BaseData can have a lot of redundancy removed. All your data sets beaconSetX, buildingSetX, tubeSetX, unitSetX, are the same for every X. You don't need to duplicate them, just reference the same data set each time. The data is read-only anyway. Similarly, the array base[] references separate copies of the same data for each element. You don't need to duplicate the entries of this array, or even use an array. The only real differences exist in the array startLocation[], which can reference the same read-only data for each entry.

Code: [Select]
struct BaseInfo base = { autosize(beaconSet), autosize(buildingSet), autosize(tubeSet), 0, 0, autosize(unitSet) };

struct StartLocation startLocation[] =
{
{ 119, 27, &base },
{ 131, 215, &base },
{ 331, 30, &base },
{ 348, 210, &base },
{ 484, 29, &base },
{ 500, 210, &base }
};

Notice base is no longer an array, and all elements of the startLocation array reference the same base struct.

The design was intentional to make it easy to duplicate a base layout, which of course helps keep things even and fair.


In Main.cpp, consider using const/enum values to make code more self documenting. Contrast the following two lines:
Code: [Select]
TethysGame::CreateBeacon(mapMiningBeacon, 140, 194, 0, 2, 2);
TethysGame::CreateBeacon(mapMiningBeacon, 140, 194, OreTypeCommon, Bar1, Variant3);
The enums are declared in NonExportedEnums.h (kind of a bad name, I know) in the Outpost2Dll project.


Avoid extra code blocks without a clear reason. The enclosing braces below don't really need to be there. Block comments are usually placed above the section of code they apply to.
Code: [Select]
	{		
Trigger trig;        // Create a trigger variable.  If you don't know what that means, don't worry about it.
trig = CreateOnePlayerLeftTrigger(1, 0, "NoResponseToTrigger");  // NoResponseToTrigger is a generic catch-all function that does nothing when invoked
CreateVictoryCondition(1, 0, trig, "Eliminate your opponents."); // Use that trigger to create a victory condition
}

// You win when there is only one human opponent left or all surviving human players are allied.
// This also creates corresponding failure conditions

Prefer this instead:
Code: [Select]

// You win when there is only one human opponent left or all surviving human players are allied.
// This also creates corresponding failure conditions
Trigger trig;        // Create a trigger variable.  If you don't know what that means, don't worry about it.
trig = CreateOnePlayerLeftTrigger(1, 0, "NoResponseToTrigger");  // NoResponseToTrigger is a generic catch-all function that does nothing when invoked
CreateVictoryCondition(1, 0, trig, "Eliminate your opponents."); // Use that trigger to create a victory condition


There may be some more simplifications possible if you're looking for more.

Offline dave_erald

  • Sr. Member
  • ****
  • Posts: 252
Re: Around the World V1.1
« Reply #7 on: November 23, 2016, 10:04:21 AM »
That was quick. Thanks for looking that over Hooman

The Base array setup in the SDK is easy enough to follow, not having a easy way to put cargo in the structure factories does kinda blow. There was a brief blurb about trying to do around the array or with it (or just calling TethysGame::CreateUnit ... seperately) but it was a bit over my head and haven't had the time to devote to learning how to do that at the moment.

And all of the gook associated with those victory trigger conditions was a copy and paste from one of Sirbombers tutorials that i should have cleaned up before posting. I'm cutting corners cause I'm excited...


That leaves the only simplification I would like to find being one to assign structure kits to structure factories. Which I wonder if that could be just something as simple as

Code: [Select]
InitPlayerResources(i);

Unit Unit1;

Player[i], TethysGame::CreateUnit(Unit1, mapStructureFactory, LOCATION(sLoc.x+position offset, sLoc.y+position offset), i, mapNone, 0);
      Unit1.SetFactoryCargo(0, mapTokamak, mapNone);

However this code only works if each base is exactly the same, it doesn't account for bases that have different locations for where the structure factory should go (i.e. rotating base layouts as the SDK provided multiplayer map is setup for) one base has smelter ( 7, -7 ) base two would be ( -7, -7 ) offset from the sLoc.x and sLoc.y coordinates
I wrote a novella on this site, I can sorta code...

Outpost2 - Life at the End- 2015
Edits will show up in red

- David R.V.

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 3965
Re: Around the World V1.1
« Reply #8 on: November 23, 2016, 10:41:21 AM »
Adding kits to structure factories is a known limitation to the BaseBuilder way of doing things. I was going to address it in the BaseBuilder2 idea, but never really finished it. There are two main ways to add the structure kits. You can manually build the structure factory, as you've shown, and then add the kits, or you can search for the factory after it is built with BaseBuilder, and once you have a handle to it, you can add the kits.

For your particular level, the bases are all identical, so the offsets will be the same for all bases. That makes manually building the structure factory a bit easier. Keep in mind, the start location changes for each player, so you may need some kind of loop, which accesses sLoc.x and sLoc.y to generate proper x and y offsets.

To use the search method, you can make use of PlayerBuildingEnum from Enumerators.h in the Outpost2DLL project. You would use it something like this (untested code):
Code: [Select]
for (int i = 0; i < TethysGame::NoPlayers(); i++) {
  // ...

  Unit sf;
  PlayerBuildingEnum sfEnum(i, mapStructureFactory);
  if (sfEnum.GetNext(sf)) {
    sf.SetFactoryCargo(0, mapTokamak, mapNone);
    sf.SetFactoryCargo(1, mapPeoplesDailyHeadquarters, mapNone); // Just kidding
    sf.SetFactoryCargo(2, mapSmelter, mapNone);
  }

  // ...
}

Offline dave_erald

  • Sr. Member
  • ****
  • Posts: 252
Re: Around the World V1.1
« Reply #9 on: November 23, 2016, 11:26:58 AM »
The "Peoples Daily Headquarters" eh? ??? Would that be anything like the "Forever Leaders Command Center"?  :D

...somebody's been overseas a little toooooo long

EDIT=> So all of those changes worked perfectly. The BaseData code got cut down to a 1/6 of what it was. Hooray for less lines. And the PlayerBuildingEnum search works exactly like it should, I read the comment blurb in the SDK about doing that but had no idea how to code it, I understood what it was getting at but no idea how to right it.
« Last Edit: November 23, 2016, 11:10:22 PM by dave_erald »
I wrote a novella on this site, I can sorta code...

Outpost2 - Life at the End- 2015
Edits will show up in red

- David R.V.

Offline dave_erald

  • Sr. Member
  • ****
  • Posts: 252
Re: Around the World V1.1
« Reply #10 on: November 24, 2016, 10:02:51 PM »
Vagabond,

I just remembered Hooman and the Bomber helped me with some disaster code last year that I just found. This is probably a good start as any and if you want to go thru and modify, add/subtract whatever that would be Bueno.

I read thru this twice and realized with all the bullshit "Meteor Incoming" warnings you can just throw this out...

For Meteors
Code: [Select]
POINT meteorShowerA[] = {
{ 105,40 },
{ 110,41 },
{ 115,42 },

};
POINT meteorShowerB[] = {
{ 120,40 },
{ 125,41 },
{ 130,42 },

};
POINT meteorShowerC[] = {
{ 135,40 },
{ 140,41 },
{ 145,42 },

};
POINT meteorShowerD[] = {
{ 150,40 },
{ 155,41 },
{ 160,42 },

};

void CreateMeteor(POINT &pt)
{
TethysGame::SetMeteor(pt.x + 31, pt.y - 1, 2);
}
Code: [Select]
SCRIPT_API void meteorShowers()
{

CreateMeteor(meteorShowerA[TethysGame::GetRand(3)]);
{
Unit meteor;
int* meteorUnit = (int*)((*(int*)0x54F848) + meteor.unitID * 120);
int* meteorUnitFlags = (int*)((char*)meteorUnit + 0x44);
int* meteorUnitTimer = (int*)((char*)meteorUnit + 0x3C);
*meteorUnitFlags |= 0xC000;
*meteorUnitTimer = 5;
}
CreateMeteor(meteorShowerB[TethysGame::GetRand(3)]);
CreateMeteor(meteorShowerC[TethysGame::GetRand(3)]);
CreateMeteor(meteorShowerD[TethysGame::GetRand(3)]);
}

And if you don't it's still fun to look at
I wrote a novella on this site, I can sorta code...

Outpost2 - Life at the End- 2015
Edits will show up in red

- David R.V.

Offline Arklon

  • Administrator
  • Hero Member
  • *****
  • Posts: 1129
Re: Around the World V1.1
« Reply #11 on: November 24, 2016, 10:22:44 PM »
Vagabond,

I just remembered Hooman and the Bomber helped me with some disaster code last year that I just found. This is probably a good start as any and if you want to go thru and modify, add/subtract whatever that would be Bueno.

I read thru this twice and realized with all the bullshit "Meteor Incoming" warnings you can just throw this out...

For Meteors
Code: [Select]
POINT meteorShowerA[] = {
{ 105,40 },
{ 110,41 },
{ 115,42 },

};
POINT meteorShowerB[] = {
{ 120,40 },
{ 125,41 },
{ 130,42 },

};
POINT meteorShowerC[] = {
{ 135,40 },
{ 140,41 },
{ 145,42 },

};
POINT meteorShowerD[] = {
{ 150,40 },
{ 155,41 },
{ 160,42 },

};

void CreateMeteor(POINT &pt)
{
TethysGame::SetMeteor(pt.x + 31, pt.y - 1, 2);
}
Code: [Select]
SCRIPT_API void meteorShowers()
{

CreateMeteor(meteorShowerA[TethysGame::GetRand(3)]);
{
Unit meteor;
int* meteorUnit = (int*)((*(int*)0x54F848) + meteor.unitID * 120);
int* meteorUnitFlags = (int*)((char*)meteorUnit + 0x44);
int* meteorUnitTimer = (int*)((char*)meteorUnit + 0x3C);
*meteorUnitFlags |= 0xC000;
*meteorUnitTimer = 5;
}
CreateMeteor(meteorShowerB[TethysGame::GetRand(3)]);
CreateMeteor(meteorShowerC[TethysGame::GetRand(3)]);
CreateMeteor(meteorShowerD[TethysGame::GetRand(3)]);
}

And if you don't it's still fun to look at
That code only suppresses the "meteor watch initiated" and "meteor impact imminent" messages, not the "meteor approaching" one. So you still get message spammed and you make the meteor disaster warning and EDWARD techs useless. Don't add meteor showers, it was incredibly annoying in Bore Hole and it'll be incredibly annoying here.

Offline dave_erald

  • Sr. Member
  • ****
  • Posts: 252
Re: Around the World V1.1
« Reply #12 on: November 24, 2016, 10:35:19 PM »
Oh maybe that's what it did. Right, still, yeah, too many warning messages suck.

Ok, forget this
I wrote a novella on this site, I can sorta code...

Outpost2 - Life at the End- 2015
Edits will show up in red

- David R.V.

Offline leeor_net

  • Administrator
  • Hero Member
  • *****
  • Posts: 1633
    • LairWorks Entertainment
Re: Around the World V1.1
« Reply #13 on: November 25, 2016, 05:36:07 AM »
... snip ...

Don't add meteor showers, it was incredibly annoying in Bore Hole and it'll be incredibly annoying here.

I second this.
- Leeor
LairWorks Entertainment

Titanum UFO's

Offline Vagabond

  • Sr. Member
  • ****
  • Posts: 451
Re: Around the World V1.1
« Reply #14 on: November 25, 2016, 01:44:18 PM »
I have a lot of the Disaster code written, but little tested yet. There are a couple of edge cases I need to track down like handling possible performance problems if you set the safe areas too big and it cannot find a valid vortex path. I need to make a few more properties accessible so more disaster settings are customizable. Things like the min/max vortex duration, min/max earthquake size, etc.

Each of the disaster severity settings will be auto set to what I feel is a good starting place for vs multiplayer (IE not too strong of Earthquakes and shorter vortex durations). I'm happy to change these default numbers based on input since I'm not a veteran multiplayer by any means. Each scenario can also go in and easily change the settings as they see fit as well.

You will also be able to change the ratio that each disaster occurs. Right now I'm looking at more meteors then average and less vortexes then average with earthquakes and electrical storms being somewhere in the middle.

You will use a time trigger to determine the frequency that a disaster is called. Probably more frequent on larger maps, less frequent on smaller maps with keeping an eye on the reasonable spamming of warning messages.

It might take a bit of time for me to test through the code. Hoping to have it done before the end of the weekend.

Offline dave_erald

  • Sr. Member
  • ****
  • Posts: 252
Re: Around the World V1.1
« Reply #15 on: November 27, 2016, 11:56:14 AM »
No worries Vagabond, no hurry on my part.


So here's a question I have yet to find on answer to on the forum, if there is code available to both search thru a map and identify cells and cell types, and also to change cell types to lava possible, is there a way to search a localized and area and bulldoze it before game starts? I've tried setting the cell type to bulldozed in the mapper but that doesn't visually change the tiles, it may change the rate of speed you drive on them but I haven't gotten that far just yet.

EDIT=> The only way I can think of is to (in the mapper) place what looks like the darkened tiles down and then change cell type to bulldozed. Lot of work this way...
« Last Edit: November 27, 2016, 12:04:09 PM by dave_erald »
I wrote a novella on this site, I can sorta code...

Outpost2 - Life at the End- 2015
Edits will show up in red

- David R.V.

Offline Vagabond

  • Sr. Member
  • ****
  • Posts: 451
Re: Around the World V1.1
« Reply #16 on: November 27, 2016, 01:14:28 PM »
Dave,

There are functions in the SDK to get underlying tile sprite indices and cell types. See the volcano code below for examples of how to access the data. I would recommend checking out the file Bulldozer.h in OP2Helper. It allows bulldozing either a single LOCATION or a MAP_RECT. I think this will automate some of what you want.

Bulldozer.h/.cpp is smart enough that if you try to bulldoze a large MAP_RECT with rocks/cliffs on part of it not to bulldoze over the impassable terrain. I wrote it about 8 months ago and if you find any errors, let me know and I'll try to fix. I used it on the scenario EvacuationUnderFire to bulldoze areas in a the partially destroyed base.

If you are still looking to pursue creating a destroyed base in the center of a map, I wrote some code that allows placing pre-destroyed buildings on a map. IE you enter a LOCATION and building type and it places on the map the right bulldozed footprint, auto-placed building tubes (if applicable to the building), and the right amount of common/rare rubble (matched to the proper background graphic). I didn't place this code in the SDK because it is a very involved and lengthy set of classes and no one else seemed interested in it at the time. Check out RubbleMaker.h in the repository under the folder EvacuationUnderFire. I could also dump the code into the forum post if you prefer.



Setting tiles as lava possible programmatically:

One of Sirbomber's tutorials goes in depth on volcano code and covers it really well. If you haven't seen it yet, definitely worth digging up and reading.

Here is how I usually handle it:

This function will set an entire MAP_RECT as LavaPossible.
Code: [Select]
void SetLavaPossibleRegion(const MAP_RECT &mapRect)
{
int rectWidth = mapRect.x2 - mapRect.x1 + 1;
int rectHeight = mapRect.y2 - mapRect.y1 + 1;
int numberOfTiles = rectWidth * rectHeight;

LOCATION currentLoc;
for (int i = 0; i < numberOfTiles; ++i)
{
currentLoc = LOCATION(mapRect.x1 + i % rectWidth, mapRect.y1 + i / rectWidth);
GameMap::SetLavaPossible(currentLoc, true);
}
}

This function will set all map cell types S1 and S2 in a MAP_RECT as lava possible.
This is my preferred method. I just set lava terrain as cell S1 or S2 in the mapmaker and then call this function to make them all lava possible.

Code: [Select]
void SetLavaPossibleAllSlowCells(const MAP_RECT &mapRect)
{
int cellType;
LOCATION location;

for (int y = mapRect.y1; y <= mapRect.y2; ++y)
{
for (int x = mapRect.x1; x <= mapRect.x2; ++x)
{
location = LOCATION(x, y);
cellType = GameMap::GetCellType(location);

if (cellType == CellTypes::cellSlowPassible1 ||
cellType == CellTypes::cellSlowPassible2)
{
GameMap::SetLavaPossible(location, true);
}
}
}
}

This function sets an initial lava flow animation. (The one that exists when the scenario starts so you know the volcano can erupt). There are several lava flow animation choices. I think Sirbomber has pre-built functions for all of them in his tutorial. This is the animation for the volcano I used in RisingFromTheAshes.

Code: [Select]
	
void SetSouthEastLavaFlowAni(const LOCATION &location)
{
GameMap::SetTile(LOCATION(location.x, location.y), 0x489);
GameMap::SetTile(LOCATION(location.x, location.y + 1), 0x4A0);
GameMap::SetTile(LOCATION(location.x + 1, location.y + 1), 0x4AB);
GameMap::SetTile(LOCATION(location.x + 1, location.y), 0x494);
}

Offline dave_erald

  • Sr. Member
  • ****
  • Posts: 252
Re: Around the World V1.1
« Reply #17 on: November 27, 2016, 03:30:28 PM »
All that lava code I've seen before which is where i was wondering about using it for bulldozing. I do remember seeing something about bulldozer code you were writing but completely forgot about till you mention it. I will look it up and take it for a whirl.

Thanks again buddy!
I wrote a novella on this site, I can sorta code...

Outpost2 - Life at the End- 2015
Edits will show up in red

- David R.V.