Author Topic: Unit Only Multiplayer Missions  (Read 8229 times)

Offline Vagabond

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1015
Unit Only Multiplayer Missions
« on: December 04, 2016, 10:02:43 PM »
I am working on a unit only scenario where you have to escort a third party convoy through enemy units. I realized that it would be pretty easy to make the scenario multiplayer by ripping the AI out of the third party convoy and having it be human controlled.

I tested unit only multiplayer and Outpost 2 supports it no problem. This is really cool since the developers didn't make any unit only multiplayer scenarios.

My plan is to push almost all the scenario code out of LevelMain.cpp and into separate .h/.cpp files that both scenarios reference. Each scenario will be a separate project. This leaves only about 2 dozen formatted lines in LevelMain.cpp for the single and multiplayer version of the scenario, which should be really easy to maintain.

I'm thinking I have to add a third library project that compiles the code shared between the single and multiplayer scenario. I was trying to make the multiplayer scenario just depend on the single player version, but it is giving me errors. The code in the library will just take a Boolean value that indicates if the convoy needs to be initialized as an AI or a human player.

I'm planning to place the multiplayer scenario as a Land Rush with the title "2P, Convoy, Rescue Escort". Unless someone has a better idea where to place it.

I was thinking of using the Initial Vehicles box to set the multiplayer difficulty. With 0 being beatable by someone who is new to the game/not trying too hard and 12 being beyond my skill to beat. Hopefully that will make it mildly replayable. I will probably ramp the multiplayer difficulty by simply adding more bad guys with each clip up. In the single player version, I was looking at pulling grenade loading mechanism and extended range projectile launcher when playing on Normal or Hard to make it more difficult. I think in the multiplayer scenario I would just focus on number of bad guys instead of messing with tech though.

I'm not sure if the scenario will be fun or not yet. It will definitely be fairly short and fixed in the time to play, which can be appealing if you are looking for a shorter multiplayer session. The single player version stems as the 3rd episode in the mini-campaign I've been working through and occurs after the scenario On The Run.

Of course, any suggestions on implementation are welcome. It probably won't be released for beta testing until January (or later if my day job is too busy in the short term).

Offline leeor_net

  • Administrator
  • Hero Member
  • *****
  • Posts: 2352
  • OPHD Lead Developer
    • LairWorks Entertainment
Re: Unit Only Multiplayer Missions
« Reply #1 on: December 06, 2016, 09:38:48 AM »
I suppose some people like escort missions and I certainly appreciate the novelty of your work... but I personally hate escort missions. Of course I'm thinking of cases in World of Warcraft where you have to escort the stupidest motherfuckers on the planet so I'm somewhat biased...

Still, it's a change from the norm in Outpost 2 and if well done could be a lot of fun. I'll have to check it out!

Offline White Claw

  • Hero Member
  • *****
  • Posts: 854
Re: Unit Only Multiplayer Missions
« Reply #2 on: December 06, 2016, 10:51:17 AM »
I like the idea of unit only missions. I always thought the unit missions were an interesting puzzle, and was amazed at how different the flavor of the game was during those missions (even if the combat is a bit rough).

Offline Vagabond

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1015
Re: Unit Only Multiplayer Missions
« Reply #3 on: December 13, 2016, 09:40:11 PM »
Leeor and White Claw,

Thanks for the input.

I have a final draft of the map for this scenario. See below. I updated to the newer version of the OP2Mapper, version 2.2.1. Only problem is for the minimap this version makes the orangish colored sand tiles blue on the minimap. I'm assuming this happens to other people as well? I based this map on an existing map, but modified it really heavily. I think maybe on my next project I'll be ready to try and make one from scratch. It would be really helpful if the OP2Mapper could place the default celltype for each tile as you place the tile. Maybe a checkbox to turn this function off if you are intentionally messing up the celltypes. It would also save a lot of time to have some help with placing transition tiles (like between sand and lava rock), but this problem seems a lot harder to solve then matching tiles with cell types.

Any guesses on which map it came from?



I've got the guts of the scenario programmed. Things like day/night, fixed morale, victory and defeat conditions, Modal dialog for scenario briefing, starting convoy vehicles and locations, and travel waypoints for the AI controlled evacuation convoy.

I've added some triggers for inserting enemy units along the route and placing some pre-existing enemy units on patrol. I have a plan for how to scale the difficulty without too much trouble. I want to add in more patrols/ambushes then required and then randomly select from the superset for what appears each time the game is played. Work on testing/tweaking the strength of the established enemy ambushes and patrols is needed to make sure they are within the right ballpark for difficulty.
« Last Edit: December 13, 2016, 09:43:09 PM by Vagabond »

Offline Arklon

  • Administrator
  • Hero Member
  • *****
  • Posts: 1269
Re: Unit Only Multiplayer Missions
« Reply #4 on: December 14, 2016, 12:03:16 AM »
I have a final draft of the map for this scenario. See below. I updated to the newer version of the OP2Mapper, version 2.2.1. Only problem is for the minimap this version makes the orangish colored sand tiles blue on the minimap. I'm assuming this happens to other people as well?
That's weird. I've not had that problem on XP or Windows 7.

Quote
Any guesses on which map it came from?
Plymouth mission 12.

Offline Vagabond

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1015
Re: Unit Only Multiplayer Missions
« Reply #5 on: December 14, 2016, 03:12:49 AM »
Yup,

Plymouth 12. I'm using Windows 7. I'll try uninstalling and reinstalling the mapper and see what that does.

Offline leeor_net

  • Administrator
  • Hero Member
  • *****
  • Posts: 2352
  • OPHD Lead Developer
    • LairWorks Entertainment
Re: Unit Only Multiplayer Missions
« Reply #6 on: December 14, 2016, 10:31:29 AM »
I vaguely remember seeing someone mention that before.

As far as updating the mapper, it was developed in VB6. I couldn't find any torrents to make a few adjustments to it, tried to rewrite it in VB.Net and thoroughly failed. I really don't know Win32 GUI programming at all so I'm pretty helpless when it comes to doing something like a map editor like that.

I've thought about doing a full-screen map editor using one of my current tile map editors as a base... but BlackBox mentioned something about doing it in-game. Don't know if that's a pipe dream or a future planned thing or in the works or whatever. Maybe I'll try my hand and putting together something that works for the time being. I had some thoughts about how to write out map files without needing to store the tile group elements in the maps themselves... but I'd have to figure out the binary map format. I don't think it's that complex, I just need to take the time to figure it out.

After the first of the year I think.

But to put something into perspective:


This is an editor I put together for an RPG project but can be easily tailored to Outpost 2's map style. The map format I have for the game has four map 'layers'. Outpost 2 has no such concept so that can be immediately simplified. It ought to be pretty simple to come up with a terrain type automatically set based on tile that can be fine tuned later by the user.

There is a 'flood fill' tool that fills the entire map with a given selection and a 'stamp' tool that places down a set of tiles as selected from the tile palette. There is no 'auto terrain' tool but that's just a matter of figuring out the basic math for that and then setting up a lookup to get the correct index for different transitions.

Anyway, point being if anybody is interested in helping to flesh out a new map editor that can make it easier to build new maps from scratch I can make the necessary modifications to this code and upload to a new project directory.

On that note, I think I've way hijacked this thread so if there's interest we can open a new thread about it.
« Last Edit: December 15, 2016, 12:29:20 PM by leeor_net »

Offline Vagabond

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1015
Re: Unit Only Multiplayer Missions
« Reply #7 on: December 15, 2016, 10:57:55 AM »
Removing and reinstalling the map editor fixed the weird issue with the bluish terrain.

Leeor, very impressive hijack of the thread. That is a polished looking map editor. I think it looks great. When I was still learning C# (well who I am kidding, I still have a lot more to learn) I made an effort at making a 2D tiled map maker and it wasn't easy. Two of the four pics are of the same part of the map editor, so I think maybe you made a typo in the html addresses?

Anyways, back on subject. I pushed the current version of RescueEscort into the repository. It now builds both the single and multiplayer versions and dumps them both into the Outpost 2 folder along with their map and tech tree files through post build events. Everything is compiling but I'm short on testing right now. Most of the scenario guts are in the project RescueEscortCore. The project RescueEscort contains the code for the modal dialog for mission briefing and tells RescueEscortCore to build for single player. RescueEscortMultiplayer tells it to build for multiplayer instead. Seems like a decent setup. If other scenarios lend themselves to both a single and multiplayer version, it might serve as a nice template. I think this is the right way to build it all from a maintenance standpoint.

Before getting the multiplayer project merged, I put some time into debugging/tweaking the enemy fight groups. They still need a lot more tweaking though.

Offline Vagabond

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1015
Re: Unit Only Multiplayer Missions
« Reply #8 on: December 16, 2016, 08:14:36 AM »
I'm having trouble setting up the AI player in multiplayer. The AI's units are appearing as white dots on the mini-map and occasionally fight each other. So I think I'm not properly initializing the AI player. I don't see how to do that using the established macro ExportLevelDestailsEx.

I'm looking to have 2 humans and 1 AI. I found the following post by Hooman long ago, but it didn't make total sense to me: http://forum.outpost2.net/index.php/topic,4273.msg64668.html#msg64668.

I am trying to figure out if the AI player's color is randomly set to a color not taken by one of the 2 human players or if I have to manually set it, but I'm having trouble testing it out.

Anyways, here is the gist of the code I have so far. InitializeScenario is called from InitProc().
Code: [Select]
/*#define ExportLevelDetailsEx(levelDesc, mapName, techTreeName, missionType, numPlayers, maxTechLevel, bUnitOnlyMission)*/

ExportLevelDetailsEx("2P, Convoy, 'Rescue Escort'", "RescueEscort.map", "PursuedTechTree.txt", MissionTypes::MultiLandRush, 3, 12, true);

void InitializeScenario(bool multiplayer)
{
        ... [Other code]

Player[Player0].GoHuman();
Player[Player0].GoPlymouth();

if (!multiplayer)
{
Player[Player0].SetColorNumber(PlayerColor::PlayerRed);
}

Player[Player1].GoPlymouth();

if (multiplayer)
{
Player[Player1].GoHuman();
}
else
{
Player[Player1].SetColorNumber(PlayerColor::PlayerGreen);
Player[Player1].GoAI();
}

Player[Player2].GoEden();
Player[Player2].GoAI();
if (!multiplayer)
{
Player[Player2].SetColorNumber(PlayerColor::PlayerBlue);
}

Player[Player0].AllyWith(Player1);
Player[Player1].AllyWith(Player0);

        ... [Other Code]
}
« Last Edit: December 16, 2016, 08:44:29 AM by leeor_net »

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
Re: Unit Only Multiplayer Missions
« Reply #9 on: December 16, 2016, 03:18:11 PM »
AIs take colors that aren't available in order - blue, red, green, yellow, cyan, magenta, black.

You should be able to initialize the AI player(s) with this:
Code: [Select]
SCRIPT_API SDescBlockEx DescBlockEx = { 1, 0, 0, 0, 0, 0, 0, 0 };
This will initialize one AI player.  You can change more 0's to 1's to add more.  So for example if you wanted two AIs, you'd do this:
Code: [Select]
SCRIPT_API SDescBlockEx DescBlockEx = { 1, 1, 0, 0, 0, 0, 0, 0 };

Just paste it in under the regular DescBlock.
"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: Unit Only Multiplayer Missions
« Reply #10 on: December 16, 2016, 04:27:48 PM »
AIs take colors that aren't available in order - blue, red, green, yellow, cyan, magenta, black.

You should be able to initialize the AI player(s) with this:
Code: [Select]
SCRIPT_API SDescBlockEx DescBlockEx = { 1, 0, 0, 0, 0, 0, 0, 0 };
This will initialize one AI player.  You can change more 0's to 1's to add more.  So for example if you wanted two AIs, you'd do this:
Code: [Select]
SCRIPT_API SDescBlockEx DescBlockEx = { 1, 1, 0, 0, 0, 0, 0, 0 };

Just paste it in under the regular DescBlock.

Nope, only DescBlockEx[0] does anything, so for 2 AIs it's:
Code: [Select]
SCRIPT_API SDescBlockEx DescBlockEx = { 2, 0, 0, 0, 0, 0, 0, 0 };

Offline Vagabond

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1015
Re: Unit Only Multiplayer Missions
« Reply #11 on: December 17, 2016, 11:47:06 AM »
Sirbomber & Arklon,

Thanks for the help! The AI is behaving properly with that code snippet added. Now I see where it was covered one of Sirbomber's later tutorials. I should have researched a little longer.

For single player I've designed the scenario to play with Plymouth for the human player. I plan to balance the game this way, but in a multiplayer scenario, you expect to be able to choose between Eden and Plymouth. So I should probably make the convoys initialize as either Plymouth or Eden based on input. Hopefully that doesn't affect gameplay balance too much. Since I'm setting initial tech (like grenade loading mechanism) I'll need to think through setting different researched techs in the multiplayer version based on which faction is chosen.

I also realized the evacuation ConVecs probably need to be filled with actual structure kits. When AI controlled it doesn't matter, but when human controlled it would be a bit silly to be evacuating without the structure kits loaded.

As always, more complicated then I first thought.

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
Re: Unit Only Multiplayer Missions
« Reply #12 on: December 17, 2016, 02:55:20 PM »
I also realized the evacuation ConVecs probably need to be filled with actual structure kits. When AI controlled it doesn't matter, but when human controlled it would be a bit silly to be evacuating without the structure kits loaded.

That sounds like a great idea until someone like Arklon plays and his opening move is deploying Command Centers for no reason (and probably failing the mission).
"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 leeor_net

  • Administrator
  • Hero Member
  • *****
  • Posts: 2352
  • OPHD Lead Developer
    • LairWorks Entertainment
Re: Unit Only Multiplayer Missions
« Reply #13 on: December 20, 2016, 08:48:48 AM »
Ah yes, the sort of thing I would do too.

Offline dave_erald

  • Sr. Member
  • ****
  • Posts: 262
Re: Unit Only Multiplayer Missions
« Reply #14 on: December 20, 2016, 02:25:36 PM »
I did that in one of Vaga's other missions. All my units just up and drove off and the mission ended. "Where ya goin? I'm just setting up base. Fine than, piss on you guys..."
-David R.V.

-GMT400 fan
-OPU Influencer

Offline Vagabond

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1015
Re: Unit Only Multiplayer Missions
« Reply #15 on: December 21, 2016, 09:43:17 AM »
That sounds like a great idea until someone like Arklon plays and his opening move is deploying Command Centers for no reason (and probably failing the mission).

I finished putting the structure kits in the Convecs. And now you fail the scenario if any structures are built.  Although since you have 0 people, it doesn't really advance your cause to build them in the first place.

I did that in one of Vaga's other missions. All my units just up and drove off and the mission ended. "Where ya goin? I'm just setting up base. Fine than, piss on you guys..."

Yeah, I realized that I've made 2 mission where you have to evacuate with convoys and 1 where you have to evacuate in a starship. So evacuation is definitely a recurring theme. This one follows the trend.



When playing multiplayer, the scenario now builds the convoys to match if you select Eden or Plymouth for your colony. I wrote up a quick function that randomizes the AIs color and ensures it is not set to one of the players' colors. It relies on HFL. You can also turn night on in multiplayer, but the night never transitions back to day. It is designed for daytime play though (no built in lights out sneak attacks).

I made the scenario more random. Now one surprise attack and one fixed patrol will be randomly selected and not be present each play through. The turrets on attacking units will be randomly selected from pre-built lists. So you might get a bunch of Thors attacking first one round and a mix of Rail Gun/EMPs attacking first the next play-through, etc. Also, whether attacking tank squadrons are lynx or panther is randomly selected except where they need to be set one way or the other for unit speeds to make sense. Each squadron of enemy units that initially start on the map will randomly choose whether they start in a patrol or spread out in a guarded rectangle position. Hopefully that will create some replayability. Some of the variables could make the mission a little easier or more difficult to play through.

I still need to finish defining the patrol routes and guard rects for the starting enemy units, but this should be easy. I want to make the single player AI evacuation convoy a little smarter with how it uses its tanks to defend itself. It will still be pretty rudimentary though. The mission briefing/storyline needs proof-read and cleaned up. Then should be final testing for difficulty.

The storyline has the evacuation convoy traveling to the rescuers' base, so it doesn't really matter if vital vehicles are destroyed like the ConVec carrying the CC. Current victory condition is getting 70% of the non-combat units to the final waypoint and 3 out of 4 of the evacuation transports. If you don't read the storyline and play the multiplayer version, it won't make sense why you don't lose when your ConVec with a CC is destroyed, but I think this is better then trying to define losing conditions based on all the different combinations of vehicles you could lose and no longer be able to sustain a new base.

That reminds me, maybe I should make a failure condition if you decide to dump your truck cargo or your structure kits.