How playing matches works
Added 2023-05-08 19:41:00 +0000 UTCI recently finished porting the 'play match' functionality to the offline version. This gave me an opportunity to go over it as a whole, and I thought you might like to take a look at how this part of the game works under the hood.

Note: You can view the code snippets attached in a gist here.
Let's walk through what happens when you play a match:
- Check for a "holy shit moment," generate text for it, and award or unlock artifacts. Identify any bloody superstars based on traits or gimmick matches, and update the visuals with blood effects.

- Calculate the match's rating, which takes a bunch of factors like workrate, traits, penalties, blood etc. Check if the match is 'hot', again affected by many factors including the rating.
- Change the popularity and overness of the winner and loser(s). These are done together as overness change depends mostly on popularity change.
- Process the match's superstars, check for face of the company / rank changes, simulate injuries, reduce appearances, debut new gimmick if set, update win/records, workrate xp, kayfabe points, fatigue and morale. Also, assess any existing streaks and either end or extend them.

- Process the match's championships, change or add to the reign and update prestige xp.
- Process the match's feuds, which includes updating hype based on the match's rating, start or blowoff feuds, check if a feud got 'hot' or 'stale', run a feud's consequence if present, and update the feud's prestige xp.
- If a gimmick match was selected, apply any selected consequences (like make loser unavailable), update prestige xp and generate battle royal / elimination text.

- Assess any consequences associated with the selected match finish (like alignment turns) and run them. Get any superstars selected for interference/distraction and increase their popularity slightly. Boost hype of any feuds between interfering talent and match talent.
- Save a match's attributes (winner, loser, championships changed, rating) for viewing in history.
Most actions, like injuries, have associated checks: goals, talent requests, messages, company alerts, news etc that they trigger.

Finally, there are some others parts to the code which I've omitted, like handling tournaments and cashins.
I hope you enjoyed this little look at the game's code. If you liked it, let me know and I'll do another one for the 'play segment' function.
Thanks for reading!
Comments
how much does popularity affect the outcome of who wins and who loses?
Pantscada
2023-05-12 01:17:58 +0000 UTC