Outpost Universe Forums

Projects & Development => Outpost 2 Add On Missions => Topic started by: dave_erald on December 31, 2015, 11:30:50 AM

Title: New Joint Venture Multi Player Map
Post by: dave_erald 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)


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?
Title: Re: New Joint Venture Multi Player Map
Post by: Hooman 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?
Title: Re: New Joint Venture Multi Player Map
Post by: dave_erald 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?



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?
Title: Re: New Joint Venture Multi Player Map
Post by: Vagabond 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.
Title: Re: New Joint Venture Multi Player Map
Post by: Sirbomber 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 (http://www.youtube.com/watch?v=GJ63i9BXZSs) (okay maybe not this last one).
Title: Re: New Joint Venture Multi Player Map
Post by: Arklon 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.
Title: Re: New Joint Venture Multi Player Map
Post by: dave_erald 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.
Title: Re: New Joint Venture Multi Player Map
Post by: Vagabond 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.
Title: Re: New Joint Venture Multi Player Map
Post by: Sirbomber 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.
Title: Re: New Joint Venture Multi Player Map
Post by: Hooman 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.
Title: Re: New Joint Venture Multi Player Map
Post by: Vagabond 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.
Title: Re: New Joint Venture Multi Player Map
Post by: Sirbomber 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 (http://forum.outpost2.net/index.php/topic,4905.0.html) is fairly straightforward (http://forum.outpost2.net/index.php/topic,4941.0.html), 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.
Title: Re: New Joint Venture Multi Player Map
Post by: dave_erald 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.
Title: Re: New Joint Venture Multi Player Map
Post by: Sirbomber 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.
Title: Re: New Joint Venture Multi Player Map
Post by: dave_erald 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.
Title: Re: New Joint Venture Multi Player Map
Post by: Sirbomber on January 02, 2016, 09:09:50 PM
You can, buuuut...  Well, hey, try it out yourself.
Title: Re: New Joint Venture Multi Player Map
Post by: Hooman 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.
Title: Re: New Joint Venture Multi Player Map
Post by: lordpalandus 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!
Title: Re: New Joint Venture Multi Player Map
Post by: Hooman 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.
Title: Re: New Joint Venture Multi Player Map
Post by: dave_erald on January 03, 2016, 10:36:44 AM
Heeeeey..... I like the idea of a clustered meteor shower.
Title: Re: New Joint Venture Multi Player Map
Post by: dave_erald 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...
Title: Re: New Joint Venture Multi Player Map
Post by: Arklon 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.
Title: Re: New Joint Venture Multi Player Map
Post by: Hooman 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
  }
Title: Re: New Multi Player Map(...teach Dave how to code)
Post by: dave_erald 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!
Title: Re: New Joint Venture Multi Player Map
Post by: Arklon 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).
Title: Re: New Joint Venture Multi Player Map
Post by: dave_erald on January 04, 2016, 06:29:28 PM
I thought I had seen in another post somewhere about disabling all warnings for a map, or it may have been a hack of outpost 2 itself rendering every map without warnings? I'm not sure now.
Title: Re: New Joint Venture Multi Player Map
Post by: Arklon on January 04, 2016, 07:08:04 PM
I thought I had seen in another post somewhere about disabling all warnings for a map, or it may have been a hack of outpost 2 itself rendering every map without warnings? I'm not sure now.
I made a hack to disable all disaster warnings a while back for CCF2, but not on a per-instance basis.

I should maybe look into making disaster warnings only trigger if they're in close proximity to your units, like how the incoming EMP missile warning works.
Title: Re: New Joint Venture Multi Player Map
Post by: dave_erald on January 04, 2016, 08:45:53 PM
That could be where I read it. Wow, I swear i only just found and downloaded the package on ccf2 and was going to send you a PM later this week on what its about and its usage. I had seen someone's post on 'Battle of the blight' and thought that code really needs more use, which of course led me too your download.

I was going to ask your permission to use it if I could (pending my ability to even sort of comprehend it, I looked it over, its out of my reach right now)

Thanks for the help.


Side note, the fast call trigger for firing a meteor gets passed around in the SDK a bit, I'm guessing one call couldn't be manipulated to fire multiple meteors?(noob question, feel free to give me a noob appropriate response)
Title: Re: New Joint Venture Multi Player Map
Post by: Hooman on January 06, 2016, 08:09:55 AM
Quote
Doing that still spams you with warnings (disaster occurring), just not cautions (disaster watch, 10 marks prior) or alerts (disaster imminent, 5 marks prior).
Good point Arklon. Perhaps some more thinking is required.

Quote
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...)
I think so, yes. That's why I omitted it.

Quote
NEXT=>  A lot of this could be used for a controlled meteor shower right? All of the meteor impact points would go in:
That "MeteorShowerA/B/C" looks an awful lot like an array. ;)

As for the meteor shower offsets, it's similar to how it's done with the volcano. From what I remember, SouthFlowAni sets two tiles to animate. You specify one coordinate, and the other coordinate is offset from there. The meteor shower cloud could have relative coordinates from a center point. You specify a center point to the function, and the function will spawn meteors about that center point. The offsets could be controlled by using set layouts, passed in an array, or they can be randomly generated. The layout idea is neat, but beware the player will quickly recognize those layouts if you don't have a lot of them. That might not be desirable. It does allow for control over the damage pattern though, and can prevent two or three meteors from overlapping, and possibly causing too much localized damage.

Code: [Select]
void CreateMeteorShower(POINT &center, int numMeteors, POINT offsetList[])
{
  for (int i = 0; i < numMeteors; ++i) {
    POINT pt = center + offsetList[i];
    int meteorSize = 2;  // Better not to hardcode this
    TethysGame::SetMeteor(pt.x + 31, pt.y - 1, meteorSize);
  }
}

A modification to the above, is rather than pass "POINT offsetList", is to define a new data structure that contains both the offset, and the size of the meteor. That way it's not always hardcoded to 2. Such a struct might look like this:
Code: [Select]
struct MeteorInfo {
  POINT pt;
  int size;
};

You can then use array[index].pt, and array[index].size to control the offset and size of the meteor.

A further extension might include varying time delays, so the meteors don't all crash down at exactly the same time. I think that would actually be rather important to give the meteor shower some flavour. I'll leave you to think about it first. It will likely involve using scriptGlobal to control placement over multiple game ticks.


You can do away with the layout array by just using random numbers to generate the offsets. A parameter might be the size of the area around the center where meteors can hit. You can also play around with random number distributions to get meteors more likely near the center, and only rarely near the edges, and shape the area so it's more circular, or oval, or linear, rather than a box. There are also ways of controlling layout to prevent crowding, but you'd likely need to generate and store coordinates in an array and then spawn the meteors after all of them have been assigned a place. If you're also doing time delays, then the array will need to be stored between ticks, again using scriptGlobal.
Title: Re: New Joint Venture Multi Player Map
Post by: lordpalandus on January 08, 2016, 09:02:00 PM
Is it possible to create a new disaster entirely? That way you'd only get a single warning.

Something like an event that produces meteor strikes all within a single area, and as its a single event, only a single warning would be posted.

In theory.
Title: Re: New Joint Venture Multi Player Map
Post by: Hooman on January 09, 2016, 10:49:26 AM
That might be one way of doing it. Difficult though, as disasters are units. I don't think you'd want to do this as a new unit, as adding units to the game is quite difficult. In particular, it's not too clear how new units would be saved or loaded from saved game files. It would be a convenient way of working with it though.

I suppose a meteor shower library could be designed and wrapped up into a nice API. With a bit of mem hacking you could remove the extra disaster warnings. You'd probably want to set a static limit on size, as in a max number of meteors in one shower, but I suppose that could become a template parameter. The object controlling the disaster would probably need to be stored in the ScriptGlobal struct, since it's probably going to need processing over multiple game ticks, and so would need to be saved and restored from saved game files. That makes it a little less nice to deal with, but not too terrible.