Opened 4 years ago

Closed 10 months ago

Last modified 6 months ago

#2160 closed enhancement (fixed)

[PATCH] Regicide game

Reported by: Josef Kufner Owned by:
Priority: Should Have Milestone: Alpha 21
Component: UI & Simulation Keywords: patch
Cc: Patch:

Description

Simple and elegant. Just kill enemy king to win.

This game mode was in Age of Empires 2. Player loose when his king is killed. It makes the game much more specific and clear than "eliminate everything".

To make sure that king will not die too soon, player gets castle or fortres at the start. Castle capabilities are limited until player reaches appropriate technology level. But I think Civic Centers are though enough to simply introduce The King character and change game objectives.

AI rules are simple: Garrison the King to nearest strong building. Optionally move king to nearby stronger building if there are no enemies around.

King should be the fastest unit with no attack and minimal armor. Wild animals should ignore him.

Attachments (18)

regicideWIP.patch (8.5 KB) - added by Sandarac 17 months ago.
This is a rough version of a "Regicide" game mode. Works on maps that start with civic centers.
regicideWIP_v2.patch (16.8 KB) - added by Sandarac 17 months ago.
Every player starts with a "saint" unit (placeholder) that is visually based on the civ's healer unit. Works on maps that start with civic centers.
Heroicide_v0.1.patch (3.3 KB) - added by Sandarac 17 months ago.
Heroicide step 1, works on all maps, including ones like Nomad and Sicilia Nomad (where units start on a ship).
Regicide_v0.2.patch (4.0 KB) - added by Sandarac 17 months ago.
Regicide (with heroes) step 1. Reviewed and given the OK by elexis.
Regicide_v0.3.patch (4.5 KB) - added by Sandarac 16 months ago.
Some fixes after mimo's review. Now checks for Hero class.
Regicide_v0.4.patch (9.1 KB) - added by elexis 16 months ago.
Rewrote the loops to address the remarks
Regicide_v1.1.patch (2.6 KB) - added by Sandarac 16 months ago.
Regicide_v1.2.patch (8.0 KB) - added by Sandarac 16 months ago.
Regicide_v1.3.patch (12.0 KB) - added by Sandarac 16 months ago.
Adds option to disable aura/attack of heroes until City Phase
Regicide_v1.4.patch (10.2 KB) - added by Sandarac 16 months ago.
Some clean up after review, GarrisonHolder? now checks if Auras are enabled for individual units.
Regicide_v1.5.patch (13.9 KB) - added by Sandarac 16 months ago.
Disables the Production Queue of heroes until City Phase is reached. The GuiInterface?.js changes need a bit of tweaking.
Regicide_v1.6.patch (17.8 KB) - added by Sandarac 16 months ago.
Adds some simple tests for auras, GarrisonHolder? and ProductionQueue?.
Regicide_v1.7.patch (32.1 KB) - added by Sandarac 16 months ago.
Adds gamesetup option to disable Auras/Attack/Production? Queue of heroes until City Phase, using templates.
Regicide_v1.7.1.patch (10.1 KB) - added by Sandarac 16 months ago.
Adds gamesetup option to toggle whether Heroes can garrison or not.
regicide_early_attack_v2.patch (30.1 KB) - added by elexis 16 months ago.
regicide_garrison_option_v2.patch (15.7 KB) - added by Sandarac 16 months ago.
Some fixes after review, and adds tests for Player and GarrisonHolder? components.
regicide_garrison_option_v3.patch (13.2 KB) - added by Sandarac 16 months ago.
Uses dynamic templates, requires #2951.
undeletable_hero_v1.patch (617 bytes) - added by elexis 16 months ago.
The hero should also become undeletable to avoid accidental deletes and as players should use the resign-feature if they want to do that.

Download all attachments as: .zip

Change History (67)

comment:1 Changed 4 years ago by Ben Brian

Keywords: design added
Summary: Rigicide gameRegicide game

I don't know about kings, we don't really have a "king" unit in the game, but since we do have heroes and they are integral to the game, we could have a "herocide" mode? (Some of the heroes were kings but not all.)

I could imagine starting the game with a hero of your choice, and if they die for any reason, you lose. Since it's a new game mode we should probably have Michael or someone on the design committee comment on the idea.

comment:2 Changed 4 years ago by Josef Kufner

Heroes in 0AD are mostly combat units and it is good that way, becouse they get involved in game. But king is usually kept away in his safe castle. And since some heroes were kings, it would be wierd to have two of them. Maybe a queen would be more appropriate...

I do not want to change game too much, only make objective more specific. That is why it should be new and completely useless unit. Adding such unit will not interfere with future development -- it is one isolated unit for each civilization and simple modification to end-of-game condition.

Ok, lets add useless "queen" unit. She will fit better into the game. Heroes/kings will fight for glory and queen will wait for him at home (or work on field). Women are in game already, only working... it should not be too much work to put shiny dress on one of them :)

However I would prefer kidnapping rather than killing them: She will get attacked and killed as usual, but instead of dying, she will change collor to atacker's, but keeping her name, so winner can get his trophy. (I know, it sounds ugly, but it will make multiplayer more interesting.)

comment:3 Changed 4 years ago by Josef Kufner

And there is one more thing: In Age of Empires all players have option to buy a location of all kings using spies. It is feature of the castle in late game and it costs some gold. When player clicks that button, position of all kings (queens) is shown on minimap for a few seconds. This feature solves problem of finding the king/queen and keeps game more dynamic.

comment:4 Changed 4 years ago by Ben Brian

I don't agree, making it a useless unit detracts from the gameplay value. You might as well play conquest mode, your opponent could hide a single citizen soldier until the last, then send them to an ally to avoid losing the game.

But if it's hero oriented, then you have to balance the risk of using them in battle or placing them in 'dangerous' positions with the goal of having them survive the whole game. Each hero will have their own strengths and weaknesses, and auras that affect lots of other units, some have no combat ability.

It could also be seen as a way to get acquainted with 0 A.D. heroes. And heroes are at least historically accurate figures, whereas a generic "king" would be strange for civs that had no kings (0 A.D. is all about the history after all).

Last edited 4 years ago by Ben Brian (previous) (diff)

comment:5 Changed 4 years ago by Josef Kufner

Main difference from conquest mode is, that you don't have to hunt all citizens. You go for single and well protected unit. Of course, you can hide your king in ally's fortress to avoid loosing the game, but it only makes that fortress more interesting target and will not let you win automaticaly or make you immortal.

If hero goes to battle, every enemy player will instantly target him and kill using all available units ignoring any army around. Not good for gameplay.

Another problem is, that now there are usually three heroes available. It would be hard to replace one hero with another during the game.

And also, any future change would have to consider hero position in regicide mode.

I don't think using current heroes as "kings" is practical. Introducing one new character per civilization brings much less troubles. The new character may not be completely useless, but it must be something else than heroes.

To maintain historical accurance, I thing a queen will make sense in most cases (see comment:2).

Last edited 4 years ago by Josef Kufner (previous) (diff)

comment:6 Changed 4 years ago by Erik Johansson

Having a Herocide mode has been an idea for quite some time.

I don't really see the trouble with using heroes, they're going to be targeted due to their strength anyway, so the difference in that regard is minimal. The only downside imho is that civs which has heroes which aren't as aggressively useful (do we have any passive benefits? I.e. a hero that gives a bonus to all units on the map or similar?) are going to be better off in a Herocide game as they would get the benefit without risking their hero. But again, that difference still applies in the general game, so it shouldn't be a unique issue for a Herocide mode.

comment:7 Changed 4 years ago by Josef Kufner

I really don't like idea of using heroes for this purpose. It would remove posibility to replace heroes during the game and it would affect the gameplay too much.

Point of this mode is to have one target without changing entire game.

Take woman model, name it Queen (depending on civilization) and set game objective to "If she dies, you loose." is easy and elegant way to implement it with minimal impact to the rest of the game (both gameplay and maintainability).

comment:8 Changed 3 years ago by Raymond

Also like this idea. Hopefully it gets in 0ad soon.

comment:9 Changed 20 months ago by elexis

Would be nice to have this in alpha 21 (and not that hard to program).

Recapitulation:

  • A king/queen would not be historically accurate and would require new models.
  • Using a hero has several disadvantages
    • hero is likely not going to be used in battle
    • it spawns from the gamestart? (otherwise it would be safer to just not build a hero at all) which would yield weird gameplay (age 1 units being rushed by a single hero)
    • the player can't chose which hero to build
    • tremendous differences between heroes (slow elephants, fast chariots)
    • Heroes are balanced for conquest games. Not adding a new unit will break the balancing for regicide games.

So maybe a third option would be better (saint, monk, military general, political leader, diplomat, geograph, ... ).

Example:

  • New template "Saint"
  • inherits the monk template, but has more HP and some nicely chosen civ-specific advantages
  • We could reuse the existing model, maybe with little modifications like model size or color.
  • Artists become incentivized to create models.

Can we find one historically relevant character for each civ?

comment:10 Changed 20 months ago by Lionkanzen

May be we need discuss a properly artist aspect, for now we can use a place holder. And give and icon with a crown.

Changed 17 months ago by Sandarac

Attachment: regicideWIP.patch added

This is a rough version of a "Regicide" game mode. Works on maps that start with civic centers.

comment:11 Changed 17 months ago by Sandarac

Keywords: review patch added
Milestone: BacklogAlpha 21
Summary: Regicide game[PATCH] Regicide game

comment:12 Changed 17 months ago by fatherbushido

(Imo, "saint" is not a good name.)

Changed 17 months ago by Sandarac

Attachment: regicideWIP_v2.patch added

Every player starts with a "saint" unit (placeholder) that is visually based on the civ's healer unit. Works on maps that start with civic centers.

comment:13 Changed 17 months ago by mimo

I agree with fatherbushido, the notion of saint is not appropriate. What's the problem with a king ? that looks appropriate for a regicide mode, coming from the latin word for king. Some civs of this time like greek or rome had not this notion of a "saint" - they had heroes, gods, half-gods or wathever, but no saints which is more associated to the later monotheist cultures. For civs without kings, it can be called pharaon, emperor, or whatever would fit.

I suppose in such a mod, we would disable heroes, so we can take them as placeholder for future king models.

Last edited 17 months ago by mimo (previous) (diff)

comment:14 Changed 17 months ago by Josef Kufner

I suppose in such a mod, we would disable heroes, so we can take them as placeholder for future king models.

No. No changes in the game play. The only change should be in the simplified game objectives -- "kill the king" instead of "kill everything".

[...] the notion of saint is not appropriate [...]

"Saint" is usually understood as someone who done some good, so it does not really make sense to set the goal in murdering him. Also it pollutes game with religious concepts where there is no need for these. Regicide is clearly secular matter. (...Unless the other king is of different religion and your religion orders you to stone him to death.)

comment:15 Changed 17 months ago by Josef Kufner

Kings and queens for regicide game

Athenians

Britons

Carthaginians

Gauls

Iberians

  • Heroes are kings.
  • We can use their wifes or daughters, when king did not have a son.
  • Not much info on Wikipedia.

Macedonians

Mauryans

Persians

Ptolemies

Romans

Seleucids

Spartans

comment:16 Changed 17 months ago by mimo

Sandarac: my comment against saints was not about your patch (which i understand only implements what is described in comment 9), but rather to change this comment 9.

jk: trac is not the place for such comment. Please open (if it does not already exist) a forum topic about this game mode and comment there so that we can gather different ideas. And imo a new game mode is all the more worthwhile that it is different enough from the existing ones, So also justify (on the forum as it is the place for such discussion) your "No changes in the game play." position.

comment:17 Changed 17 months ago by Josef Kufner

mimo: That was the answer to elexis's question:

Can we find one historically relevant character for each civ?

So, yes, we have the relevant characters.

comment:18 Changed 17 months ago by elexis

On the day comment:9 was posted, the use of the hero in regicide mode had been discussed with leper, sanderd17 and fatherbushido:

12:11 < elexis> any opinion on the regicide thing? maybe it could even be implemented without civ-specific names if the forum doesnt come up with some?
12:13 <@leper> specify one hero per civ
12:15 < sanderd17> Aren't "saints" something Catholic?
12:16 < elexis> if we use a hero, then people will fight with them in age 1 and 2
12:16 < sanderd17> (and don't you need to make a game that's dated after JC to have something Catholic)
12:16 < elexis> holy person in any way, dunno
12:16 < fatherbushido> elexis: just use a copy of the hero
12:17 < fatherbushido> a soft one
12:17 < fatherbushido> with 0 attack
12:17 < elexis> confusion incoming
12:17 <@leper> rushing in herocide or regicide always was and always will be a valid strategy
12:17 < sanderd17> yes, copy of the hero (without any attack, but a fair bit of armour so he isn't lost from the first arrow), and disable real hero templates in a regicide game
12:18 <@leper> or we could just use a special sheep
12:18 < fatherbushido> xD
12:18 <@leper> 9001 health, armour fitting that and it can be garrisoned
12:21 < elexis> carth has 2 cavalry heroes and one elephant hero
12:22 <@leper> so pick the cav one
12:22 <@leper> most other civs also have a cav one IIRC
12:22 <@leper> apart from maybe spart, but you get what you wanted in that case
12:29 < sanderd17> elexis, the hero should be quite easy to spot. So please pick cavalry or an elephant
12:29 < elexis> they have this star under their feet
12:37 <@leper> or just pick one at random

After comment:15 was posted, there were more discussions with mimo and Imarok:

17:34 < elexis> mimo: how do you imagine regicide gamemode?
17:36 < mimo> I don't really know,   but i'm afraid it will end up by garrisoning its king in the most defended cc, and then switch to a conquest one
17:37 < elexis> mimo: aoe2 has a specific upgrade for that to reveal the kings location for some seconds
17:38 < mimo> yes  we must add something like that, or some new idea which would make this mode more unique
17:39 < elexis> you might be right, linking it to the hero would mean that the player can decide between moving the hero to the front for the hero aura or parking it at home. im just not sure whether giving players a hero in age 1 is that good. also some heroes can't be garrisoned at all (in that case the player would have to pick a hero before starting the game or ingame somehow)
17:40 < elexis> heroes can move through heavily defended cities for a long time before dying, so they would certainly be used to harass players in age 1. a hero chariot and maybe another hero of a teammate might be enough to defeat a player early
17:41 < mimo> but this mode can have modified stats for heroes if needed
17:42 < elexis> oh no duplicate balancing work pls :S
17:45 < mimo> why   duplicate balancing ?   if we remove the possibility to train heroes during the game, give them some lower combat stat and call them king, that would be enough  
17:52 < elexis> mimo: or an hero elephant just destroying a CC in age 1 :D
17:53 < mimo> but for a regicide mod,  we have the choice of heroes we would use, and the elephant ones can be simply omited.
17:54 < elexis> I think most of them are OP in age 1
17:55 < mimo> but as i said "give them some lower combat stat"   
17:56 < elexis> also using the hero solves the need of having a button in the top left corner
17:57 < Imarok> What about removing the combat ability of the heroes and give them back by a tech that can be researched under the same conditions as the heroes in a normal game?
17:59 < elexis> thats smart :P
18:00 < elexis> or the hero could spawn automatically in age 3
18:03 < Imarok> elexis: when the hero spawns at age 3 someone just doesn't move to age 3 and will win the game
18:04 < elexis> I think it could be made a viable option to stay in age 2, you will have a big problem winning that without champs nor siege
18:04 < elexis> hmm, actually some civs have champs in age 2 now
18:04 < Imarok> yep
18:04 < elexis> and sparta can do those swordsmen which are champish
18:05 < Imarok> and there should be the possibility to win the mode already in age 1 or 2 (rushing)
18:06 < elexis> certainly, but seems too easy with some heroes in age 1. I'll do some cheatgame tests. I suspect the hero elephant being sufficient to kill a CC right after the gamestart
18:06 < elexis> but it would also certainly deliver some epic hero vs hero fights in age 1 x)
18:08 < Imarok> If one has a fast ranged hero and the other one a slow heavy "tank", the latter one has no chance...
18:10 < Imarok> I think no hero combat ability at start is the best option
18:10 < elexis> (cc killed, hero more than half hp remaining in first test)
18:10 < elexis> likely
18:10 < Imarok> ( wow :O )
18:24 < mimo> But you are not discussing a regicide mode, but a "herocide" mode. We could also have heroes with small combat ability (not evolving or slightly evolving with phases). Otherwise balance will become a real problem

and some more today:

13:53 < elexis> sanderd17: I guess "saint" might work: 'In English, the term saint is often used to translate this idea from many world religions' https://en.wikipedia.org/wiki/Saint#Other_religions
14:14 < elexis> sanderd17: how about implementing both sainticde and heroicide and letting the user chose which mode to play?
14:14 < sanderd17> elexis, what would the difference be?
14:15 < elexis> the hero is the most useful unit in combat, so it would incentivize players to move it to the frontline, high risk, high gain
14:15 < fatherbushido> "ajout de la baraque séleucide." sounds wrong :p
14:16 < elexis> while a saint can be garrisoned in a seemingly safe place, while enemies could research the proposed tech to identify the heroes/saints location and do a surprise attack
14:17 < sanderd17> elexis, the distinction sounds nice, but I'm not too fond of the names. They're too equal IMO
14:17 < sanderd17> * too similar
14:22 < elexis> sanderd17: any better idea?
14:23 < sanderd17> protégé?
14:25 < elexis> wraitii: IMO the user should just be able to chose a hero in the gamesetup or beginning. if he choses one that is slow and cant be garrisoned like an elephant, its the players choice
14:26 < sanderd17> elexis, hmm, might be an interesting way to test trigger-generated dialog boxes
14:28 < elexis> should be added to the gamesetup IMO
14:29 < elexis> if you do it after starting the game, the client might hack the gui to just never send a dialog answer, in which case you would just have to spawn the hero anyway
14:29 < elexis> after N seconds, which is not a nice solution IMO
14:33 < echotangoecho> regarding #4053, at least it seems that somewhere we are calling jsapi functions without a JSAutoRequest, so now I'm trying to figure out where we are doing that.

Here my extended proposal which hopefully covers all opinions expressed so far:

  • Both heroicide and saint/queen/king mode could be implemented for my liking. They would have different gameplay as the hero is the most useful warrior while the other unit to be discussed is passive and hides somewhere. The latter mode is distinguished from regular conquest mode as a player can utlimatively win by surrounding the building that the king is located in. Furthermore a tech to reveal the enemies king/hero location means surprise attacks can be planned. (Furthermore I don't see a problem with having a wider variety of gamemodes, we already distinguish Conquest Structures and Conquest Units f.e.)
  • Heroicide mode
    • high risk high gain to use the hero in combat
    • the hero attack component might just be activated in age 3
    • the hero is guaranteed to be spawned for all players. The only painless way I can think of is to let players pick it in the gamesetup. It could be a "chose hero" button that defaults to random if not selected. Players should be able to select it themselves (might need #3806). By letting the player chose a civ and hero, it is his decision whether to use something that might have disadvantages in late game like a slow, ungarrisonable elephant hero.
  • Saint/queen/king/something else mode:
    • Apparently a king fits better than a saint.
    • Since it's the most important unit in that match, it must be shown in the top left side, just like the hero.
    • It should also work for nomad maps.
  • A new tech should be added that if researched, reveals the location of that unit for 30 seconds. Can be done in a separate ticket.

comment:19 Changed 17 months ago by Josef Kufner

Ok, spliting this to three game modes sounds reasonable: (collecting ideas from comments above and adding few mine)

  • For all modes, there should be some feature to locat king/hero/sheep. In Age of Empires it was "Spies" which in exchange for some resources reveal location of the objective (available in age 3).

Regicide game:

  • There should be no modification of conquest game except changed objectives.
  • Expected strategy: Just garrison the king home and play conquest game, except you don't have to hunt down everything, just the single target.

Heroicide mode:

  • Hero should have more HP than usual and all heroes should be of similar stats.
  • High risk, high gain.
  • There will be significant balance problems in early game if hero is present from the beginning.
  • Hero can be spawned later at oldest CC to avoid rushing. Spawn time should be about the same as if player would build the hero "manually". Notice players in advance in chat/messages.

Sheepicide mode -- "capture the sheep":

  • The Sheep is a dumb sheep which can be controlled by any nearby unit just like ordinary sheep (they will change color).
  • Sheep is immortal. (And villagers will not eat them.)
  • Other player must capture all Sheeps and bring them to their territory.
  • Sheeps cannot be garrisoned (but you can build a wall around them).
  • Sheep can be transported by boat. If boat is destroyed, sheep respawns at nearest home territory or CC. Or we can let Sheep swim.

comment:20 Changed 17 months ago by elexis

No, use the same hero templates, but disable the attack stats before age 3. The hero should spawn immediately, everything else is too arbitrary.

Not sure if you guys are serious about the sheep mode, but if its not a single unit to be killed to defeat someone, then this ticket isn't the place for that. Might want to add it to https://wildfiregames.com/forum/index.php?/topic/20803-victory-conditions-ideas/

comment:21 Changed 17 months ago by Josef Kufner

I added the "Capture the sheep" mode to forum and made it own issue: #4075

comment:22 Changed 17 months ago by Lionkanzen

With Romans you must use Consul. or dictator.. https://en.m.wikipedia.org/wiki/List_of_Roman_dictators

Last edited 17 months ago by Lionkanzen (previous) (diff)

comment:23 Changed 17 months ago by stanislas69

Keywords: rfc added; review removed

Moving it to rfc queue, as patch is not finished, and is merely waiting for comments.

comment:24 Changed 17 months ago by elexis

Keywords: simple added

See comment:18 for a comprehension of all irc discussions (at least 2015).

The only reference to regicide that I can find on trac.wildfiregames.com is wiki:GSOC_Ideas. It suggests a https://en.wikipedia.org/wiki/Regent and the disabling for conquest mode. This should be implemented using #4014. Reveal regent/king/hero tech: #4093

First someone should try to implement the heroicide mode (as there is the most agreement now on how it should work).

I'd be willing to commit heroicide in several parts:

  1. Basic heroicide mode. A random hero is spawned in the beginning of the game. A player is defeated once that one dies. (ping Sandarac)
  2. Stripping the hero attack and auras until either city phase is reached or some city phase tech has been researched (can be done in a separate ticket).
  3. Gamesetup UI: the host can chose the spawned hero for every player (can be done in a separate ticket). Once #3806 is implemented, it can be allowed for players too.

Changed 17 months ago by Sandarac

Attachment: Heroicide_v0.1.patch added

Heroicide step 1, works on all maps, including ones like Nomad and Sicilia Nomad (where units start on a ship).

comment:25 Changed 17 months ago by Lionkanzen

We can use murder the hero in his civilian costumes. Because some heroes have different HP and armor.

comment:26 Changed 17 months ago by stanislas69

Is there any way this can be opened to other civs for mods without having to edit that file ? Couldn't you open JSON files ? Maybe parse a folder I don't know ?

Changed 17 months ago by Sandarac

Attachment: Regicide_v0.2.patch added

Regicide (with heroes) step 1. Reviewed and given the OK by elexis.

comment:27 Changed 17 months ago by Sandarac

Keywords: review added; rfc removed

comment:28 Changed 16 months ago by mimo

Thanks for the new patch.

  • I'm not sure selecting the heroes only based on the _hero_ in the template name is safe enough. There are no definite rules on the template names and modders could not follow that convention. Using the class Hero would be safer although a bit slower.
  • I do not understand the logic for spawning: it seems that you first try around a cc, and if no cc, you look for a ship and garrison the hero inside. I suppose it is for nomad maps when you start inside one ship. But you can have other nomad maps, for example you may start on land but without cc. I think when you have no cc, you should try any structure, and if no structure, you should look for any non-garrisoned unit, and then if it happens that this unit is a ship, garrison inside after checking that it has enough capacity. And, if the hero has to be garrisoned, you should add the required garrison AllowedClasses? when choosing the hero.
  • Finally, if the hero has to be garrisoned in a ship, there is a great chance that PickSpawnPoint? won't find a valid position, which is ok for the moment as this function will return a default position, but this may no more be the case in the future if something is done for the TODO inside this function. You should either add a comment in this function stating that you take advantage of this feature (which is a bit hacky) or maybe add an argument in the function (toBeGarrisoned) which when true you omit the PickSpawnPoint? call and just have a continue after line 62 of TriggerHelper?.js

Changed 16 months ago by Sandarac

Attachment: Regicide_v0.3.patch added

Some fixes after mimo's review. Now checks for Hero class.

comment:29 Changed 16 months ago by Andy A.

Cc: andy011973@… added

comment:30 Changed 16 months ago by elexis

That what mimo said, and this:

Flaws:

  • Civ filtering by the filename should be considered an ugly workaround, check for Identity.Civ (just like deriving the heroes from the template names)
  • The explicit elephant check is bad and also undocumented as to why it's there. Remove it and instead check whether the unit can be garrisoned.
  • The elephant is just one example where hero spawning might fail. Just loop over the next random hero of the civ that if one fails. Using shuffleArray to loop over these.
  • Removing the if (!spawnPoints.length) since the hero might not be spawned at that place for any reason (f.e. missing passability).
  • All spawn points should be tested (What if you could spawn the hero at a ship, but not garrison it?)
  • Doesn't consider spawning an hero at a full ship a a successful spawn (don't attempt spawning there in the first place). My code prefers to throw an error if there was a nomad mission with a fullly garrisoned ship at the shoreline.
  • Engine.QueryInterface(this.heroes[i] -> as long as that's an array, there would have to be a [0]
  • A check whether the unit is able to be garrisoned is done using cmpGarrisonHolder.GetAllowedClasses and MatchesClassList as mimo proposed

Code style:

  • temp -> templateName, we can afford the distinction from temporary and template (which might be expected to be an object or array containing all template data)
  • (If we wouldn't have to rewrite the loops:) L13 I'd prefer the array function filter so that it becomes more obvious that the sole purpose of that loop is to return a subset of the unit template name list. In fact you can merge those two filters and thuse nuke unitTemplates.
  • L24-L32, the same thing is done thrice. We can't really merge as it's about sorting. Using sort to highlight that.
  • let cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); move that out of the loop, getting it once is enough
  • heroTemplates.filter(hero -> hero should be templateName
  • civHeros -> civHeroes
  • i -> playerID
  • cmpUnitAI only needed inside that if
  • Using EntityHasClass everytime seems lame, doing that cmpIdentity.GetClassesList more often than needed

Notice:

  • You call defeat player even if the game has won. Luckily someone addressed that issue of duplicate defeats already :P
  • The removal of attack and auras in age 1 could become optional, so people can also play the "rush with hero on regicide" variant

Changed 16 months ago by elexis

Attachment: Regicide_v0.4.patch added

Rewrote the loops to address the remarks

comment:31 Changed 16 months ago by elexis

Patch -> Chose mauryan on skirmishes / sicillia nomad to to see what happens if there is only a fully garrisoned ship to spawn at. The template change shouldn't be committed.

comment:32 Changed 16 months ago by elexis

In 18544:

Basic regicide gamemode. Based on patch by Sandarac, refs #2160.

Spawn a random hero at gamestart and defeat the player if the hero dies.
Consider nomad maps where units spawn without buildings or start on a ship.
Correct a comment for TriggerHelper?.SpawnUnits?.
Make shuffleArray available to GUI and simulation and use it to randomize heroes.

comment:33 Changed 16 months ago by elexis

Keywords: design review removed

Diff of the last patch and commit:

  • Removed unused variable civs.
  • Add a check to only cache those heroTemplates of the chosen civs (what civs was intended to be used for)
  • Created an array spawnPreference and use findIndex to remove duplicate checks
  • Moved let cmpTemplateManager = ... one paragraph lower
  • Renaming heroes to regicideHeroes and SpawnHero to SpawnRegicideHero
  • Removed the wrong comment A default position is returned if no valid position is found., as it always returns the entity IDs of exactly the spawned units.

The remaining two steps for hero-regicide mode would be to

(2) to strip the heroes attack- and capture- component and auras until a new technology is researched in age 3. In my opinion it should be optional, similar to the last-man-standing option, so that people can still play with heroes in age 1.

(3) Let the host pick a hero for every player. Would likely benefit from #3212, but likely not strictly needed.

The other proposed modes can be handled in separate tickets and should be reevaluated.

But even more important than those 2 points were the ability to combine victory conditions (conquest + wonder victory + regicide + last man standing): #4014.

Last edited 16 months ago by elexis (previous) (diff)

Changed 16 months ago by Sandarac

Attachment: Regicide_v1.1.patch added

Changed 16 months ago by Sandarac

Attachment: Regicide_v1.2.patch added

Changed 16 months ago by Sandarac

Attachment: Regicide_v1.3.patch added

Adds option to disable aura/attack of heroes until City Phase

comment:34 Changed 16 months ago by Sandarac

Keywords: review added

Changed 16 months ago by Sandarac

Attachment: Regicide_v1.4.patch added

Some clean up after review, GarrisonHolder? now checks if Auras are enabled for individual units.

comment:35 Changed 16 months ago by elexis

In 18559:

Fix an off by one error. Reported by fatherbushido, refs #2160.

Changed 16 months ago by Sandarac

Attachment: Regicide_v1.5.patch added

Disables the Production Queue of heroes until City Phase is reached. The GuiInterface?.js changes need a bit of tweaking.

comment:36 Changed 16 months ago by sanderd17

Keywords: rfc added; review removed

I appreciate the work that has been done here, but per the new SubmittingPatches guidelines, tests for altered and added simulation code should also be provided.

We were having more and more code stability issues, and by adding tests, we hope to be able to improve stability of code. Thanks a lot for wanting to work on this.

See f.e. #4121 on how to do this.

Changed 16 months ago by Sandarac

Attachment: Regicide_v1.6.patch added

Adds some simple tests for auras, GarrisonHolder? and ProductionQueue?.

comment:37 Changed 16 months ago by elexis

In 18572:

Fix regicide spawn point preference bug, refs #2160.

On maps with multiple buildings it didn't prioritize the civic center.
This part would require a findLastIndexOf array function to avoid the loop.

Changed 16 months ago by Sandarac

Attachment: Regicide_v1.7.patch added

Adds gamesetup option to disable Auras/Attack/Production? Queue of heroes until City Phase, using templates.

Changed 16 months ago by Sandarac

Attachment: Regicide_v1.7.1.patch added

Adds gamesetup option to toggle whether Heroes can garrison or not.

comment:38 Changed 16 months ago by Andy A.

Cc: andy011973@… removed

Changed 16 months ago by elexis

comment:39 Changed 16 months ago by elexis

  • Added many attack component tests to v1.6.
  • Merged duplicate setEnabled calls to new function.
  • Removed !! as we want an error if its not specified, similar to the wonder duration.
  • Removed bad spaces in Trigger.prototype.CheckRegicideCityPhase
  • Fixes spaces in test_GarrisonHolder.js
  • Add quotes and use arrow functions in test_ProductionQueue.js.

Didn't test anything besides the tests yet.

Changed 16 months ago by Sandarac

Some fixes after review, and adds tests for Player and GarrisonHolder? components.

Changed 16 months ago by Sandarac

Uses dynamic templates, requires #2951.

Changed 16 months ago by elexis

Attachment: undeletable_hero_v1.patch added

The hero should also become undeletable to avoid accidental deletes and as players should use the resign-feature if they want to do that.

comment:40 Changed 15 months ago by elexis

In 18611:

Add missing component check to fix regicide on survival of the fittest. Patch by bb, refs #2160.

comment:41 Changed 15 months ago by elexis

Perhaps we don't need to implement the attack option, since ceasefire could be used instead.

The garrison patch using #2951 seems nice, but the AI needs to be informed that it can't garrison anymore. iirc, Itms suggested to use UnitAI instead of Identity for canGarrison, should be considered carefully which component fits better.

comment:42 Changed 14 months ago by elexis

Milestone: Alpha 21Alpha 22

Feature freeze in 2 days.

comment:43 Changed 13 months ago by scythetwirler

Keywords: beta added

comment:44 Changed 12 months ago by fatherbushido

It sounds like that the more interesting facts in regicide mode are the powerfull attack and the auras provided by them. (It's kinda the commander in TA, supcom or most of the spring rts games). Imo removing auras and attack option seems a bit useless features. It's just my early personnal feeling.

comment:45 Changed 12 months ago by elexis

Agree, players can also chose ceasefire if they don't like those early rushes. Picking heroes in the gamesetup and disabling the garrisoning seems still worth the effort to me.

comment:46 Changed 12 months ago by elexis

Milestone: Alpha 22Work In Progress

Moving to the new WIP milestone.

comment:47 Changed 10 months ago by elexis

Keywords: simple rfc beta removed
Milestone: Work In ProgressAlpha 21

Fixed by r18544, Garrison patch moved to https://code.wildfiregames.com/D104

comment:48 Changed 10 months ago by elexis

Resolution: fixed
Status: newclosed

comment:49 Changed 6 months ago by elexis

In 19631:

Option to disable garrisoning of heroes in regicide gamemode.
Accomplish this by adding a Garrisonable component that can be removed from individual units or templates.

Differential Revision: https://code.wildfiregames.com/D104
Refs #2160
Patch By: Sandarac

Note: See TracTickets for help on using tickets.