Author Topic: New Joint Venture Multi Player Map  (Read 17946 times)

Offline dave_erald

  • Sr. Member
  • ****
  • Posts: 262
New Joint Venture Multi Player Map
« on: December 31, 2015, 11:30:50 AM »
So now that I know that I can create some fairly random patterns I had a thought for a Multiplayer map.

The Randomizer (working title, it sucks, relax)

  • Random start postions
  • Random colors
  • Random colony type (randomly chooses eden or plymouth)
  • Randomly choose a batch of weapons tech ( one time eden gets laser, esg, rocket and thor, next time plymouth gets sticky, rail, esg and acid cloud)

I don't know how much randomness people would enjoy, it certainly removes the selection features from multiplayer start screen, but it could level the playing field? Maybe?


Ideas?
-David R.V.

-GMT400 fan
-OPU Influencer

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Re: New Joint Venture Multi Player Map
« Reply #1 on: January 01, 2016, 09:00:23 AM »
Randomizing weapons could create some balance issues. ... but don't let that stop you! ;)

Of course you'll also need random beacons, both in placement, and yield. Random disasters, and random intensity. ... random lava flow. ;)

What else can be randomized?

Offline dave_erald

  • Sr. Member
  • ****
  • Posts: 262
Re: New Joint Venture Multi Player Map
« Reply #2 on: January 01, 2016, 10:07:53 AM »
I was thinking like 4 weapons packs, 4 weapons each. (Most people don't use all 6 eden weapons anyways)

Leave ore deposits, base layout's exactly the same (this way you wouldn't have the issues of the experienced player gets a 3 bar common, and the rookie gets a 1 bar

I like the idea of Random deadly disasters, once every 300 game marks, and yeah a volcano that could randomly erupt which brings up a good question, setting lava tiles goes something like this

Code: [Select]
// Function for Setting All S1 and S2 Celltypes to lava-possible
void SetAllLava()
{
int x, y, tile;
LOCATION mapsize(512, 256);                                            // create a point wayoff the map

mapsize.Clip();                                                        // clip it, so we have the mapsize

for (y = 0; y<mapsize.y; ++y)                                            // run through all rows
{
for (x = 0; x<mapsize.x; ++x)                                    // check every tile on each row
{
tile = GameMap::GetCellType(LOCATION(x, y));               // get the celltype on that position
if ((tile == cellSlowPassible1)
|| (tile == cellSlowPassible2))                 // If celltype = S1 or S2

{
GameMap::SetLavaPossible(LOCATION(x, y), true);  // -> then set it to LavaPossible
}
}
}
}


It would be more tedious but I guess you could put this code :

Code: [Select]
// Mark where the lava can flow
// (do this anytime before the eruption, including from InitProc)
GameMap::SetLavaPossible(LOCATION(76 + 31, 39 - 1), true);
GameMap::SetLavaPossible(LOCATION(76 + 31, 40 - 1), true);
GameMap::SetLavaPossible(LOCATION(76 + 31, 41 - 1), true);

...in 4 or 5 packs that the game could randomly call upon to distribute lava down, again pain in the arse to type all that code up, but then this way the lava goes somewhere different each time.

Enough consistency you don't get pissed playing the game, but enough changes its a different experience each time.


And as for weapons packs, 3 or 4 types in each?

  • Laser, EMP, ESG, Rocket
  • Microwave, Nova, Starflare, Thor
  • Microwave, Sticky, Rail, Acid
  • Laser, Sticky, Acid, ESG


And one more thought.

If a six player map does not have all six human players selected, should the other two or three spots be filled by AI?


Suggestions?
-David R.V.

-GMT400 fan
-OPU Influencer

Offline Vagabond

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1015
Re: New Joint Venture Multi Player Map
« Reply #3 on: January 01, 2016, 11:12:26 AM »
You could use AI spots like on the Peacekeeper map to keep people from being able to rush early. Or you could try using the AI to penalize the most advanced player. Maybe the AI sends an attack wave to the first person would builds a rare ore mine and the first person who builds a spaceport.

I think randomizing the weapons will hurt balance, but I also think it could be a lot of fun forcing people to try different weapon combos than they are used to.

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
Re: New Joint Venture Multi Player Map
« Reply #4 on: January 01, 2016, 12:48:18 PM »
This sounds lame.  You're not going far enough.  Why stop at only randomizing weapons?  You could use random techtrees so different players get different upgrades.  One person can have faster units while the other gets bonuses to HP and armor (and maybe starts with Panthers [which don't cost rare for this player] but can never get Lynx).  On that note, randomize what structures and units players can build.  No Cargo Trucks (mines generate a fixed income every 3 marks).  One player can't get Vehicle Factories and has to make do with Scorpions and EMP Missiles (which they would get faster than normal).  One player can only build Residences and Light Towers, but after making enough they all lift off and combine to form Terratron (okay maybe not this last one).
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials

Offline Arklon

  • Administrator
  • Hero Member
  • *****
  • Posts: 1269
Re: New Joint Venture Multi Player Map
« Reply #5 on: January 01, 2016, 01:00:39 PM »
Why stop there? The only unit you should be able to build are Earthworkers, and you can only win by cutting everyone else's tubes.

Offline dave_erald

  • Sr. Member
  • ****
  • Posts: 262
Re: New Joint Venture Multi Player Map
« Reply #6 on: January 01, 2016, 02:06:12 PM »
It sounds like there could be three or four different maps inside of all these ideas, especially the bits about scorpions or earthworkers only.

How in the hell would you code the tube idea? I think I know how to do that... use scorpions as guard units? That could be cool.

And how quickly could you hit the unit limit with just scorpions? You could probably make a lot of the damn things. Set there movement speed fast enough it would be the Outpost equivalent to Zerglings, uhh... Zerglings with blaster cannons, mechanical Zerglings... with blaster cannons. I kinda want to see a swarm of scorpions mow down a colony now.


Also the mining thing, having it set that players receive a set amount from every mine they have and not worry about smelters or cargo trucks feels like a good idea to me and one that probably could be used as a global function for the game, worry less about income, and more about moving units around and beating up people. I like that. Mind if I use it? You would get credit for the idea of course.


Should this be a world map or something smaller like Pie Chart?


...and lets keep in mind I'm a noob at programming, I'll get it but there will be questions on the way.
« Last Edit: January 01, 2016, 02:19:15 PM by dave_erald »
-David R.V.

-GMT400 fan
-OPU Influencer

Offline Vagabond

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1015
Re: New Joint Venture Multi Player Map
« Reply #7 on: January 01, 2016, 03:02:33 PM »
You wouldn't have to code the tube idea. Just send your Earthworker over to their colony first thing before they can build lasers/microwave and start disconnecting.
« Last Edit: January 02, 2016, 04:59:56 AM by Vagabond »

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
Re: New Joint Venture Multi Player Map
« Reply #8 on: January 01, 2016, 11:28:26 PM »
It was a joke, Vagabond, and within the context of the rest of my post it's clear that I was encouraging dave_erald to go farther with his idea.  Please do not take pieces of what I've said out of context just to get offended by them.
« Last Edit: January 01, 2016, 11:32:43 PM by Sirbomber »
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Re: New Joint Venture Multi Player Map
« Reply #9 on: January 02, 2016, 01:26:29 AM »
I like the SetAllLava function. That would make for an excellent inclusion into one of the SDK projects, such as OP2Helper. Where did it come from? Searching through the repository, I see it used in Multitek2 and ZigHooville.

Specifying alternative lava flows can be a bit of a pain.

I like the idea of using an AI as a buffer, or to punish an advanced player, but mostly because I can think of ways to abuse it. ;) Like say, wait until you're attacked by a large force, and then build a spaceport, triggering the AI to attack, and catching your attacker from behind.

On a more serious note, I wouldn't worry about AI for your first level. It takes a lot of work to get a reasonable AI, and is very time consuming to debug.

Offline Vagabond

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1015
Re: New Joint Venture Multi Player Map
« Reply #10 on: January 02, 2016, 05:07:56 AM »
Sorry, I guess I missed the point of your comment SirBomber.

Glad to see all the great ideas for a new map.

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
Re: New Joint Venture Multi Player Map
« Reply #11 on: January 02, 2016, 09:45:37 AM »
No harm done.  Moving on.

The SetAllLava function comes from the old wiki, Hooman.  I have no idea whatsoever who originally wrote that code.  What would be more interesting to have, especially for this project, is some code Mcshay wrote to create "paths" for the lava to flow over; unfortunately it, like 99% of Mcshay's code, has been lost to time.  However, I will have to disagree with you regarding AI.  Writing a basic, functional AI is fairly straightforward, and you can get some pretty interesting results just with some simple (albeit hardcoded) behaviors.  However, don't expect it to be anything more than a speedbump for most players.
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials

Offline dave_erald

  • Sr. Member
  • ****
  • Posts: 262
Re: New Joint Venture Multi Player Map
« Reply #12 on: January 02, 2016, 10:15:33 AM »
The Lava on this simple colony map I have is a mix of what I found on Sirbomber's tutorials, and a post by you Hooman

Code: [Select]
// Function for Setting All S1 and S2 Celltypes to lava-possible
void SetAllLava()
{
int x, y, tile;
LOCATION mapsize(512, 256);                              // create a point wayoff the map

mapsize.Clip();                                          // clip it, so we have the mapsize

for (y = 0; y<mapsize.y; ++y)                            // run through all rows
{
for (x = 0; x<mapsize.x; ++x)                        // check every tile on each row
{
tile = GameMap::GetCellType(LOCATION(x, y));     // get the celltype on that position
if ((tile == cellSlowPassible1)
|| (tile == cellSlowPassible2))              // If celltype = S1 or S2

{
GameMap::SetLavaPossible(LOCATION(x, y), true);  // -> then set it to LavaPossible
}
}
}
}

// Functions for setting up volcano animations
void SouthFlowAni(int x, int y)
{
GameMap::SetTile(LOCATION(x, y), 0x474);
GameMap::SetTile(LOCATION(x, y + 1), 0x47E);
}

I kind of prefer setting lava by cell type rather then tile color, I can make the lava flow exactly where I want it (and the map editor is already frustrating and time consuming, switching to the cell type layer is simple and quick)

Code: [Select]
int InitProc()
{
//Set tiles on map to lava possible
SetAllLava();

Code: [Select]
// Script used for changing tiles on side of volcano to lava possible
// Eruption starts the actual eruption and gets the lava flowing
SCRIPT_API void Eruption()
{
// Mark where the lava can flow
// (do this anytime before the eruption, including from InitProc)
GameMap::SetLavaPossible(LOCATION(76 + 31, 39 - 1), true);
GameMap::SetLavaPossible(LOCATION(76 + 31, 40 - 1), true);
GameMap::SetLavaPossible(LOCATION(76 + 31, 41 - 1), true);

// Start the lava flowing  (... in about 10 marks)
// At this point, the earliest disaster warning will sound
TethysGame::SetEruption(76 + 31, 39 - 1, 2300);
TethysGame::SetLavaSpeed(150);
}


As for AI, at first it would just be simple filler for the map, if we want to add some curious behavior to it, I guess we can do that later.

And yeah no harm. As long as people help and have good suggestions, say what ever you want.
-David R.V.

-GMT400 fan
-OPU Influencer

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
Re: New Joint Venture Multi Player Map
« Reply #13 on: January 02, 2016, 10:53:15 AM »
Be careful doing it by celltype.  Graphics only exist for lava flowing onto dark rock, so if lava flows onto an unsupported tile, it will just look like random pieces of cliffs and other garbage.
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials

Offline dave_erald

  • Sr. Member
  • ****
  • Posts: 262
Re: New Joint Venture Multi Player Map
« Reply #14 on: January 02, 2016, 11:13:11 AM »
Ahhh.

So I couldn't make lava flow onto sand then? Bummer...



Oh well. I guess any lava path has to be onto dark lava rock. Fine.
-David R.V.

-GMT400 fan
-OPU Influencer

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
Re: New Joint Venture Multi Player Map
« Reply #15 on: January 02, 2016, 09:09:50 PM »
You can, buuuut...  Well, hey, try it out yourself.
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Re: New Joint Venture Multi Player Map
« Reply #16 on: January 02, 2016, 09:18:54 PM »
Hehe. Yeah, it is kind of unfortunate that lava wasn't designed so it could flow everywhere properly. Would have been a nice surprise on occasion. ;)

It does look neat when you see lava flow off the dark rock, but not something you'd want to put in a finished level.

I'm thinking I may steal that code for inclusion in the SDK. I'll try sending ZigZagJoe a message in case he was the one that wrote it.

Offline lordpalandus

  • Banned
  • Hero Member
  • *****
  • Posts: 825
Re: New Joint Venture Multi Player Map
« Reply #17 on: January 03, 2016, 03:25:36 AM »
Other Random Possibilities:

A random chance for the Blight to appear in multiplayer. That will "encourage" players to fight faster to avoid dying by default to the Blight.

A random chance that unaligned enemy patrols enter the map and attack the nearest base, based on where they spawn.

A random chance that multiple disasters occur simulataneously (ie more than one disaster occurs on the same tick).

A random chance that an area gets bombarded by a meteor storm, and several meteors fall all within the same general area within a few ticks of each other.

A random chance that causes Dan's Dog to appear!
Currently working on Cataclysm of Chaos, Remade.
Link to OPU page = http://forum.outpost2.net/index.php/topic,6073.0.html

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Re: New Joint Venture Multi Player Map
« Reply #18 on: January 03, 2016, 06:34:20 AM »
Having random meteors means you have a random chance of seeing Dan's Dog. Just, you have to play for a long time.

Purposefully making disasters coincide is nice though, especially in terms of a meteor shower.

Offline dave_erald

  • Sr. Member
  • ****
  • Posts: 262
Re: New Joint Venture Multi Player Map
« Reply #19 on: January 03, 2016, 10:36:44 AM »
Heeeeey..... I like the idea of a clustered meteor shower.
-David R.V.

-GMT400 fan
-OPU Influencer

Offline dave_erald

  • Sr. Member
  • ****
  • Posts: 262
Re: New Joint Venture Multi Player Map
« Reply #20 on: January 03, 2016, 05:13:13 PM »
So here's some code I could use some help cleaning up.


It's all for testing purposes right now and it's a little lengthy...

This code creates a Volcano at one of 7 pre-selected locations, randomly at Mark 11. Actually spreading Lava I'll declare all at once, and I hope to use this structure of code, or a similar structure for other events.

Before Init_Proc

Code: [Select]
void VolA()
{

// Start a south volcano animation
SouthFlowAni(70 + 31, 37 - 1);

// Start the eruption on it's way in 1 mark
Trigger &timeTrigger = CreateTimeTrigger(true, true, 100, "EruptionA");
return;
}

void VolB()
{

// Start a south volcano animation
SouthFlowAni(80 + 31, 37 - 1);

// Start the eruption on it's way in 1 mark
Trigger &timeTrigger = CreateTimeTrigger(true, true, 120, "EruptionB");
return;
}

void VolC()

{

// Start a south volcano animation
SouthFlowAni(90 + 31, 37 - 1);

// Start the eruption on it's way in 1 mark
Trigger &timeTrigger = CreateTimeTrigger(true, true, 130, "EruptionC");
return;
}

void VolD()

{

// Start a south volcano animation
SouthFlowAni(100 + 31, 37 - 1);

// Start the eruption on it's way in 1 mark
Trigger &timeTrigger = CreateTimeTrigger(true, true, 140, "EruptionD");
return;
}
void VolE()
{

// Start a south volcano animation
SouthFlowAni(110 + 31, 37 - 1);

// Start the eruption on it's way in 1 mark
Trigger &timeTrigger = CreateTimeTrigger(true, true, 150, "EruptionE");
return;
}
void VolF()
{

// Start a south volcano animation
SouthFlowAni(120 + 31, 37 - 1);

// Start the eruption on it's way in 1 mark
Trigger &timeTrigger = CreateTimeTrigger(true, true, 160, "EruptionF");
return;
}
void VolMid()
{

// Start a south volcano animation
SouthFlowAni(130 + 31, 37 - 1);

// Start the eruption on it's way in 1 mark
Trigger &timeTrigger = CreateTimeTrigger(true, true, 170, "EruptionMid");
return;
}

void (*volcanos[7])() = { VolA, VolB, VolC, VolD, VolE, VolF, VolMid };

In Init_Proc

Code: [Select]
(*volcanos[TethysGame::GetRand(7) % 7])();

After Init_Proc

Code: [Select]
SCRIPT_API void EruptionA()
{
// Mark where the lava can flow
// (do this anytime before the eruption, including from InitProc)
GameMap::SetLavaPossible(LOCATION(70+ 31, 39 - 1), true);
GameMap::SetLavaPossible(LOCATION(70 + 31, 40 - 1), true);
GameMap::SetLavaPossible(LOCATION(70 + 31, 41 - 1), true);

// Start the lava flowing  (... in about 10 marks)
// At this point, the earliest disaster warning will sound
TethysGame::SetEruption(70 + 31, 39 - 1, 200);
TethysGame::SetLavaSpeed(150);
}

SCRIPT_API void EruptionB()
{
// Mark where the lava can flow
// (do this anytime before the eruption, including from InitProc)
GameMap::SetLavaPossible(LOCATION(80 + 31, 39 - 1), true);
GameMap::SetLavaPossible(LOCATION(80 + 31, 40 - 1), true);
GameMap::SetLavaPossible(LOCATION(80 + 31, 41 - 1), true);

// Start the lava flowing  (... in about 10 marks)
// At this point, the earliest disaster warning will sound
TethysGame::SetEruption(80 + 31, 39 - 1, 200);
TethysGame::SetLavaSpeed(150);
}

SCRIPT_API void EruptionC()
{
// Mark where the lava can flow
// (do this anytime before the eruption, including from InitProc)
GameMap::SetLavaPossible(LOCATION(90 + 31, 39 - 1), true);
GameMap::SetLavaPossible(LOCATION(90 + 31, 40 - 1), true);
GameMap::SetLavaPossible(LOCATION(90 + 31, 41 - 1), true);

// Start the lava flowing  (... in about 10 marks)
// At this point, the earliest disaster warning will sound
TethysGame::SetEruption(90 + 31, 39 - 1, 200);
TethysGame::SetLavaSpeed(150);
}

SCRIPT_API void EruptionD()
{
// Mark where the lava can flow
// (do this anytime before the eruption, including from InitProc)
GameMap::SetLavaPossible(LOCATION(100 + 31, 39 - 1), true);
GameMap::SetLavaPossible(LOCATION(100 + 31, 40 - 1), true);
GameMap::SetLavaPossible(LOCATION(100 + 31, 41 - 1), true);

// Start the lava flowing  (... in about 10 marks)
// At this point, the earliest disaster warning will sound
TethysGame::SetEruption(100 + 31, 39 - 1, 200);
TethysGame::SetLavaSpeed(150);
}

SCRIPT_API void EruptionE()
{
// Mark where the lava can flow
// (do this anytime before the eruption, including from InitProc)
GameMap::SetLavaPossible(LOCATION(110 + 31, 39 - 1), true);
GameMap::SetLavaPossible(LOCATION(110 + 31, 40 - 1), true);
GameMap::SetLavaPossible(LOCATION(110 + 31, 41 - 1), true);

// Start the lava flowing  (... in about 10 marks)
// At this point, the earliest disaster warning will sound
TethysGame::SetEruption(110 + 31, 39 - 1, 200);
TethysGame::SetLavaSpeed(150);
}

SCRIPT_API void EruptionF()
{
// Mark where the lava can flow
// (do this anytime before the eruption, including from InitProc)
GameMap::SetLavaPossible(LOCATION(120 + 31, 39 - 1), true);
GameMap::SetLavaPossible(LOCATION(120 + 31, 40 - 1), true);
GameMap::SetLavaPossible(LOCATION(120 + 31, 41 - 1), true);

// Start the lava flowing  (... in about 10 marks)
// At this point, the earliest disaster warning will sound
TethysGame::SetEruption(120 + 31, 39 - 1, 200);
TethysGame::SetLavaSpeed(150);
}

SCRIPT_API void EruptionMid()
{
// Mark where the lava can flow
// (do this anytime before the eruption, including from InitProc)
GameMap::SetLavaPossible(LOCATION(130 + 31, 39 - 1), true);
GameMap::SetLavaPossible(LOCATION(130 + 31, 40 - 1), true);
GameMap::SetLavaPossible(LOCATION(130 + 31, 41 - 1), true);

// Start the lava flowing  (... in about 10 marks)
// At this point, the earliest disaster warning will sound
TethysGame::SetEruption(130 + 31, 39 - 1, 200);
TethysGame::SetLavaSpeed(150);
}

It works, and it works fine... just lengthy.

Thoughts?

EDIT: so I just read some of Mcshay's smartlava post, I am way behind on good lava I think... This code is terrible...

DOUBLE EDIT: So I have changed this code just a little, and adjusted it too watch whats going on. It randomly pics a location to dump the lava, but it always starts a mark 11, animation shows up at Mark 1, lava at 11 everytime. Damn...
« Last Edit: January 03, 2016, 08:08:49 PM by dave_erald »
-David R.V.

-GMT400 fan
-OPU Influencer

Offline Arklon

  • Administrator
  • Hero Member
  • *****
  • Posts: 1269
Re: New Joint Venture Multi Player Map
« Reply #21 on: January 03, 2016, 08:02:45 PM »
Having random meteors means you have a random chance of seeing Dan's Dog. Just, you have to play for a long time.

Purposefully making disasters coincide is nice though, especially in terms of a meteor shower.
ZigZagJoe did meteor showers in his maps and I mostly just found it to be incredibly annoying when you get spammed with a dozen "meteor approaching" warnings all at the exact same instant.

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Re: New Joint Venture Multi Player Map
« Reply #22 on: January 04, 2016, 07:28:48 AM »
Quote
ZigZagJoe did meteor showers in his maps and I mostly just found it to be incredibly annoying when you get spammed with a dozen "meteor approaching" warnings all at the exact same instant.
When you create the disasters, you can memory hack the units to mark them as already having warned you. Do that for all but maybe one of them to prevent spam.

For those that are wondering, when you create a disaster, there is a 10 mark delay before it appears. This is to give the game time to provide the advanced warnings, once the corresponding advanced warning is researched at a lab.


@dave_erald:
As for the code, yes, that can be compressed. I'm a little surprised to see you making use of function pointers. That's normally considered a somewhat advanced topic.

As for how I would do it, I'd create an array of data, rather than an array of function pointers. The code is essentially the same between all copies, only the hardcoded data changes. Instead, remove the hardcoding from the functions, use variables, place the hardcoded data into an array, and randomly select an element from the array to be used in the function.

Code: [Select]
const Point volcanoLocations[] = {
  {70, 37},
  {80, 37},
  {90, 37},
  ...
};

// In InitProc, or TimeTrigger callback, or wherever:
CreateEruption(volcanoLocation[TethysGame::Rand(NumOf(volcanoLocations))]);


void CreateEruption(Point &pt)
{
  // Create eruption
  SouthFlowAni(pt.x + 31, pt.y - 1);
  TethysGame::SetEruption(pt.x + 31, pt.y - 1);
}

Here I'm setting the animation at the same time as alerting the game of the eruption. I feel it would make more sense to the player if these two events were tied closely together, having the visual indication of a volcano erupting, and the advanced alert of a pending eruption. You can also set lava possible bits if needed in that function, but usually the eruption is placed somewhere you'd expect those bits to already be set.

To delay eruption after game start, use CreateTimeTrigger in InitProc, with the desired delay, and place the code that calls CreateEruption inside the callback function for the time trigger.

The newer SDK uses "Export" to mark the callback functions for export from the DLL, rather than "SCRIPT_API".

Oh, and you're a little inconsistent with the indentation of your braces {}. They are usually not indented to the same level as their contents. Opinions vary on that, but most people would put them at the same tab stop as the outside of the block. To reduce the number of lines, sometimes the opening brace is at the end of the line above.

Code: [Select]
// The usual way
if (condition)
{
  // Contents
}

// The compact way
if (condition) {
  // Contents
}

// The somewhat strange and uncommon way
if (condition)
  {
  // Contents
  }

Offline dave_erald

  • Sr. Member
  • ****
  • Posts: 262
Re: New Multi Player Map(...teach Dave how to code)
« Reply #23 on: January 04, 2016, 10:28:21 AM »
Here's the completed code that compiles and runs just fine:

Code: [Select]
POINT volcanoLocations[] = {
{ 112, 37 },
{ 114, 37 },
{ 116, 37 },
{ 118, 37 },
{ 120, 37 },
{ 122, 37 },
{ 124, 37 },
};

void CreateEruption(POINT &pt)
{
// Create eruption
SouthFlowAni(pt.x + 31, pt.y - 1);
TethysGame::SetEruption(pt.x + 31, pt.y - 1, 300);
TethysGame::SetLavaSpeed(150);
}

In InitProc:

Code: [Select]
CreateEruption(volcanoLocations[TethysGame::GetRand(7)]);

Which is waaaaaaay cleaner than the dribble of crap I was trying to do.

Side note, the TethysGame::SetLavaSpeed is sorta useless ain't it? (Yes it is, that 300 in TethysGame::SetEruption is the lava speed, 50 is slow, 500 is, well, lava probably shouldn't move that fast...)


NEXT=>  A lot of this could be used for a controlled meteor shower right? All of the meteor impact points would go in:

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);
}

CreateMeteor(meteorShowerA[TethysGame::GetRand(3)]);
CreateMeteor(meteorShowerB[TethysGame::GetRand(3)]);
CreateMeteor(meteorShowerC[TethysGame::GetRand(3)]);
CreateMeteor(meteorShowerD[TethysGame::GetRand(3)]);

I would have to look into how you would randomly shift the entire meteor shower around to different locations, and disable the bazillion warnings you would get.

As always Thanks Hooman!
« Last Edit: January 04, 2016, 11:30:50 AM by dave_erald »
-David R.V.

-GMT400 fan
-OPU Influencer

Offline Arklon

  • Administrator
  • Hero Member
  • *****
  • Posts: 1269
Re: New Joint Venture Multi Player Map
« Reply #24 on: January 04, 2016, 12:48:17 PM »
Quote
ZigZagJoe did meteor showers in his maps and I mostly just found it to be incredibly annoying when you get spammed with a dozen "meteor approaching" warnings all at the exact same instant.
When you create the disasters, you can memory hack the units to mark them as already having warned you. Do that for all but maybe one of them to prevent spam.

For those that are wondering, when you create a disaster, there is a 10 mark delay before it appears. This is to give the game time to provide the advanced warnings, once the corresponding advanced warning is researched at a lab.
Doing that still spams you with warnings (disaster occurring), just not cautions (disaster watch, 10 marks prior) or alerts (disaster imminent, 5 marks prior).