Author Topic: Dyson Sphere tweaks  (Read 22480 times)

Offline BadgerBadger

  • Arcen Volunteer
  • Hero Member Mark III
  • *****
  • Posts: 1,229
  • BadgerBadgerBadgerBadger
Dyson Sphere tweaks
« on: October 13, 2017, 09:49:53 pm »
I'm playing an 8.6/8.6 game with an 8/10 Dyson Sphere game in my free time, and I'm reminded that one of the fun aspects of the Dyson Sphere was that until you aided it, the Dyson Sphere was being held off by its starting planet. But once you defeated the AI Guards of the planet it felt like it got stronger and started to help you more. There was basically no sense of the Dyson Sphere as a menace to you (except with the Antagonizer).

Now, right now the Dyson Sphere can just overwhelm half the galaxy. It continually spawns Mark V guardians, and it will readily destroy everything in its path (unless it's on a Mark IV world, in which case the defenses of the planet will just kill the sphere).

There's also a bug that causes the Dyson Sphere to periodically kill Planetary Controllers.

Keith (and everyone else), what sort of vision do people have for the Dyson Sphere? I really like the notion of a powerful human resource on the map that feels like it's restrained until you defeat a certain planet. Once you defeat that planet, it feels like it helps spread your influence, both by patrolling your planets and by sometimes attacking nearby foes. It feels like it plays very much as a human ally (except when the Dyson Antagonizer shows up, which adds a really fun achilles heal to the resource).

But I recognize that others may have other exciting ideas. I think it would be good to have a clear discussion of what is intended so we can start working on balance for the Dyson Sphere. I am currently tempted to try making the Sphere itself invulnerable to the AI and also make it spawn fleetships instead of guardians (we can make sure the fleetships go out in groups so they aren't always destroyed immediately), but I want to make sure I have some sense of the eventual gameplay intent so I don't waste time.

PS if the chosen ideas are too different from the Tradtional Dyson Sphere, I intend to reimplement the Traditional one and give it a new name. I really like it as a gameplay element.

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Dyson Sphere tweaks
« Reply #1 on: October 13, 2017, 09:54:23 pm »
Yea, the current AIW2 implementation is functional, but not at all balanced.

I'll get to it eventually, but in the meantime if you or anyone else feels like adjusting it (in whatever way seems best; different spawn rates, different spawned entities, etc) to be closer to the 4/10 behavior on AIWC, I'm happy to incorporate that work. Then we can work on different intensities.

On the subject of faction intensities, I'm thinking in AIW2 it will be better to have custom fields like you implemented for map types. Most factions should be fine with a single scalar slider, but others may benefit from more than one axis of customization.
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 BadgerBadger

  • Arcen Volunteer
  • Hero Member Mark III
  • *****
  • Posts: 1,229
  • BadgerBadgerBadgerBadger
Re: Dyson Sphere tweaks
« Reply #2 on: October 13, 2017, 10:08:44 pm »
I'll race you. If you can make Multiplayer functional and give us different sorts of AIs to choose between then before I finish a solid first pass at balancing the Dyson Sphere then I'll also take a first pass a Conduct that will give balance sliders for all the Factions. ;-)

Offline Draco18s

  • Resident Velociraptor
  • Core Member Mark V
  • *****
  • Posts: 4,251
Re: Dyson Sphere tweaks
« Reply #3 on: October 14, 2017, 01:03:25 am »
Get some baseline personalities in and I'll build some more. ;)

Offline BadgerBadger

  • Arcen Volunteer
  • Hero Member Mark III
  • *****
  • Posts: 1,229
  • BadgerBadgerBadgerBadger
Re: Dyson Sphere tweaks
« Reply #4 on: October 16, 2017, 12:24:08 pm »
Also, the Dyson Sphere really needs to have its collision radius tweaked, and ideally to be placed on the edge of the planet gravity well. I suspect this may require tweaking Mapgen_SeedSpecialEntities which is not in external code.

The ships the Dyson Sphere spawn appear inside the Dyson Sphere and can fly around in there. I zoomed in so that the camera wound up inside the Dyson Sphere (which is weird) and I can see the spawns. I don't know of a mechanism to change this in external code. I tried playing with a number of the XML fields to no avail.

Here is a picture (note that the Dyson Sphere is spawning fleetships instead of guardians, I was messing with the balance settings).
« Last Edit: October 16, 2017, 07:42:40 pm by BadgerBadger »

Offline BadgerBadger

  • Arcen Volunteer
  • Hero Member Mark III
  • *****
  • Posts: 1,229
  • BadgerBadgerBadgerBadger
Re: Dyson Sphere tweaks
« Reply #5 on: October 16, 2017, 11:10:39 pm »
I first wanted to get the Dyson Sphere to approximate the AIWC behaviour before I tried to really balance it.

Here's what I have for behaviour.

Dyson Sphere ships will stay on a planet set to "Attacker" until the Hostile Mobile strength on the planet is below Threshold. If a Dyson Sphere ship is on a planet where it's not in combat then it will Patrol for a certain amount of time (currently about a minute). Once it's done patrolling then the ship will pick a new planet to go to according to the following rules.

If there are any Friendly planets (ie a planet owned by a Friendly faction) under attack adjacent to this planet then always go to one of the planets being attacked. If there are no Friendly planets under attack, go to a random friendly planet X% of the time (currently X is 80).

If that doesn't happen (ie if there are no Friendly planets or there are friendly planets but we don't want to go to one of those), check if there are any adjacent planets whose enemy strength is below Threshold. If so, go to one of those Y% of the time (currently Y is 80).
If none of the above conditions are hit then pick a planet at random.

I feel like this will give a rough approximation of Dyson Sphere behaviour from AIWC. Still todo: implement Dyson Antagonizer behaviour. The above is implemented and does not crash, though I won't post it till I've also taken a stab at balance.


A few additional questions. For being able to tune faction intensity, should I look to add an Intensity factor in External Code attached to a Faction? Or would it make more sense to have that be part of the Faction class itself? This is a code architecture question so I leave it to you, either way is fine by me.

I have trouble with getting the patrol behaviour I want. I don't see a good mechanism for telling a ship to "wander around a planet". I tried the following with both Guardians and Fleetships but it doesn't seem to work.
Code: [Select]
                        entity.EntitySpecificOrders.Behavior = EntityBehaviorType.Guard_Guardian_Patrolling;                                                                                 

Finally, would you prefer factions to use the buildingDronesInternally functionality or to spawn units directly in the C# code? Either one will work (though using buildingDronesInternally may require multiple XML entries for Dyson Spheres at different Intensity levels). Or some combination could be done.

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Dyson Sphere tweaks
« Reply #6 on: October 17, 2017, 09:39:46 am »
If there are any Friendly planets (ie a planet owned by a Friendly faction) under attack adjacent to this planet then always go to one of the planets being attacked. If there are no Friendly planets under attack, go to a random friendly planet X% of the time (currently X is 80).
Does this work regardless of the Dyson's alignment? I.e. it will move to defend an AI planet that you are attacking, if it is friendly to the AI at the time? If so, awesome :) I'm not sure that it would be a real case under the rules as they stand (Dyson is only AI-ally if you own the Dyson's planet, so most of its stuff would be focused on freeing itself) but it's a good sort of emergent behavior.

Quote
Still todo: implement Dyson Antagonizer behaviour.
I wouldn't worry about that for now.

Quote
A few additional questions. For being able to tune faction intensity, should I look to add an Intensity factor in External Code attached to a Faction? Or would it make more sense to have that be part of the Faction class itself? This is a code architecture question so I leave it to you, either way is fine by me.
I'm currently working on the architecture for faction-specific per-faction settings like AIType, and intensity would go there too. I hope to have it released within 8 hours.

Quote
I have trouble with getting the patrol behaviour I want. I don't see a good mechanism for telling a ship to "wander around a planet". I tried the following with both Guardians and Fleetships but it doesn't seem to work.
Code: [Select]
                        entity.EntitySpecificOrders.Behavior = EntityBehaviorType.Guard_Guardian_Patrolling;                                                                                 
Right now there may be no EntityBehaviorType setting that does what you want. There are two general solutions to that:
1) Add more EntityBehaviorType possibilities. Maybe even move EntityBehaviorType from a hardcoded enum in Core to an xml-table in External. I think the latter is ultimately the way of the future.
2) For anything not human-controlled, you don't strictly need behaviors, you can just issue orders (GameCommand objects) from the long-term-planning thread or directly modify the state (including orders) of the units in PerSimStep. That said, behaviors are preferable as they tend more towards emergent behavior, which leads to more !!fun!!

Quote
Finally, would you prefer factions to use the buildingDronesInternally functionality or to spawn units directly in the C# code? Either one will work (though using buildingDronesInternally may require multiple XML entries for Dyson Spheres at different Intensity levels). Or some combination could be done.
If the desired behavior is constant (like a Carrier Starship) and fits within the XML definition, put it there. If it doesn't fit, or it changes during the game in ways that can't be readily expressed in the XML, feel free to do it directly in code (obeying all the usual sync rules, etc).

I'm guessing that the Dyson's construction rate will vary by more than just the picked-in-the-lobby settings (the antagonizer, for instance, or balance calling for a human-ally dyson to spawn at a different rate than a neutral one, etc), so I'd just put that in code.

But perhaps some of the Dyson minions, if custom ones of those are ever defined, could use the carrier-starship pattern for their own stuff. That way you don't have to have blocks of code just for them too.

In general the xml is less work, and produces more consistent behavior, so if we find ourselves doing this sort of dynamic-scale spawning all over the place we may want to extend the xml schema to feed off a new per-entity variable that can be changed at will in code. But it's not clear that this would satisfy all the requirements.

On the dyson size, change its "radius" value in the xml. On its placement I'll try to make that function give you more control over the per-planet placement in the release after this one. For the time being, after that function call, you could just find the dyson by tag (or just the only unit in the faction) and call SetWorldLocation to some point further away.


Overall great progress, thanks :)
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 BadgerBadger

  • Arcen Volunteer
  • Hero Member Mark III
  • *****
  • Posts: 1,229
  • BadgerBadgerBadgerBadger
Re: Dyson Sphere tweaks
« Reply #7 on: October 17, 2017, 10:19:44 am »
The Dyson Sphere ships will defend adjacent planets that are planet.GetControllingFaction().GetIsFriendlyTowards(DysonSphereFaction)) from Hostile factions. So yeah, they will defend AI planets from humans if the Dyson Sphere is hostile to humans. I might consider making the "cry for help" radius larger on higher intensity levels, that might be fun.

I think trying to edit GameCommand objects and write my own is a bit tricky for me to figure out without greater insight into how they work (at the moment I only see how to use GameCommands to ship things between planets), so I'm going to ignore the problem for now. Incidentally, if we do get a "make ships wander around a planet" Behaviour then the Nanocaust would like to use that too. I don't really care how they move (in a big circle, a random walk, between all the wormholes), but it's boring when ships just sit still.

Is there a way to change the team_color of a faction in C#? I think it would be cool to change the Dyson Sphere ships color depending on whether it was hostile-to-all, hostile-to-human or hostile-to-AI. If I'm spawning them in the C# code then I could make a 'set this the right colour' call, I just would need to know the function to call. This is a low priority though.

This has given me a few ideas about how to implement Human Resistance Fighters or Human Marauders, but frankly at this stage I think new content should be avoided. It's gonna be hard enough to balance and polish what already exists.

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Dyson Sphere tweaks
« Reply #8 on: October 17, 2017, 10:59:46 am »
I think trying to edit GameCommand objects and write my own is a bit tricky for me to figure out without greater insight into how they work (at the moment I only see how to use GameCommands to ship things between planets)
Movement within a planet is simpler:

Code: [Select]
        public static void Helper_SendMoveCommand( GameEntity entity, ArcenPoint Destination, bool isQueuedCommand )
        {
            GameCommand command = GameCommand.Create( GameCommandType.Move );
            command.ToBeQueued = isQueuedCommand;
            command.RelatedPoint = Destination;
            command.RelatedEntityIDs.Add( entity.PrimaryKeyID );
            World_AIW2.Instance.QueueGameCommand( command, true );
        }

So if you have a list of points on the planet you want them to bounce around between, you can loop through the list and call that function (or just copy the body over and adapt it, as that function isn't intended as the one-place-you-can-send-move-commands-from-external), with entity=your-ship, isQueuedCommand=true-for-all-but-the-first-point, and destination=that-point.

It's not the best way to handle patrols, just mentioning it.

Quote
Is there a way to change the team_color of a faction in C#?
Not currently, but I've added Faction.ChangeColor(TeamColorDefinition) for next time. Bear in mind that the team color will need to already be defined in the xml.

Quote
This has given me a few ideas about how to implement Human Resistance Fighters or Human Marauders, but frankly at this stage I think new content should be avoided. It's gonna be hard enough to balance and polish what already exists.
Yea, extra factions isn't a current priority. But I know they're fun to work on, and modders who are having fun tend to be more helpful all around :)
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 BadgerBadger

  • Arcen Volunteer
  • Hero Member Mark III
  • *****
  • Posts: 1,229
  • BadgerBadgerBadgerBadger
Re: Dyson Sphere tweaks
« Reply #9 on: October 17, 2017, 11:16:25 am »
I tweaked the radius of the Dyson Sphere, but the ships still spawn right in the center of the structure, well inside the radius of the structure.

For moving the Dyson Sphere around with SetWorldLocation, is there a mechanism to make sure it doesn't wind up too close to any of the AI structures? Would I have to compute the location of all the AI structures then find a suitable spot?

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Dyson Sphere tweaks
« Reply #10 on: October 17, 2017, 11:34:01 am »
I tweaked the radius of the Dyson Sphere, but the ships still spawn right in the center of the structure, well inside the radius of the structure.
That's normal. Same thing happens when the Ark builds ships. The ships should fly out due to normal decollision logic, such that they are entirely outside the circle you see when mouseovering the unit, etc. Is that not happening?

Quote
For moving the Dyson Sphere around with SetWorldLocation, is there a mechanism to make sure it doesn't wind up too close to any of the AI structures? Would I have to compute the location of all the AI structures then find a suitable spot?
You can call this function on planet:

Code: [Select]
ArcenPoint GetSafePlacementPoint( ArcenSimContext Context, GameEntityTypeData EntityTypeToPlace, ArcenPoint BasePoint, int MinDistance, int MaxDistance )
So you could pass in CombatCenter as the BasePoint, and both MinDistance and MaxDistance to "ExternalConstants.Instance.Balance_AverageGravWellRadius * FInt.FromParts( 0, 850 )" or something like that. It probably needs to be far enough in that its sim-circle is entirely within the orbit ring, or strange things may happen.

Anyway, that function will try 100 times to get a point in the specified area that fits within the orbit ring and does not overlap with any unit or wormhole. If it fails after 100 tries it just returns the point 0,0 , which is way off in the middle of nowhere out of sight, so you can check for X==0 as a "just leave it where it is" condition, or try again with looser distance-from-center constraints, or whatever you like.
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 BadgerBadger

  • Arcen Volunteer
  • Hero Member Mark III
  • *****
  • Posts: 1,229
  • BadgerBadgerBadgerBadger
Re: Dyson Sphere tweaks
« Reply #11 on: October 17, 2017, 11:43:15 am »
The behaviour you describe is happening, but the Dyson Sphere visual is so large that it takes 5-10 seconds for ships to fly out and they are shooting the whole time. A ton of combat is happening with ships that are inside the Dyson Sphere visual, which is not desirable.  Sometimes tractor beams grab ships while they are still inside the Sphere Graphic.

Also ships will fly from outside the Dyson Sphere radius back into it. It seems like the collision check isn't working. Also also, if you set the radius to > 700 then the Dyson Sphere simply fails to spawn. 700 is still significantly smaller than the Dyson Sphere visual.

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Dyson Sphere tweaks
« Reply #12 on: October 17, 2017, 12:12:06 pm »
Also ships will fly from outside the Dyson Sphere radius back into it. It seems like the collision check isn't working.
It only checks stationary things, which is why stuff can fly through other stuff in general. Collision checking that actually treats units as blocking other units from moving through them would basically break the game.

I think the problem is that the unit is just too big to look right as a unit. Either we need to make it small enough to look ok with the normal rules, or we need to adapt it into a planet graphic and have it not really be a unit at all (would no longer be something with a health bar or sim presence, etc, just its minions).
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 BadgerBadger

  • Arcen Volunteer
  • Hero Member Mark III
  • *****
  • Posts: 1,229
  • BadgerBadgerBadgerBadger
Re: Dyson Sphere tweaks
« Reply #13 on: October 17, 2017, 12:32:42 pm »
I would love it as a planet graphic rather than as a unit.

Offline Draco18s

  • Resident Velociraptor
  • Core Member Mark V
  • *****
  • Posts: 4,251
Re: Dyson Sphere tweaks
« Reply #14 on: October 17, 2017, 01:41:19 pm »
I would love it as a planet graphic rather than as a unit.
Oh, me too.