Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Carryall edge spawn, harvester delivery by carryall and harvester insurance for D2k #7664

Merged
merged 7 commits into from Mar 25, 2015

Conversation

penev92
Copy link
Member

@penev92 penev92 commented Mar 14, 2015

First off, this got a bit bigger than expected. So sorry, reviewers.

This is more or less a direct successor to #7300.

I spent quite a while organizing the changes into propper self-contained commits, so I strongly suggest reviewing, and even testing, by commits.
Despite the nice commit messages, I'm going to sum this up:
1. Make built carryalls spawn at the closest map edge cell instead of spawning at the High Tech facility
2. Do some refactoring to enable 3. and 4.
3. Enable FreeActors to be delivered from outside the map via transport (use case are the D2k harvesters, transported by carryalls; this might also be useful in some missions (TS?), but that's not important at the moment). This uses the closest map edge cell by default, but can be set to spawn at a specific location in the YAML file.
4. Add harvester insurance by attaching a new HarvesterInsurance trait to the player actor and making worms call that if they eat a harvester.

Side bonus: the shellmap got a bit more interesting due to the harvester's new harvesting location (the first time you watch it, at least :D ).

@penev92 penev92 added this to the Next release milestone Mar 14, 2015
@penev92 penev92 force-pushed the bleed_harvesterInsurance branch 2 times, most recently from 6fda2aa to bfb0041 Compare March 14, 2015 15:14
@phrohdoh
Copy link
Member

What does the 'insurance' do? An empty description helps no one.

@penev92
Copy link
Member Author

penev92 commented Mar 14, 2015

Added a trait description to HarvesterInsurance.

@pchote
Copy link
Member

pchote commented Mar 15, 2015

Did the insurance only apply to worms in the original, or to general harvester death?

@penev92
Copy link
Member Author

penev92 commented Mar 15, 2015

The insurance in the original was only a per-mission feature (a "you may need a new harvester in this mission, just so we don't make the mission too hard" thing) and it didn't care who killed the harvester.

Our worms, however, are much more pesky than the ones in the original and our AI is really unequipped to deal with them, so I thought I'd make it permanent.
I also figured:
1. Insurance regardless of who killed your harvester might have more serious gameplay implications.
2. This way is much easier and also much nicer (code- and performance-wise) to implement.

@Micr0Bit
Copy link
Member

would be nice to have "harvester-insurance" as option ... "default = on" of course , for the bots ...
turning it off would spice up some multiplayer/tourny games (since it doesnt exist in the original multiplayer)

atreides = Player.GetPlayer("Atreides")

InsertHarvester()
Media.PlayMusic("score")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It also plays the shellmap music.

@Mailaender
Copy link
Member

This seems to work extremely well in-game.

@penev92
Copy link
Member Author

penev92 commented Mar 15, 2015

Fixed.

Media.PlayMusic("score")
end
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing space.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow

@Mailaender
Copy link
Member

👍

@reaperrr
Copy link
Contributor

Needs a rebase.

@penev92
Copy link
Member Author

penev92 commented Mar 15, 2015

Rebased.

AppVeyor seems to be failing because of some warnings (not errors!) in the OpenRA.Test project.

<Compile Include="Traits\Buildings\DamagedWithoutFoundation.cs" />
<Compile Include="Traits\Buildings\LaysTerrain.cs" />
<Compile Include="Traits\Carryable.cs" />
<Compile Include="Traits\Player\HarvesterInsurance.cs" />
<Compile Include="Traits\Render\WithBuildingPlacedOverlay.cs" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is the real error:

CSC : error CS2001: Source file 'Traits\Render\WithBuildingPlacedOverlay.cs' could not be found

not the warnings in the test project.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably a rebase problem after #7570 so sorry about that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, didn't see that.

@penev92
Copy link
Member Author

penev92 commented Mar 18, 2015

Crash fixed.

@MicroJOo the insurance can be turned off per-map, but I have no plans for UI integration for the moment.

@@ -1,4 +1,4 @@
carryall.scripted:
carryall.reinforce:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably not have TargetableAircraft. carryall.infantry neither, come to think of it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually they should all be targetable. The initial idea of making carryalls untargetable was questionable, because they were targetable in the original. (or was it their cargo that was targetable, I'm not sure now).
Anyway, I'll remove TargetableAircraft from all carryalls for now, but it probably should be brought back when the proper balancing is being done.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intentionally creating more work for the future.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant that only the carryall used for the harvester insurance should have TargetableAircraft removed from it, not all of the carryalls. (Changed my mind about carryall.infantry, it's better if people can defend against them). Regular Carryalls should of course be targetable.

Edit: my reasoning: if the carryall that performs the harvester insurance function is shot down, it will not trigger another harvester being sent. And the player receiving the harvester cannot even control the carryall or its flight path, so that would be a pretty shoddy gameplay experience. It would also lure rockets troopers away as the spy plane in RA did.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See I hadn't considered stances. Having "chase all the way across the map" as the default stance really sucks. We should change the default to Hold position or similar.

Anyway, it was decided not long ago (no idea by who) that we want carryalls untargetable, because they are uncontrollable. I'm fine with it being like this for the moment, until the time comes to do the proper balance. We'll be changing everything there anyway.

@obrakmann
Copy link
Contributor

This looks fine for the most part, but those two nits (+ typos) need to be fixed.

@penev92
Copy link
Member Author

penev92 commented Mar 20, 2015

Fixed the problems, but I still don't know what's wrong with ChooseClosestEdgeCell() and isometric maps.

@Mailaender
Copy link
Member

I still don't know what's wrong with ChooseClosestEdgeCell() and isometric maps

I suggest you leave a TODO there as we don't need to solve it now for the next release.

@penev92
Copy link
Member Author

penev92 commented Mar 21, 2015

Agreed. It will be quite a while before anyone may want (if anyone at all) to use this on an isometric map.
@obrakmann your suggested method produced the exact same results as mine in both D2k and TS, so I'll leave it as it was, unless someone can help with the isometric map coordinates.

@pchote
Copy link
Member

pchote commented Mar 21, 2015

I suggest you leave a TODO there as we don't need to solve it now for the next release.

This isn't really acceptable. "I don't know how to fix this" cannot be a free pass to merge incomplete code if we want to keep a maintainable project. This is how we end up with "// HACK" and "this is shit" comments scattered throughout the code.

There are two examples on how to use MPos with bounds and borders right before ChooseClosestEdgeCell in Map.cs. Please try to get a feeling for how these work, as this really isn't a hard problem. You need to:

  1. Convert the given CPos to a MPos.
  2. Check against the bounds to find the nearest edge (all done in map coordinates)
  3. Convert the resulting MPos back to a CPos and return.

@penev92
Copy link
Member Author

penev92 commented Mar 22, 2015

Looks like this is going to wait for a decision on #7701.

[Desc("What the unit should start doing. Warning: If this is not a harvester", "it will break if you use FindResources.")]
public readonly string InitialActivity = null;
[Desc("Offset relative to structure-center in 2D (e.g. 1, 2)")]

[Desc("Offset relative to structure-center in 2D (e.g. 1, 2).")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually relative to the top-left cell, not the center.

@pchote
Copy link
Member

pchote commented Mar 22, 2015

The two testcases break compilation under non-windows, and prevent testing the actual pr contents.

@obrakmann
Copy link
Contributor

Since #7701 does not seem to be the fault of this PR, I'm going to merge it now. It looks ok code-wise, and works very nicely in-game, too. AI probably benefits the most. 👍

obrakmann added a commit that referenced this pull request Mar 25, 2015
Implement Carryall edge spawn, harvester delivery by carryall and harvester insurance for D2k
@obrakmann obrakmann merged commit 6fca67e into OpenRA:bleed Mar 25, 2015
@obrakmann
Copy link
Contributor

Changelog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants