[Script] [Multiplayer] Monarchy

34 replies [Last post]
Tiotimolina
User offline. Last seen 1 year 10 weeks ago. Offline
Joined: 2011-12-25
Posts: 18

Monarchy is a hedgewars minigame intended for a group of 4 or more players. The rules are based on classic card games.

Abilities
On game's first round, players are asked to choose 1 out of 2 randomly given abilities. The chosen abilities are displayed next to the health bar of the corresponding teams. The description of the abilities can be read during the selection phase and later in the mission text, either by pressing Esc or holding M. Two teams can't have the same ability.

Weapons
At the end of your turn, you get 2 random weapons. Weapons are retained between turns. Teams are limited to 5 weapons.
Room host can set which weapons are available during the game through the weapon settings. A weapon with 2 bullets will be twice as likely than a weapon with 1 bullet, and so on. Delay of weapons and content of crates can be customized as usual in the corresponding tabs.

Roles
If there are 4 or more players, Monarchy is played with roles.
Each player receives a secret role at the start of the game. Players only know their role and who is the monarch. The goal of the game is determined by your role.

  • Monarch: Eliminate all the assassins and traitors.
  • Assassins: Eliminate the monarch.
  • Guards: Same goal as the monarch.
  • Traitors: Become the last standing player, eliminating the monarch at last.
The monarch takes the first turn, starts with one more weapon and hedgehogs get some extra health.
Players get an extra turn for eliminating an assassin.
The monarch loses all weapons for eliminating a guard.

Parameters
Parameters can be separated by comma, space, comma and space, or anything really.

  • ffa: Free-for-all variant. No roles. The last standing player wins.
  • multi: Multiple abilities. Get 3 options choose 2.

License
MIT.

Download
v18 is here https://hedgewars.org/content.html. Ask THX1138 for v19. SHA512 checksum of v19 is 893d7313c8569f7dc619de5cfdd04ca742d37df76f8304ccd091237d507478e07403f237d9956eb2888a846df700b01895481f24b99243305bde2287daff1671.

Wuzzy
Wuzzy's picture
User offline. Last seen 2 weeks 23 hours ago. Offline
Joined: 2012-06-20
Posts: 1304

Awesome! Thanks for posting it here.

It was fun playing this with you.

The ability name “karma” is misleading because in Hedgewars, karma normally means that the attacker gets damage by attacking any hog. Karma is something negative for the attacker if it has it.
The type of karma used in your script can be more seen as a defensive/revenge measure because its not hog with karma which gets damaged by attacking others. I would rename it to “Anti Karma”, “Revenge”, “Revenge Karma” or whatever.

I suggest you to add version numbers of the form “_v”, e.g. “Monarchy_v1”.
To avoid future confusion with future version. I do not believe in the concept of “final“ versions. :P

By posting this on hh.unit22.org, this script would theoretically automatically appear in DLC (indirectly) as well because there's a link to hh.unit22.org in DLC at the moment.
However, since bender doesn't seem to review regularily review anything, it is not visible. Probably poke bender about this.

I am currently still unable to add anything on DLC, sorry. Sad Smiley

Maybe I'll write a full review about this script later. No promises, however.

Hi, I am a Hedgewars developer. Smile

KoBeWi
KoBeWi's picture
User offline. Last seen 2 weeks 6 days ago. Offline
Joined: 2010-12-25
Posts: 564

Wuzzy allegedly wrote:
I would rename it to “Anti Karma”, “Revenge”, “Revenge Karma” or whatever.
Thorns? That's the name usually used for such stuff.

Wuzzy
Wuzzy's picture
User offline. Last seen 2 weeks 23 hours ago. Offline
Joined: 2012-06-20
Posts: 1304

Nemo pointed me to a questionable coding practice you used in the Monarchy script. First I quote the chat log:

Quote:

<nemo> Wuzzy2: he's using "free" values in the engine that could go away in future releases
<nemo> he should not do that
* Szkod has quit (Quit: Starting a real life... for now.)
<Wuzzy2> point me to a code line plz
* Szkodnix (~Szkodnix@87-206-152-210.dynamic.chello.pl) has joined
<nemo> local gstHHShore = 0x10000000 -- HedgeHog Shoring Up gear state
<nemo> local gstHHLand = 0x20000000 -- HedgeHog Landing gear state
<nemo> local gstHHDJump = 0x40000000 -- HedgeHog Doble Jump gear state
<nemo> local gstHHTJump = 0x80000000 -- HedgeHog Triple Jump gear state
<Wuzzy2> oh-oh-oh-oh
<nemo> elseif clanof[CurrentHedgehog] == "Merfolks" and band(GetState(CurrentHedgehog), gstHHShore) ~= 0 then
<Wuzzy2> not good. hardcoding fake gear states? :>
<Wuzzy2> this is evil
<nemo> getGearValue(CurrentHedgehog, gstHHShore) ~= 0

So basically the problem nemo (and I) have about this script is that you are using non-standard gear states and check against them. This is a bad idea because we reserve the possibility to later add new gear states into Hedgewars. As soon we release a new HW version with a new gear state, your script will almost certainly break.
In other words, your script is not forwards-compatible.

Also note it is NEVER neccessary to add fake gear states like you do.

I suggest to remove all “custom” gear states. To save and read values for gears, I suggest you use the Lua library “Tracker.lua” included in Hedgewars. Please read this:
https://hedgewars.org/kb/LuaLibraries#Tracker

So instead of saving the fake gear state “gstHHTJump”, you can use a gear value using this library instead, which you could just set to 1 or 0 (on or off). The same applies for the other fake states, of course.

Hi, I am a Hedgewars developer. Smile

Tiotimolina
User offline. Last seen 1 year 10 weeks ago. Offline
Joined: 2011-12-25
Posts: 18

Wuzzy allegedly wrote:

So basically the problem nemo (and I) have about this script is that you are using non-standard gear states and check against them.

I link here to the script without custom gear states. It also uses SetAmmoTexts() and GetAmmoName().

Edit This post had an old pastebin link that's no longer active.

Wuzzy
Wuzzy's picture
User offline. Last seen 2 weeks 23 hours ago. Offline
Joined: 2012-06-20
Posts: 1304

Nice.

There's a small bug, however: The bottom part of the ammo panel still shows “Air Attack”, etc.
Sorry, there was incomplete documentation on SetAmmoTexts. I have updated it accordingly.

It is not allowed to call SetAmmoTexts before onGameStart has been fired. You can either call SetAmmoTexts in onGameStart, or at any later point. But not before.

In your case, simply move all SetAmmoTexts stuff into onGameStart and the bug is fixed.

I would also slightly rewrite the texts. First, add punctation / use complete sentences.
Second, write the ammo description it in this form to make it (hopefully) a bit clearer to the user:

Quote:
This is your current role.
Your goal: YYY.

Annoyingly, there is still this “unavailable” message at the bottom but currently there is not much you can do about it.

I think we can both agree that using this ammo menu to display the player's role is a hack. A clever hack, but still a hack. Big Grin
In the long future, I should probably look into ways to display information in a way so only one player can see it. But this is pretty low priority for me right now.

Hi, I am a Hedgewars developer. Smile

Tiotimolina
User offline. Last seen 1 year 10 weeks ago. Offline
Joined: 2011-12-25
Posts: 18

Wuzzy allegedly wrote:

I would also slightly rewrite the texts. First, add punctation / use complete sentences.

The problem are the sentences that should be localized but have a subject that varies. Example "hedgehog1 has killed an anarchist clan". It could be hedgehog1 or hedgehog2 or Crosby. That line has become "An anarchist clan died". Analogously the knights line.

The sentences in the end screen were like "Team_name (clan chosen) was royalty". It has become now "Team_name (clan): role" to avoid the loc("was") in the middle.

The former sentences in the mission were split in two lines, which makes them impossible to localize in some languages. They now lay in a single line.

Edit This post had an old pastebin link that's no longer active.

Wuzzy
Wuzzy's picture
User offline. Last seen 2 weeks 23 hours ago. Offline
Joined: 2012-06-20
Posts: 1304

Tiotimolina allegedly wrote:

The former sentences in the mission were split in two lines, which makes them impossible to localize in some languages. They now lay in a single line.

String concatenation is the translator's worst enemy.

string.format is your friend. This solves all problems related to string ordering.

I used this function extensively in many of my own scripts, and used it to fix translation issues in the official scripts.

Hi, I am a Hedgewars developer. Smile

Plarf
User offline. Last seen 2 days 22 hours ago. Offline
Joined: 2013-11-16
Posts: 31

We tried today.
Was nice
Got some LUA ERROR a few turn before the end of game.

Here you can get game log, demo and even chat text.
https://envoi.zaclys.com/remise/795ae6620ee1017374e1fce4b53ea350/2019-01-29_game0_log_and_chat_text_and_demo.zip

Why can't we wrap the border?

Tiotimolina
User offline. Last seen 1 year 10 weeks ago. Offline
Joined: 2011-12-25
Posts: 18

The error was due to an attempt to check if dead hogs with amphibious were in water during water rise on sudden death. This is done comparing coordinate Y of hogs: if it is below water line, it relocates the hog on land. Since dead hogs have no Y coordinate, Lua interpreter whines. Already fixed.

I noticed in this demo that I overlooked switcher + ice coat. Fixed that too. I will upload the next version within a few days.

With regard to border, it was set to none in the scheme according to game log, line 154.

Quote:
0: [Cmd] $worldedge 0

It should say:
Quote:
0: [Cmd] $worldedge 1

Just change it to wrap, should work. Wink Smiley

Thanks for the report. And glad you like the mode.

Plarf
User offline. Last seen 2 days 22 hours ago. Offline
Joined: 2013-11-16
Posts: 31

Tiotimolina allegedly wrote:

With regard to border, it was set to none in the scheme according to game log, line 154.
Quote:
0: [Cmd] $worldedge 0

It should say:
Quote:
0: [Cmd] $worldedge 1

Just change it to wrap, should work. Wink Smiley

Thanks, about wrap border I wasn't host and didn't check before telling you what host told me, sorry.

Monarchy is fun, thanks to you Tiotimolina.
Waiting to play it again, maybe with you.

Plarf
User offline. Last seen 2 days 22 hours ago. Offline
Joined: 2013-11-16
Posts: 31

AC and I complain about the lack of fine tuning advices:
[19:22] plarf: gimme your "Mona" scheme settings
[19:22] AC: pas encore!
[19:22] AC: oh
[19:23] AC: i dont know
[19:23] plarf: thx
[19:23] AC: they are probably original
[19:23] AC: timolina has not been very good on teaching out how to set this game up

Thanks bro

Tiotimolina
User offline. Last seen 1 year 10 weeks ago. Offline
Joined: 2011-12-25
Posts: 18

Done. New version will suggest Default as the scheme and One of Everything as the weapons. Balanced Random Weapons and Highlander are good options too.

Plarf
User offline. Last seen 2 days 22 hours ago. Offline
Joined: 2013-11-16
Posts: 31

After in game chat yesterday.
We randomly get 2 weapons, sometimes get 2 utilities. Then if we didn't stock older weapons, we won't be able to do anything next turn. As in BRW, it would be nice to be sure to get at least on attack weapon every turn.

For example yesterday, after a turn I used all my stuff, I get low gravity (x2). At this really moment, I didn't know if I wanted to ragequit or cry (so I did both).

Plarf
User offline. Last seen 2 days 22 hours ago. Offline
Joined: 2013-11-16
Posts: 31

Miiip Miiip

New thing: irregular thorns damage spotted.

Testing 1.0.0 alpha, the attacking hog get damaged because thorns, and he dies right when his life came to 0, without any direct damage and before the end of turn time.

I don't think it's a purpose thorns behaviour.

at 3mn30s, when apple attack with melon.
https://envoi.zaclys.com/remise/3b6801eb4784e46036322169922f8ea4/2019-06-29_14972.zip

Plarf
User offline. Last seen 2 days 22 hours ago. Offline
Joined: 2013-11-16
Posts: 31

yo,
Monarch AC get an error at 17mn40. Idk if it is Monarchy related bug...
Other players were able to end the game.
https://envoi.zaclys.com/remise/20127e4b2895e9f531ed61c0fc2cd1c5/2019-07-04_error.zip

Tiotimolina
User offline. Last seen 1 year 10 weeks ago. Offline
Joined: 2011-12-25
Posts: 18

Plarf allegedly wrote:

We randomly get 2 weapons, sometimes get 2 utilities. Then if we didn't stock older weapons, we won't be able to do anything next turn. As in BRW, it would be nice to be sure to get at least on attack weapon every turn.

It is now ensured at least one damaging weapon. Also, vampires will not receive the vampiric tool and switch-hedgehogs will not receive switches.

Plarf allegedly wrote:

Testing 1.0.0 alpha, the attacking hog get damaged because thorns, and he dies right when his life came to 0, without any direct damage and before the end of turn time.

Seems that's how karma works in hedgewars 1. The classic behavior can be hardcoded in mona if you all prefer it.

Plarf
User offline. Last seen 2 days 22 hours ago. Offline
Joined: 2013-11-16
Posts: 31

Tiotimolina allegedly wrote:

Seems that's how karma works in hedgewars 1. The classic behavior can be hardcoded in mona if you all prefer it.

I am used, when I have to fight against a thorns team, to wait until I have many and/or powerful weapons. I then sacrifice a hedgehog to do as much damage as possible.
I therefore prefer the 0.9.25 way (more balanced).
Wait for more opinion.

Plarf
User offline. Last seen 2 days 22 hours ago. Offline
Joined: 2013-11-16
Posts: 31
Plarf
User offline. Last seen 2 days 22 hours ago. Offline
Joined: 2013-11-16
Posts: 31
svito
svito's picture
User offline. Last seen 6 days 5 hours ago. Offline
Joined: 2018-06-25
Posts: 2

I have a bug. Traitor wins after killing 2 assassins and all but 1 monarch hog.

Demo file.

Plarf
User offline. Last seen 2 days 22 hours ago. Offline
Joined: 2013-11-16
Posts: 31
nemo
nemo's picture
User offline. Last seen 10 weeks 2 days ago. Offline
Joined: 2009-01-28
Posts: 1861

Are we getting to point of a stable release monarchy? Smile

--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev

Plarf
User offline. Last seen 2 days 22 hours ago. Offline
Joined: 2013-11-16
Posts: 31
L29Ah
User offline. Last seen 2 years 21 weeks ago. Offline
Joined: 2012-10-08
Posts: 4

Picking ice and puppetry at the same time breaks puppetry (you can't change the puppeted hog).

L29Ah
User offline. Last seen 2 years 21 weeks ago. Offline
Joined: 2012-10-08
Posts: 4

Also feature request: would be nice if Monarch would be opt-in, not opt-out, so the game is not ruined for everyone every time a noob gets to choose.

L29Ah
User offline. Last seen 2 years 21 weeks ago. Offline
Joined: 2012-10-08
Posts: 4

I wish collecting HP boxes would revive an eliminated Pick Up player, as Pick Up is kinda underwhelming now even with boxes spawning every other turn.

sheepluva
sheepluva's picture
User offline. Last seen 4 weeks 5 days ago. Offline
Joined: 2009-07-18
Posts: 563

Hey!

unit22 seems down and as this script is somewhat popular, we made v18 available on the official DLC.

(Thank you mpan for your assist in IRC chat)

Under the assumption that's okay with you guys. (If not, let us know!)

I wasn't sure about the DLC info for this script (creators/license/etc.), so please let us know how we can improve that.

Cheers!

  sheepluva <- me  my code stats -> 
a Hedgewars Developer


   <- where I'm from  what I speak -> 

Plarf
User offline. Last seen 2 days 22 hours ago. Offline
Joined: 2013-11-16
Posts: 31

Thanks a lot sheepluva.
I'm not involved in the monarchy creation nor development, so you may remove my name.
Ask Tiotimolina for license

Notes for script parameters:
ffa = no role
creeper = Easter egg weapon Bunny! (since v20, it was "duck" for v18/19)
multi = two abilities each
friendlyfire (only for v19)

sheepluva
sheepluva's picture
User offline. Last seen 4 weeks 5 days ago. Offline
Joined: 2009-07-18
Posts: 563

Thank you for your response Plarf!
I added some of the info to the DLC.
With regards to license I'll hope to be able to get into touch with Tiotimolina soon.

Cheers Smile

  sheepluva <- me  my code stats -> 
a Hedgewars Developer


   <- where I'm from  what I speak -> 

Tiotimolina
User offline. Last seen 1 year 10 weeks ago. Offline
Joined: 2011-12-25
Posts: 18

svito allegedly wrote:

I have a bug. Traitor wins after killing 2 assassins and all but 1 monarch hog.

Fixed.

nemo allegedly wrote:

Are we getting to point of a stable release monarchy? Smile

It goes back and forth.

L29Ah allegedly wrote:

Picking ice and puppetry at the same time breaks puppetry (you can't change the puppeted hog).

Fixed.

L29Ah allegedly wrote:

Also feature request: would be nice if Monarch would be opt-in, not opt-out, so the game is not ruined for everyone every time a noob gets to choose.

Not doing.

L29Ah allegedly wrote:

I wish collecting HP boxes would revive an eliminated Pick Up player, as Pick Up is kinda underwhelming now even with boxes spawning every other turn.

Maybe next version.

sheepluva allegedly wrote:

Under the assumption that's okay with you guys. (If not, let us know!)

It's ok.

sheepluva allegedly wrote:

I wasn't sure about the DLC info for this script (creators/license/etc.), so please let us know how we can improve that.

I updated OP.

Shadow_The_Worm
Shadow_The_Worm's picture
User offline. Last seen 4 hours 18 min ago. Offline
Joined: 2018-02-10
Posts: 50

Tiotimolina? I thought you died. Most of these recent version were published by other people (most notably Libera Monarchists who seem to act a little... off for their humanity). Thank god you actually have proven that you're alive.

sheepluva
sheepluva's picture
User offline. Last seen 4 weeks 5 days ago. Offline
Joined: 2009-07-18
Posts: 563

v19 is now available for download on the official DLC page.

Cheers!

  sheepluva <- me  my code stats -> 
a Hedgewars Developer


   <- where I'm from  what I speak -> 

Wuzzy
Wuzzy's picture
User offline. Last seen 2 weeks 23 hours ago. Offline
Joined: 2012-06-20
Posts: 1304

L29Ah has reported a bug in IRC:

Quote:
[...] Monarchy v19 throwing nil errors when one of the puppet options for a puppetry ability dies before a puppeteer chooses its victim

Hi, I am a Hedgewars developer. Smile

Plarf
User offline. Last seen 2 days 22 hours ago. Offline
Joined: 2013-11-16
Posts: 31

Be aware: Timolina is sharing v20

Wizard Hat!

User login

Copyright © 2004-2024 Hedgewars Project. All rights reserved. [ contact ]