Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Theorycrafting: Enhancing gameplay with the power of math  (Read 3642 times)

Itnetlolor

  • Bay Watcher
    • View Profile
    • Steam ID
Theorycrafting: Enhancing gameplay with the power of math
« on: March 01, 2016, 12:36:46 pm »

I've noticed that in some games I've been playing lately (mostly classics) that taking a little time off to the side to do some math work (and simplifying the process via Excel) has improved the quality of my gameplay here and there, be it in the output of my gaming, or learning something new in the process.

For example, through some simple functions, applied correctly, I've been able to determine all kinds of stuff with my games, and make use of the information to better aid my progress; and through Excel, making the process of calculating other things I wanted to know as simple as changing the value of a cell or few.

I've tried looking around different sites and such to find out if anyone has explored other neat applications of math in gaming (besides using Rocket Science in Kerbal Space Program; that seems too obvious to require mentioning), and I couldn't really find anything relevant. If you found a good use of math or a mathematical formula for a game (optimizing damage or speed or something), then feel free to post it.



Some decent examples of math in action:

Rollercoaster Tycoon -- Through the use of the formula ( y/xz ), I was able to optimize my line waiting times for all of my rides that had some serious car/train distribution issues, which needless to say, led to tons of customer complaints about waiting in the line for ages. Log Flume's template "Logger's Revenge" is guilty of this, and a good proof of concept. Since the ride was 4m51s (291s) long (Y-value), and it also has 9 cars/trains (4 passengers each) active at all times (Z-value), then we need the best distribution possible by setting the MIN/MAX waiting times for the ride itself (Solve for X). X = roughly 32(.33333) seconds minimum and maximum. It'll continuously cycle at equal intervals, and with 5 queue tiles lined up, we have an average time of 6 minutes of waiting for the customers, and I have yet to hear any whining about waiting in line yet. As a secondary perk, in case the station brakes fail, there's more breathing room between cars/trains to allow the repairman some time to fix it before things go from bad to worse. Needless to say, it also looks more aesthetically pleasing, and like an actual theme park ride more (at least, the times I went to parks, it looks more familiar now).

I've also applied the Pythagorean Theorem for the starmap navigation in Starcon 2, along with taking Quasi-Space into account, which has not only helped me save fuel, but also time (In-game, and Real Life. Those numbers were also figured out using the same formula, converted for time); which ended up giving me an unique ending which keeps everyone alive; Ilwrath and Thraddash alike, with the Utwig still providing coreward aid, and possibly able to intervene in their zealous battle with the Ultron in hand to set the Ilwrath and Thraddash minds in line again, overall.

X-Com has also used a few tricks here and there to optimize my manufacturing (what sells the best (maximum (80 engineers) production rate and value-wise), what's the most optimal engineer output (40 or 80 is the magic number for me, depending on the project and need/value), and so on). I have yet to get the math down to optimize interception distribution for maximum effect (timing arrivals and the like, with fuel and ammo to spare). The engineer thing, I noticed allows me to spare my engineering a bit more so I can have others set on smaller projects to allow for more income along with the main project (most-all profitable small production jobs average within 3-4 hours per-project with 80 engineers assigned; having at least 240 engineers and enough space makes for a profitable base (due to having up to 3 3-4 hour long jobs working simultaneously, and selling upon completion of a unit. Watching the funds ticker slowly climbing is a beautiful sight to behold; unless you timed it so each project is offset by 1 hour each, and makes it rapidly climb instead.)). Since I also had sites that were overstocked with engineers (about 250 of them at 1 or 2 bases each), this came really handy in mass-production as a global effort, making the monthly expenses the only bottom-line to worry about (But when you're producing upwards to 5M-10M (10M-20M with 2 bases doing it) monthly, making medi-kits, motion detectors, and alien laser rifles (Final Mod; no material cost to produce), why worry?), permitting me to go to ridiculous lengths in UFO defense. Global surveillance, interceptors at nearly every base, losing a ship being a minor loss... the list goes on. Things got so insane, I needed a base for excess goods to use as an emergency fund cache. One of my bases effectively turned into a scrap yard, complete with 2 troops and 2 dogs, and maybe a laser tank. Good luck getting your weapons back, aliens. Beauty of it is, I can adapt this same principle to TFTD (and/or X-Piratez even), and give T'Leth a Terror From the Surface of their own.



Got any neat ideas, math formulas, games you want some math help with or want some ideas applied, to apply to any games (something that can be applied to all games, or even just a few specialized ones) to help out, feel free to post it.

EDIT:
I think the application of math also aided in me making a bomb in SS13 so powerful, the bomb range couldn't even contain the blast. That was a fun experiment. I think my numbers (provided by the admin) was something along the lines of (15,30,60) or something of the sort. In other words, the bomb range was nothing more than it's main support frame (and only the said frame remained), and atmos got knocked hard enough, a good chunk of it needed to be rebuilt. Hell, even the observation pod for the bomb range had it's windows blown off, and knocked my character to the ground, thanks to the shockwave. I think it also was large enough to lag the server for a moment. That was a good time. Kinda wish I took a screenshot of the damage.

EDIT EDIT:
Another nice perk of optimizing the ride time is also the fact that the income for the ride, based on the rate of customer use, is now stabilized to a more consistent number to track, meaning you shouldn't expect the income rate to increase or decrease, unless you directly adjust the price. Which is a new avenue I ought to check out; price adjustment as the ride (or ride type) ages. Some have rapid decay, others not. Finding this out will be a new place to look, but will unfortunately, take some time to learn/figure out. But this info will help tremendously with parks that need to be done by Year 4 (4 hours of playing) that may have a few pretty old rides in it already. So yeah, adjusting for diminishing interest.

All I know is that an ideal Year 1 value is equivalent to the excitement rating, but what's the depreciation rate? When would be the best times to lower prices to keep popularity/satisfaction up, and by how much (percent-wise) should it be adjusted per-year, if at that rate? I noticed that the fewer variables I am worrying about since doing this, the more finer details, like depreciation of rides (interest/income wise), I'm noticing that I also want to tinker with.

What will truly rock will be if I can do all this and get an optimal amount of guests at my parks (at least 1.5k by goal time or Year 2 even, depending on park), while retaining a minimum of 95% park rating the whole time.

EDIT EDIT EDIT:
Thanks Ludorum Rex for teaching me a new word. Title updated.

While at it, looking up the term 'Theorycraft' has given me much more relevant material in the same places I looked around previously for this topic. There goes my afternoon.
« Last Edit: March 01, 2016, 03:03:06 pm by Itnetlolor »
Logged

Levi

  • Bay Watcher
  • Is a fish.
    • View Profile
Re: Enhancing gameplay with the power of math
« Reply #1 on: March 01, 2016, 12:56:05 pm »

I think the only math I've ever used in gaming is counting, but I am pretty bad at math...
Logged
Avid Gamer | Goldfish Enthusiast | Canadian | Professional Layabout

miauw62

  • Bay Watcher
  • Every time you get ahead / it's just another hit
    • View Profile
Re: Enhancing gameplay with the power of math
« Reply #2 on: March 01, 2016, 12:57:15 pm »

literally any competitive game ever will have dps and any somewhat relevant statistic analyzed to death with dozens of formulas
Logged

Quote from: NW_Kohaku
they wouldn't be able to tell the difference between the raving confessions of a mass murdering cannibal from a recipe to bake a pie.
Knowing Belgium, everyone will vote for themselves out of mistrust for anyone else, and some kind of weird direct democracy coalition will need to be formed from 11 million or so individuals.

Ozyton

  • Bay Watcher
    • View Profile
Re: Enhancing gameplay with the power of math
« Reply #3 on: March 01, 2016, 02:01:01 pm »

Many video games are basically a series of calculations to make numbers go up and down, so it's not very surprising that knowing how to do math can be beneficial to playing them. I'm not very good at math, but fortunately most everyone has done all the calculating that needs to be done already for most games given they're popular enough, as miauw62 stated.

The Roller Coaster Tycoon thing is an interesting example. I never thought out the math that way, I just usually 'feel' how long queue paths and such should be based on how popular a ride is and how quickly a queue can empty out every time a new train arrives at the station.

BigD145

  • Bay Watcher
    • View Profile
Re: Enhancing gameplay with the power of math
« Reply #4 on: March 01, 2016, 02:04:09 pm »

Factorio has a lot of "lowest common denominator" going on when making efficient use of raw materials and intermediate products.

Any Tycoon game of merit has, at the very least, some dollars per minute or dollars per run math going on.
Logged

Ludorum Rex

  • Bay Watcher
    • View Profile
    • Wizards and Warlords
Re: Enhancing gameplay with the power of math
« Reply #5 on: March 01, 2016, 02:25:01 pm »

Gaming, "theorycrafting", and min/max'ing is what made my son much more interested in math than any encouragement of mine or school lectures ever did.
Logged

IronyOwl

  • Bay Watcher
  • Nope~
    • View Profile
Re: Enhancing gameplay with the power of math
« Reply #6 on: March 01, 2016, 02:28:18 pm »

I like me some math in my games, but I usually either don't care enough about optimization to bother, or the systems are too complex for me to figure out.

The only really heavy math project I can recall at the moment was plotting out resistance:damage reduction values in Warlock to figure out how defenses scaled. Turns out each point increases your maximum HP against that damage type by 2%, as I recall, regardless of how much or little you already have.
Logged
Quote from: Radio Controlled (Discord)
A hand, a hand, my kingdom for a hot hand!
The kitchenette mold free, you move on to the pantry. it's nasty in there. The bacon is grazing on the lettuce. The ham is having an illicit affair with the prime rib, The potatoes see all, know all. A rat in boxer shorts smoking a foul smelling cigar is banging on a cabinet shouting about rent money.

Drakale

  • Bay Watcher
  • I will get my revenge~
    • View Profile
Re: Theorycrafting: Enhancing gameplay with the power of math
« Reply #7 on: March 01, 2016, 02:53:49 pm »

I'm sad to admit I made myself an excel sheet to choose my cookie clicker upgrades more efficiently.
Logged

Hanzoku

  • Bay Watcher
    • View Profile
Re: Theorycrafting: Enhancing gameplay with the power of math
« Reply #8 on: March 01, 2016, 03:08:08 pm »

World of Warcraft, back when I played it. Through the first several expansions, it was also vital for tanks to do so to maximize survivability and threat generation. Thenn threat went out the window, but it was still needed for maximum longevity. Couldn't guess if it's as necessary these days, though.
Logged

Itnetlolor

  • Bay Watcher
    • View Profile
    • Steam ID
Re: Theorycrafting: Enhancing gameplay with the power of math
« Reply #9 on: March 01, 2016, 03:13:01 pm »

Speaking of speedrunning, I've applied a bit of Theorycrafting in my head when playing Speedrunners (Trig and/or physics, apparently; which I also apparently suck, yet rock, at doing simultaneously. Numerical theory (writing it down, and actually doing the number crunching math), I suck; practical application by sight and feel, I rock.), to the point of maximizing my momentum (via grapples) returns for a steep and fast enough descent at a sharp enough angle. In other words, watch that chicken-man fly.

The remaining steps is optimizing my vectors to the racing line of levels (including allowing for another smooth grapple trajectory to keep my speed, and go greater distances), and I should climb the ranks quickly enough. Accounting for the weapons (boxes, missiles, fireballs, shockwaves, ice beams, and golden grapples), as well as the skills of other players, however, is a different matter, and requires clever use of counter-attacking to retain course navigation consistency.

EDIT:
If you feel like doing some math for this game, we can always go faster. To start, grappling hooks (not golden ones) are fixed at either 45º or 65º (which should help for adjusting for angular momentum) when fired, and we can assume our heroes are 1.5 - 2 meters tall, if that helps where fixed numbers are concerned. If at least, if you're recording it, to determine the speed of movement in a more recognizable form. (Velocity in meters per frame/second).

With a good enough system set, I think we can assume the maximum gains for grappling at the right spot, and releasing at the right spot. For best results (1:1 momentum, I would assume if 65º was the initial hook, release at the same angle as you hooked, but at the opposite side of the vector. Anywhere below that line speeds you up, and above it slows you down.
« Last Edit: March 01, 2016, 03:46:23 pm by Itnetlolor »
Logged

EuchreJack

  • Bay Watcher
  • Lord of Norderland - Lv 20 SKOOKUM ROC
    • View Profile
Re: Theorycrafting: Enhancing gameplay with the power of math
« Reply #10 on: March 01, 2016, 03:42:07 pm »

Some older games (early '90s) didn't do any of the math, even if necessary to understanding the game.  I thought 1869 and Motor City, both by Max Design, were notorious for that.

Mookzen

  • Bay Watcher
    • View Profile
Re: Theorycrafting: Enhancing gameplay with the power of math
« Reply #11 on: March 01, 2016, 07:56:57 pm »

inb4 Monte Carlo Simulation based predictive modelling of highly multidimensional in-game systems
Logged

Itnetlolor

  • Bay Watcher
    • View Profile
    • Steam ID
Re: Theorycrafting: Enhancing gameplay with the power of math
« Reply #12 on: November 05, 2016, 01:21:42 pm »

Sorry to necro my own thread, but my interest in this area of math/gaming has returned, to a degree.


Rant aside, I feel like we can expand upon this by sorting out what math works for what genres and the like. It doesn't always have to be about optimization. We can always run experiments with the math systems, or with the games as the subjects of some mathematical tinkering.

Obviously, for some games like Age of Empires, where optimizing is accounted for, I already learned that 4 villagers working on a single building project is the most optimal speed to work on anything (square the amount for a wonder); and having 4 of the same building type will make an army (of same class) in a jiffy, provided the resources. But what about using geometry to make an optimal layout of an empire's land (or maximizing income from trade caravans by learning pathfinding, and making the longest (legal (e.g. no palisade wall maze fake distancing for a few extra gold)) route possible?)? How to harvest a forest in the least time (to make more buildings, or carve out a path to another opening, without using catapults to carve the paths; excellent for early-game plotting), or geometrically plotting a strike pattern to maximize damage sans upgrading units (strike with fewer, not always better; if you're a penny-pinching monarch)? With that in mind, any other mathematical angles we can apply to these kinds of games?

In short, more experimenting and learning, less munchkin-based optimization:
-RTS games have potential uses for Geometry and basic Algebra. Similar could be said of city-building/god games.
  =You can rig elections on Tropico better than our own candidates in recent elections even. Rock the vote in your favor by manipulating the odds, or promising something you're almost done doing anyway, but leave it incomplete until election day for promising it. Easy votes. (Just calculate the time of completion, influence impact, and costs, and you're set. I always win with 95% or better political ratings minimum by the end of my games; despite crashing the economy early, and all other crap here and there I've pulled when playing. Including having a landfill as town square.)
-Turn-based games like XCOM and Civilization can also use some math tricks, if you know where to apply them properly.
  =Gradually adding more engineers as you supply your income making motion detectors is a nice accelerator to fortunes (+1 engineer every time the ticker hits $70k helps (+$20k overhead for materials). So you basically gain 1 engineer every 12-24 hours (instead of a cluster of them every 72 hours straight up), and every 9 engineers steps up your daily profit by another unit. Meaning your profit margin increases roughly weekly at this rate; speeding up the hire rates as well as constructions in the long run.
  =Comparing profitable items, motion detectors make great early-game income, while laser/gauss cannons work even better later on.
-Even RPG(-like) games like Starcon makes good use of the Pythagorean Theorem for navigation. Fuel/time cost, Quasi-space taken into account even.
-Action games, and anything realtime uses the DPS system, naturally. But what else can be abused mathematically?
-Simulation games can make good use too, especially if you're into doing some tricks; be they trick shots, stunts, or otherwise.
  =Heck, how much theorycrafting has been put to use to make more exotic spacecraft for Kerbal Space Program that still follows basic rocket science?
  =Of course, like I stated above, have fun looking for anything along those lines, because you'll have nothing but competition games plaguing the results.
  =Ever optimize a Suzuki Escudo to do a wheelie? They did. And so did I. Here it is in action.
  =Alternatively, engineering the ultimate drifters/racers/dragsters, with some (not as) simple maths.
-Experimental crafting/physics puzzle games, like Besiege or Powdertoy, can make some good use of some basic physics and geometry.
  =I mean, my 'Carnival Ride of Doom' can always use some additional tinkering to make it even more menacing.
  =Though not gaming, exactly, I did learn the miracle as to why my house is so hurricane-proof, despite all the close calls that nearly hit us. I researched the miracle. Like a cheap wind-tunnel.
  =Bridge it with reality, if you want, and see how accurate simulators are to the real thing; and if you have more/better math, submit it for the next updates.

There has to be more than what has already been mentioned in this thread. Heck, even pull up a sparknote/cliff's note, and see what's listed could be used for what games. What I like to see is more unorthodox/lateral thinking. Think outside the box, and beyond the obvious. What is there that we have yet to screw around with? Even with games we already theorycrafted to death (think cheat codes/cheat engine and such)? With cheating involved, what other nonsense can be pulled off, just by calculating a few things and tinkering a bit here and there?

EDIT:
I'm sure anyone doing a let's play can make use of this for narration purposes too. Shadow President could use some help, if anything can be quantified for crafting with. Is a nation not willing to follow any policy you have in place? Crunch some numbers, and make them follow it, and make them think it was their own idea in the process (Sorry, I haven't actually played it, but I figure it would be in the cards if you know how. Just see my Tropico example above.).

EDIT EDIT:
A good combo I've been trying out was Final Fantasy XII, some Cheat Engine, and some theorycrafting, to make for some fun battles. So far, not so much luck in that field; and that with the guidebook helping. Although I can affect enemies one way or another, I can't seem to spot their creature ID and change them into something else. For example, the Garamscythe Waterway being plagued with Yiazmats. So far, I can only make dire rats as deadly as a Yiazmat, however.
« Last Edit: November 05, 2016, 04:02:32 pm by Itnetlolor »
Logged

Shadowlord

  • Bay Watcher
    • View Profile
Re: Theorycrafting: Enhancing gameplay with the power of math
« Reply #13 on: November 05, 2016, 07:08:25 pm »

I'm curious, when did you finish Star Control 2 (in-game)?

I ask because I actually kept track of what I did, and when, when I did my second playthrough in 2008, and I'm curious how much faster you finished.

Spoiler: from my notes (click to show/hide)

More topic-ly, once upon a time I made a ginormous spreadsheet for ship designing in starmade, to do math for me without having to go so far as to write a program to do it. The game's more complicated now though. Also other games, but mostly just simple things like figuring out the most efficient way to design something by whatever criteria in games whose designing-systems can be "solved."
Logged
<Dakkan> There are human laws, and then there are laws of physics. I don't bike in the city because of the second.
Dwarf Fortress Map Archive

Itnetlolor

  • Bay Watcher
    • View Profile
    • Steam ID
Re: Theorycrafting: Enhancing gameplay with the power of math
« Reply #14 on: November 05, 2016, 10:44:07 pm »

I didn't keep timestamps of my progress, exactly, but based on my latest notes I still have in reach (before I had to upgrade my computer and such) since data salvage; thank goodness I still have the spreadsheet, formatted and everything. On topic, it seems I was halfway through 2157, just about when I was screwing over the Druuge (a calculated strike with JUST enough fuel to be at 0 upon reaching them) before finishing things off overall. Meaning I was near-endgame by that point. So I think halfway through June was my finish time. So 2y 4m 14d since the game begun, approximately, according to my spreadsheet calculations.

If I can salvage my saves, I can be more precise.

I wasn't speedrunning, it was more a blind-run, despite already knowing the story; but I like the narrative I ended up with when I finished; partially planned, and almost failed too.


EDIT:
What was cool was figuring out where all 10 rainbow worlds were on my own with the limited clues I had.
Solution: Just line up the 2 you learn from the Slylandro and the 1 you learn as a clue from the Shofixti, and that should line you up with Groombridge. About 14-16 systems should be crossed between those paths. Power of deduction, and a portal spawner, pinpoints the remaining worlds easy enough. Boom, easy 5000 Credits

EDIT EDIT:
We can always calculate for story, like I did with Starcon 2. I optimized for a happier ending than the usual.
« Last Edit: November 06, 2016, 11:36:11 am by Itnetlolor »
Logged