Author Topic: Civilian Industries  (Read 29605 times)

Offline StarKeep

  • Jr. Member Mark II
  • **
  • Posts: 79
Civilian Industries
« on: May 21, 2019, 06:50:30 pm »
Civilian Industries
Trade Wars

Every empire is only as strong as the people within. Protect your people, and they will help your empire flourish. From collecting and processing various resource around the galaxy to bolster the economy, to taking up arms on their own to aid your survival, you'll find their help invaluable in the long term. As they flourish, so do you.


Distributed with the game, check Game Options

Feature List:

Trade Stations
  • Trade Stations will build as you expand, and civilian ships will ferry resources between them.
  • Each trade station produces one random ship producing resource upon creation, and each unique resource allows every one of your militia buildings to build a brand new unit.
Militia Outposts
  • When Trade Stations feel threatened, they will send protections requests back towards the Grand Station.
  • The Grand Station will keep outputting various Militia Capital Ships that fulfill these protection requests.
  • Upon having their request answered, a requested ship will attempt to find a fairly dependable location between the trade post and a hostile wormhole on the planet to set up at.
  • As resource requests are filled, they will build turrets to further fortify the planet.
Patrol Posts
  • When a planet has all wormholes covered by Militia Outposts, newly arriving ships will instead turn into Patrol Posts.
  • Like Outposts, these Barracks request resources to build defense. Unlike Outposts however, these build mobile military fleets.
  • These fleets will actively move to defend planets from threat.
  • If all of their friendly adjacent planets are protected, they will attempt to raid hostile planets on their own, or alongside you.
  • They are not a proper military. They are here to protect their homes, and will only ever move to planets adjacent to their own.
  • Their count is limited by the number of mines on each planet.
Protectors
  • When a planet has finished building all possible Outposts and Patrol Posts, it will than send out a request for an Advanced Civilian Shipyard.
  • These Shipyards are used to produce extremely powerful, but extremely expensive, Protector units.
  • Each Shipyard is capable of building one Protector per resource type delivered.
Militia Barracks
  • Large scale construction for the player. Requires an investment of 5 million metal, and a constant upkeep of 100k energy.
  • Acts as a organization hub for local militia forces, increasing the ship and turret count of all bases on its, and all adjacent, planets.
  • Can build up to 3 per planet, and it stacks with itself. The more you build, the more potent you'll find your Militia becoming.
Battlestation Expansion
  • Each Battlestation you control is capable of building Trade Ports, Militia Headquarters, and Militia Protector Shipyards on any planet, friendly or otherwise.
  • The Trade Port acts like a less effective but tankier Trade Station, allowing you to either beef up the economy on specific planets or setup stations in secure neutral zones.
  • The Militia Headquarters turns your Battlestation into a command cruiser. All units built at the Militia Headquarters will treat the Battlestation as their patrol post.
  • The Militia Protector Shipyards acts like a Militia HQ, but builds Protectors instead of regular ships.
  • Combined with the HQ's vastly increased ship capacity, and vastly reduced ship cost, this turns your Battlestations into potent sources of power by mid to late game, assuming you set them up correctly.
Wormhole Raids
  • Be warned. The ai has new tools to deal with your rapid economic expansion. Expect a multitude of raids on your trade lines as you expand.
  • As the game progresses, these will get more and more dangerous. Your Civilians may be able to defend themselves normally, but these will test even the toughest of defensive setups.
Faction Settings
  • Various settings for parts of the mod can be found in their own section in the Galaxy-Wide Settings menu.

Protectors
The Crackerjack Protector
-Raid Frigate with a damage bonus against all targets that have been on the planet for less than a minute.

The Thunderstrike Protector
-Siege Frigate with vastly increased hit radius and knockback on hit.

The Paladin Protector
-Suppressor with a powerful bubble shield and self sustain.

The Brick Breaker Protector
-Assault Frigate that is an expert at dealing with large, heavily armored, targets.

The Hurricane Protector
-Sniper Frigate that has a large radius Gravity Generator and can hit multiple targets at once.

The Excalibur Protector
-Melee Frigate that has a large number of close ranged tractor beams and takes less damage from distant targets.

The Grim Reaper Protector
-Raid Frigate that is excellent at absorbing the life force from weak ships to power itself.

The Wildfire Protector
-Frigate that fires off slow moving grenades at targets across the planet.

The Tangler Protector
-Warbird Frigate that can zip around the battlefield, vaporizing fast moving targets and paralyzing the rest.

The Orchestrator Protector
-Carrier Frigate that spawns decoy drones, grants planet wide Tachyon Coverage, and boosts the speed of all allied ships on its planet.
« Last Edit: September 04, 2020, 11:05:22 pm by StarKeep »

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: Player Trains - A Player Aligned Special Faction
« Reply #1 on: May 21, 2019, 09:51:28 pm »
This is super cool!  I absolutely love having a mobile economy like this, where there are supply lines that might cause you to not get some metal if you don't defend them, etc.  I look forward to seeing what folks think of it as they test it out.  If it's something that seems solid, then I could see this as an added option in the lobby or something.  Not sure if needs to be its own faction, I haven't looked into the details.  But the description is killer.
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline StarKeep

  • Jr. Member Mark II
  • **
  • Posts: 79
Re: Player Trains - A Player Aligned Special Faction
« Reply #2 on: May 21, 2019, 11:55:30 pm »
Chris himself posted! I'm going to take that as further inspiration to keep going with this.  ;)

If its possible to have units be aligned with a player, while not being controllable, it could be done without being its own faction. But I'm brand new and had no idea how to go that route, hah. Was far simpler to just see how other factions work, and stick this thing together as a result. Was a learning experience, even if it took 5 full recodes to get it into its current state.

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: Player Trains - A Player Aligned Special Faction
« Reply #3 on: May 22, 2019, 04:30:12 pm »
Cheers!  In that regard, going with your own faction is by far the best choice.  That's what they are made for, and there's no real "cost" to having an extra faction when it's just living on existing planets anyhow.  The main "cost" to factions is if they require planets of their own, small galaxies might not have enough room.  But even things like the mercenaries are their own faction, because we want them to have their own AI and not be controllable by the player, for instance.

Badger did mention that you're using the C# Random class, which is something that I realized you would have absolutely no way to know not to do.  You and every other modder out there.  So I figured I would write up a little guide on how to avoid desyncs, and some of the pros and cons of a few approaches.  It should be useful for a lot of people, hopefully, if modding takes off: https://forums.arcengames.com/ai-war-ii-modding/quick-tips-for-how-to-avoid-multiplayer-desyncs-from-your-modding-code/
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline StarKeep

  • Jr. Member Mark II
  • **
  • Posts: 79
Re: Player Trains - A Player Aligned Special Faction
« Reply #4 on: May 23, 2019, 03:26:55 am »
Update! Source Code: https://hastebin.com/ovipegeked.cpp
(Will post source code now and than so people who don't frequent the discord can also enjoy browsing my absolutely perfect code.)

Contains no new content, but contains a bunch of tweaks and utility!

Utility:

Ingame:

Dynamic descriptions. Actually see whats happening!
Start station: Lists all train lines, along with capacity, build timers, number of ships in its train, and if its currently running or building.
End station: Lists capacity, build timer, number of ships in its train, and if its currently running or building.
Train ship: See if its currently part of a line, or idling around like a lazy bugger.
Reward stations: Lists precise numbers for the number of ships required for things to occur. (Aka, number of ships until next reward or upgrade.)

Outgame:

Added in a new external constants xml file. This allows both myself, and any of you who download this, to modify various values for the reward stations in games. If you want to set the turret cap per planet to 9 million and crash your game, by all means. (Please note, you will not actually crash your game.)
Will, of course, be updated as new reward stations are added.


Code:

Moved everything not related to game commands out of DoLongRangePlanning to help against potential desyncs in the future. (This was a pain, and the code is somewhat messy, but I think its understandable enough in how it works to not require a brand new recode to reorder it from scratch.)
Removed the use of local random number generation. (Didn't swap to Context random, but rather entirely redid how turrets upgrade themself with thanks to Badger.)
I stuck assault ri- *cough* I put in a bunch of sanity checks in various locations to hopefully nip any future bugs in the bud.
Fixed a bug where train cars would start stacking, and the train lines would start crashing the game in fear of all their goods going missing.

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: Player Trains - A Player Aligned Special Faction
« Reply #5 on: May 23, 2019, 08:30:27 am »
Awesome stuff!!  Have not looked at it in detail yet, but I love hearing about that sort of thing.  Gives me a vibe somewhere between games like Cities in Motion or Cities: Skylines, and the trade caravels and caravans in Age of Empires 1 (boy that was long ago).

I remember having to babysit those trade routes (from attackers) as an optional thing being both fun and frustrating depending on the circumstances.  I can see why they did away with them in later AOE games, but I feel like something was lost there.  When it's looked at entirely as a value-added amount of income and isn't something your economy is completely dependent on, then I think it's really a cool dynamic to have in play.
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline StarKeep

  • Jr. Member Mark II
  • **
  • Posts: 79
Re: Player Trains - A Player Aligned Special Faction
« Reply #6 on: June 19, 2019, 10:22:09 pm »
Update for anybody who is/was interested in this mod.

Its still in production! I'm in the process of a large overhaul (hopefully one of the last ones this time) that implements minerals and actual fleet usage into the mod.

Its a fairly large process, but the fleet mechanic really, REALLY helps performance, and allows me much more freedom when it comes to just what I can do.
The minerals, on the other hand, allow me to do more interesting things in the long term (such as eventually allowing you to actually buy stuff from them if you build up their economy enough, as one example.)

Combined with learning both COBOL and Java in college as well, I'm... slow going. So I apologize for anybody who picked up the (somewhat unstable) early version.

Offline ArnaudB

  • Jr. Member Mark II
  • **
  • Posts: 76
Re: Player Trains - A Player Aligned Special Faction
« Reply #7 on: October 17, 2019, 07:36:19 am »
I have wanting to try the mod and I had a (unsurprisingly) error in the log. Not a big thing to solve, it just lacks experience values for the units:

Code: [Select]
10/17/2019 1:31:34 PM EXPToGrantOnDeath: was 0 for StationStart.  It should either be set to a positive value (to give EXP), or to -1 (to indicate no EXP is granted).
10/17/2019 1:31:34 PM EXPToGrantOnDeath: was 0 for StationEnd.  It should either be set to a positive value (to give EXP), or to -1 (to indicate no EXP is granted).
10/17/2019 1:31:34 PM EXPToGrantOnDeath: was 0 for Train Ship.  It should either be set to a positive value (to give EXP), or to -1 (to indicate no EXP is granted).
10/17/2019 1:31:34 PM EXPToGrantOnDeath: was 0 for TrainYard.  It should either be set to a positive value (to give EXP), or to -1 (to indicate no EXP is granted).
10/17/2019 1:31:34 PM EXPToGrantOnDeath: was 0 for MilitiaMiner.  It should either be set to a positive value (to give EXP), or to -1 (to indicate no EXP is granted).
10/17/2019 1:31:34 PM Errors in reading GameEntityTypeDataTable
StationStart: is missing int attribute exp_to_grant_on_death
StationEnd: is missing int attribute exp_to_grant_on_death
Train Ship: is missing int attribute exp_to_grant_on_death
TrainYard: is missing int attribute exp_to_grant_on_death
MilitiaMiner: is missing int attribute exp_to_grant_on_death

Haven't tested the mod yet, the error showed up at startup. I'll see how it goes.

Offline StarKeep

  • Jr. Member Mark II
  • **
  • Posts: 79
Re: Civilian Industries
« Reply #8 on: November 26, 2019, 11:03:56 pm »
Civilian Industries
Beta Edition
Commerce must flow

Download: https://drive.google.com/open?id=14JCLZ_1l-gMVpeX5eR-YEi4i_F82yCPM
Note: You can safely ignore the error on the main menu related to the xmlmod table. It is a harmless error.

A long time coming, I present to you the initial version of the Civilian Industries mod, a reworked variant of Player Trains.

Currently contains the following:

A functional autonomously active trade system.
  • Trade Stations will build as you expand, and civilian ships will ferry resources between them.
  • Currently contains two resources: Goods and Metal.
  • Is fully forward compatible. New resources can be added to later versions with ease.
A functional militia system.
  • When Trade Stations feel threatened, they will request the aid of various militia fleets.
  • On arrival, military ships will find a valid location to convert into a Military outpost, and begin sending metal requests.
  • As requests are filled, they will build turrets to guard the planet.
  • If all hostile wormholes are covered by an outpost, they will simply hang around on the planet, attacking forces that arrive. (Additional features for this part of the militia are planned.)

And... thats it for this version. Its built specifically to allow me to expand it easily in the future this time however, so no more full recoding at least.

Later intentions:
Resources based on capturables on the planet.
Buildings that convert said resources into goodies.
Ship and Outpost variations.

Offline StarKeep

  • Jr. Member Mark II
  • **
  • Posts: 79
Re: Civilian Industries
« Reply #9 on: November 28, 2019, 02:06:50 am »
Updated
Arrival of Barracks
Added Militia Barracks, which request resources to build friendly VWings to patrol the planet.
Militia Barracks only spawn if all hostile wormholes on the planet have been covered by an Outpost.

Added an Intensity slider.
Changes spawn rate and build costs.

Militia ships now mark up as you gain AIP.
Militia Outposts now deploy closer to your command station.
Militia Ships are now sent back to the idle pool if their destination target becomes invalid, just like cargo ships.
Cargo Ships should be less likely to all group around the same few stations.

Next Goals:
Move Mark/Capacity away from AIP scaling and instead rely on capturables.
Set up some (basic) raiding logic for Barracks-spawnt units.

Offline StarKeep

  • Jr. Member Mark II
  • **
  • Posts: 79
Re: Civilian Industries
« Reply #10 on: November 30, 2019, 06:44:17 am »
Updated
Trade Wars
Updated Threat Logic, Add More Resources
New Save Required

Further trade logic improvements.
Now uses a form of a Supply and Demand ticket system instead of the previous free-form supply and demand style.
Militia Buildings now drain resources to produce ships instead of immediately spending all of their resources the moment they have enough.
Removed the Grand Station resource drain mechanic.
Will have ways to directly profit off of their resources elsewhere.

Revamped the threat code.
Barracks-spawnt fleets will now attempt to defend and raid adjacent planets.

Civilians will build more stations than before.
Intensity Slider now influences the number of buildings that the Civilians build in response to hostile threat, among other things.

Ships spawnt by Militia Buildings will self-destruct if their home building is destroyed.

Trade Stations now get a random resource upon being built.
Added 3 more resources, with 3 more ships and turrets buildable as a result.
Grand Station now has an actual infinite supply of Goods.

Fixed some Null exceptions in relation to stations dying mid resource transfer.
Shrunk ths size of Cargo Ships now that they're more numerous.

Offline StarKeep

  • Jr. Member Mark II
  • **
  • Posts: 79
Re: Civilian Industries
« Reply #11 on: November 30, 2019, 04:34:47 pm »
Mini Update

Don't push updates when you're sleep deprived kids.

Fixed trade ships spending way too much time hanging around the grand station.

Fixed Militia Ships being way too scared to ever attack.

Fixed Militia Ships stacking with Ships from other Militia Fleets, resulting in ship counts being incorrect. (Thanks to Badger³ for pointing out the fix.)
« Last Edit: November 30, 2019, 05:19:46 pm by StarKeep »

Offline ArnaudB

  • Jr. Member Mark II
  • **
  • Posts: 76
Re: Civilian Industries
« Reply #12 on: December 28, 2019, 06:02:09 am »
Some feedback on the mod since I had the opportunity to play with it.

It makes defenses easier especially in the early game. It also heavily encourage linked empires with a single AI planet between player-held planets so that cargo ships can stay in protected space. Fostering such linked empires rather than the more spread empire is a big point of attraction from the mod.

I do find it annoying that you MUST have a cleared path to the homeworld for every planet, or cargo ships will suicide trying to get to distant outposts. It can really hurt. I also find disappointing that multiple distant planets cannot support each other in any way, where trade is concerned. It'd be a lot more interesting to be able to make secondary stations for goods, rather than just the homeworld.

I don't find the balance too bad versus the AI. In low-AIP games (and diff below 8/9) the civilian army will help crush the waves, allowing for a more offensive playstyle than usual, which really help getting into the higher AIP encouraged by creating an interconnected empire. Bigger-scale attacks can get through civilians defenses. A bit more testing might be required, but work on performance would alter the balance anyway, so that's for later.

Performance is where the mod really hurts. When using a "kamikaze" hunter fleet with Astro trains running around, the constant shifting of civilians ships will ground the simulation to a halt. I managed to drop to 26% simulation speed at x10 speed, with no Nanocaust or other minor faction running around.
The why is pretty evident. You can end up with hundreds of cargo ships running around near-empty or straight up empty. Civilian fleets numbering in the thousands ships isn't rare at all (6000+ ships). Factories buildings pop up at a count between 15-20 per planet despite each only having two shiplines.
I understand the perspective of keeping civilian ships at mark between I and III for thematic reasons. For performance reasons however I'd recommend to throw away that approach and have them lag one Mark behind the player, then limit their numbers. Maybe the civilians could be given more frigates since the ship-cap for those is much lower. (It might also help since otherwise the player can draw the AI fleets' ire with their own fleets and leave the civilian bombard the AI with 3000+ Mark I snipers unchallenged).

I like the civilian military outposts (the mini fortresses). It really gives the civilian forces character rather than just having turrets.
« Last Edit: December 28, 2019, 06:04:42 am by ArnaudB »

Offline StarKeep

  • Jr. Member Mark II
  • **
  • Posts: 79
Re: Civilian Industries
« Reply #13 on: January 06, 2020, 07:57:07 pm »
Yeah the unit count and resource thing is great in theory, and good in low count practice, but is real hard to scale. People who get it working for entire galaxies are wizards.
After the trial run of them, a mission based system may be the only feasible way to do a larger scale, performance friendly style. (Akin to the AI Astro Train system.)

On Hiatus while I do some major catch-up and sanity-checking in college (again), but I'm glad you got some enjoyment out of them.

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: Civilian Industries
« Reply #14 on: January 08, 2020, 05:08:32 pm »
Quick note, this will need to be recompiled with some very minor changes (just what you find errors in VS) to work properly in the new builds of the game.  I renamed a lot of the hooks to be a lot more clear, and that causes this to not compile properly anymore.  Sorry about that!  I know you have a lot of other things going on.
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

 

SMF spam blocked by CleanTalk