Bet engine

Bet engine

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
BrainDamage
Lobby Developer
Posts: 1164
Joined: 25 Sep 2006, 13:56

Bet engine

Post by BrainDamage »

here's a beta release of a bet engine I wrote, also included is a simple console only demo to interface with it, I have no plans to make a graphical version, so I hope someone else will pick that up

Rules:
  • only spectators can bet
  • your starting score is number of rts game players -1
  • you will bet against the time when a player or an unit will die
    ( having 0 units will be considered a player's death )
  • you can bet multiple times on the same unit/player, each time the bet cost will increase by 1
    ( so first bet on itemA will cost 1, second will cost 2, third will cost 3, etc )
  • when the unit/player dies, the better who got closest collects the victory, so there's always a winner
    ( if specA bet on death at 15 minutes, specB bets on death at 16minutes, and player dies at 60 minutes, specB collects the victory )
  • the reward for a victory is equal to number of bets being made on the player/unit
    ( so betting multiple times on the same player whilst increases your victory chances has diminishing returns )
  • you cannot bet on the same time another contender did: first come, first served
  • you need to bet at least x minutes ahead in time for the death, where currently x=5 ( so at minute 0 the time of death must be at least 5, at time 13 the time of death must be at least 18 ), this was added to prevent "bet sniping" ( betting the last second when a player is about to die, especially if automated with a widget ), I might consider allowing shorter time in the future, but I'll still keep an hard limit and make the bet cost more as it approaches the min time limit
  • a bet isn't considered over until a player/unit dies
  • at the end of the rts game, the spectator with highest score wins
demo console frontend commands:

/printscores: will list all spectators which placed at least a bet, with it's current score, number of won and lost bets
/printbets betType betID: will list all bets placed, if betType is specified, only those types wil be shown, betID can be a playername or an unitID to only show for a specific entry
/placebet betType betID Minute: betType can be team or unit, betID will be the playername for team or unitid of unit

marker frontend usage:
you place a marker near an unit with a text, the widget will search for certain keywords and place a bet for you if matching, the list of keywords is:
"fail at ", "fails at ", "dead at ", "dies at ", "dead by ", "die at "
so if a sentence will be formatted like "this idiot will fail at 20 minutes" the widget will reckognize it as a bet and place it for you
a bet will be default on an unit unless the string contains the following keywords:
"player","pro","pr0","noob","newbie","idiot"

widget links:
console frontend
marker frontend
bet engine
Attachments
cmd_bet_engine.lua
(13.12 KiB) Downloaded 34 times
cmd_bet_commands.lua
(6.36 KiB) Downloaded 36 times
cmd_bet_marker.lua
(2.39 KiB) Downloaded 50 times
Last edited by BrainDamage on 10 Jan 2013, 21:09, edited 14 times in total.
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: Bet engine

Post by abma »

how to easily get the teamid?

i always get "betted teamID does not exists" when i type

Code: Select all

/placebet 1 1
for example
User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

Re: Bet engine

Post by very_bad_soldier »

BrainDamage wrote: /placebet PlayerName Minute: will place a bet on PlayerName at Minute
placebet only expects PlayerName and Minute, no?
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: Bet engine

Post by abma »

oops, my stupidy...works!

imo /printbets without parameter should print all bets
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Bet engine

Post by Jools »

BrainDamage wrote: [*]you can bet multiple times on the same player, each time the bet cost will increase by 1
You mean team and not player?
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10450
Joined: 24 Jan 2006, 21:12

Re: Bet engine

Post by PicassoCT »

Brilliant.
User avatar
BrainDamage
Lobby Developer
Posts: 1164
Joined: 25 Sep 2006, 13:56

Re: Bet engine

Post by BrainDamage »

Jools wrote:
BrainDamage wrote: [*]you can bet multiple times on the same player, each time the bet cost will increase by 1
You mean team and not player?
It is indeed team, but considering the confusion that people have between team and allyteam, i preferred to type player ( and the few cases were people share controls are rare, and i think it'll still be self evident by not being able to distinguish the unit ownership within the players in the control team )
User avatar
BrainDamage
Lobby Developer
Posts: 1164
Joined: 25 Sep 2006, 13:56

Re: Bet engine

Post by BrainDamage »

updated the widgets:
the api now has an additional callback for when a player places a bet
score reporting also reports now currently running bets for each player and total ever placed
callback functionality now supports multiple widgets inserting callbacks
now printbets without arguments prints bets for all players
much less code duplication in the demo console example
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Bet engine

Post by knorke »

instead of typing commands make it work by placing markers!
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Bet engine

Post by Beherith »

So rebetting doesnt increase the prize pool?
Mind if I include in BA?
User avatar
BrainDamage
Lobby Developer
Posts: 1164
Joined: 25 Sep 2006, 13:56

Re: Bet engine

Post by BrainDamage »

hopefully final update: fixed a couple bugs and typos left, added another function to the api to fetch next bet cost
Beherith wrote:So rebetting doesnt increase the prize pool?
It does increase the prize pool, but just by 1, example:
PlayerA bets at time 15, bet cost:1
prize pool: 1
playerB bets at time 20, bet cost: 1
prize pool: 2
playerA bets at time 22, bet cost: 2
prize pool: 3
playerA bets at time 10, bet cost: 3
prize pool: 4
playerB bets at time 8, bet cost: 2
prize pool: 5
now playerA spent 1+2+3 points = 6
playerB spent 1+2=3 points
pool has 5 points to win

it's worth to bet multiple times on a player if there's already plenty of bets from other players to win from, but spending all your points on a single player isn't a good strategy this way
Beherith wrote:Mind if I include in BA?
go ahead, the more have it, and the better it'll be

knorke wrote:instead of typing commands make it work by placing markers!
honestly I'm not sure how's supposed to work, but feel free to add any frontend you like
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Bet engine

Post by knorke »

honestly I'm not sure how's supposed to work, but feel free to add any frontend you like
well instant of having to type playerIDs or player names, you just place a marker on a player:
Either in their startbox or on their base or on their commander, usually units are spread out enough that it should be clear which player is meant to be marked.
Marker text indicates what type of bet you want.

Another way would be to just select the players units.

But with the markers it has some elegance, spectators often place markers such as "fail" on commanders anyway, so just turn that into a game.
dansan
Server Owner & Developer
Posts: 1203
Joined: 29 May 2010, 23:40

Re: Bet engine

Post by dansan »

Oh my... speccing just got even better! Looking forward to FFA :)

I didn't test, so asking: does it, or can it be made to always do /printscores at the end of a match, if more than 1 player placed a bet, so the stats end up in the replay?
User avatar
BrainDamage
Lobby Developer
Posts: 1164
Joined: 25 Sep 2006, 13:56

Re: Bet engine

Post by BrainDamage »

moar updates!, added a widget to place bets using markers, fixed hopefully the last bug in the engine

to bet on someone, write a message in the format like
dies at 25, deat at 40, fails at 15, fail #5, etc
you can use them in the mid of a sentence, such as
this noob is terrible, i'm sure he'll die at 15 minutes
the full list of keywords is:
"fail at ","fail #","fails at ", "fails #", "dead #", "dead at ", "dies at ", "dies #"
you can append as many as you like to the widget

dansan wrote:I didn't test, so asking: does it, or can it be made to always do /printscores at the end of a match, if more than 1 player placed a bet, so the stats end up in the replay?
it does already, BUT echo is local, it's not sent over the network, and dedicated server runs no widget ( i'm also not even sure that Echo is saved in the replay for a local game ), so the replay won't record it, i might make all players send a hidden lua message with their own version of the scores for the server to parse, which would be saved in a replay
User avatar
BrainDamage
Lobby Developer
Posts: 1164
Joined: 25 Sep 2006, 13:56

Re: Bet engine

Post by BrainDamage »

BrainDamage wrote:
dansan wrote:I didn't test, so asking: does it, or can it be made to always do /printscores at the end of a match, if more than 1 player placed a bet, so the stats end up in the replay?
it does already, BUT echo is local, it's not sent over the network, and dedicated server runs no widget ( i'm also not even sure that Echo is saved in the replay for a local game ), so the replay won't record it, i might make all players send a hidden lua message with their own version of the scores for the server to parse, which would be saved in a replay
done, search for the luaui message in the replay formatted as

"betreport: player " .. playerID .. " score " .. score.score .. " running " .. score.currentlyRunning .." won " .. score.won .. " lost " .. score.lost .. " totalplaced " .. score.totalPlaced
dansan
Server Owner & Developer
Posts: 1203
Joined: 29 May 2010, 23:40

Re: Bet engine

Post by dansan »

IMO this is the kind of stuff, that makes ppl love a community!
BrainDamage wrote:done, search for the luaui message in the replay formatted as [..]
Very nice! It's on my todo list :)
User avatar
Jazcash
Posts: 5309
Joined: 08 Dec 2007, 17:39

Re: Bet engine

Post by Jazcash »

Would be nice if there was a way to place private labels only to specific players. That way you could make it so that widgets like this only place labels for other players with the same widget or w/e.
User avatar
BrainDamage
Lobby Developer
Posts: 1164
Joined: 25 Sep 2006, 13:56

Re: Bet engine

Post by BrainDamage »

bump for bugfix on the engine
User avatar
BrainDamage
Lobby Developer
Posts: 1164
Joined: 25 Sep 2006, 13:56

Re: Bet engine

Post by BrainDamage »

updated, now the engine can handle bets on single units too, bet when the advfusion gets bombed by floris!
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10450
Joined: 24 Jan 2006, 21:12

Re: Bet engine

Post by PicassoCT »

IF this got connected with paypal.. spring could get crack for the game addicted- quite litteraly
Post Reply

Return to “Lua Scripts”