NATION

PASSWORD

Big Data: A Guide to Using Numbers in Your Roleplay

For all of your non-NationStates related roleplaying needs!
User avatar
Vienna Eliot
Diplomat
 
Posts: 554
Founded: Feb 16, 2018
Inoffensive Centrist Democracy

Big Data: A Guide to Using Numbers in Your Roleplay

Postby Vienna Eliot » Sat Mar 03, 2018 3:21 pm

Big Data: A Guide to Using Numbers in Your Roleplay
by Vienna Eliot


This thread will eventually die, but it's ideas don't have to! Read the guide by clicking the cover below, or read the transcript beneath it.

Image


I've already lied, but that’s kind of the point. This isn’t a guide to applying terabytes of data to your roleplays. Instead, I’m teaching you how to fake it — to make numbers that simulate the real world’s big data, and to apply that to make your roleplays all the more realistic for it.

So what's the point? I can think of a few things. Can your political roleplay benefit from a realistic, mathematically-generated election result? What if your faction roleplay was better equipped to handle complex traits and characteristics? Haven’t you ever wanted to make a world roleplay that features organic events at unexpected times? Could your turn-based roleplay attract more players with the promise of more than random numbers?

You'll need the following materials. Consider getting your hands on a spreadsheet program: Excel, Google Sheets, or something else; a spreadsheet formula reference document; and an understanding of basic algebra. These tools will make our excursions into the world of data analysis possible. Though not absolutely necessary, I also recommend the Solver Excel Add-On, XLSTAT, and a working knowledge of the R programming language.

Here are the basics: spreadsheets are big calculators. Here's how to use them. The spreadsheet is a map of cells. A cell is located by its address — a letter for its column and a number for its row on the sheet. A1 is the first cell.

We can work with cells and ranges of cells. A1:B20 is the first 20 cells under column A and the first 20 cells under column B. You can store data in each cell. Each piece of data is called a value. Values can be words, numbers, dates, or times. Try entering the number 2 in A1. Cells can also hold formulas, which allow values to interact. Formulas are preceded by an = sign. Try entering =A1+1 in B1. Try =A1-1 in A2. Now, can you build a formula in B2 to multiply A1 by B1?

There hundreds of formulas already built into every spreadsheet program. Here are a few:

=SUM returns the sum of multiple, or a range of, values.
=AVERAGE returns the average of multiple, or a range of, values.
=COUNTIF counts how many values in a range meet certain criteria.
=RAND yields a random number between 0 and 1.
=RANDBETWEEN yields a random number between two values.
=MAX finds the largest number in a range.
=MIN finds the smallest number in a range.

Can we build a simple engine to calculate the winner of a few games of rock-paper-scissors? Two players each assign ten points between the three categories, and whoever has the greater number in two out of three wins. We can set up player inputs in B2:D3, then in B4 we can use MAX(B2:B3) and paste that in B4:D4. Comparing who used what number shows us the winner — if we want, we can use FIND and MATCH functions to have the spreadsheet name the winner for us without making us compare numbers.

There are also a few logical functions, and they fit together to build larger logical formulas. Here's their syntax:

=IF(condition,return_if_true,return_if_false)
=AND(condition,condition,…)
=OR(condition,condition,…)

Who would win in a fight? Let’s make a table where F1 is the odds of the favorite winning, F2 is the odds of the favored team winning the tournament, F3 is the odds of the underdog winning (=1-F1), G1 tells us whether this table represents the favorite (TRUE or FALSE), H1 tells us whether the favorite is a member of the favored team, and finally G2:H4 gives us how much strength, wit, and charm the player has (s,w,c). We want the fight score to be in E1.

F4=IF(G1,F1,1-IF(H1,F1-F3,F1-F2)), and E2, E3, and E4, with the character identified by the MID function changing for each one, =IF(OR(AND(G1=TRUE,H1=TRUE),AND(G1=FALSE,H1=FALSE)),(F2/9)*AVERAGE(MID(G2,1,1),MID(G3,1,1),MID(G4,1,1),MID(H2,1,1),MID(H3,1,1),MID(H4,1,1)),(F3/9)*AVERAGE(MID(G2,1,1),MID(G3,1,1),MID(G4,1,1),MID(H2,1,1),MID(H3,1,1),MID(H4,1,1))). E1=PRODUCT(E2:E4).

Here are some common problems and their solutions.

=AVERAGE functions yields #VALUE!
Try using an =IFERROR in the range being averaged to set errors to blanks.
=COUNTIF doesn’t work for inequalities
Inequalities require you to use syntax (“>”&A1) to say ”greater than A1.”
=RAND won’t generate a random option from a list
Built-in random functions will only generate numbers. Use an =INDIRECT formula to generate randomly from a range.
#REF!
You’re referencing a cell that doesn’t exist. It will appear in the formula bar as #REF! once you recalculate the spreadsheet.
#N/A appears with =LOOKUP
The value you are trying to lookup (or telling the sheet to lookup) does not exist. Rewrite your formula if you know it does.

As with anything, Google is one of your best friends here. You’ll learn the most by challenging yourself and fixing problems as they come up.

Lastly, let's build a robot. Can we make a spreadsheet that can learn? Sure! There are a few ways to actually lay out the architecture behind this, but in general you’ll need the following:

A desired linearly separable output — let’s say (0,0,0,1).
Three binary inputs — one fake (always 1), and (0,0,1,1) and (0,1,0,1).
A net weighted sum, from three weights multiplied by their respective inputs.
An output — that is, a logical function that says if the net weight is greater than 0, return 1, if not return 0.
A learning coefficient — 0.5 is fine.
Three values indicating the sequential change to each weight, determined by the multiplication of the coefficient, the input, and the desired output minus the actual output.

As we modify the weights with the change to each weight through each round, the machine gets the actual output closer and closer to the desired output. Eventually, it figures it out.

What’s the general lesson here? Well, we used linear algebra to build a spreadsheet that could “learn.” By using other mathematics, we can make spreadsheets that suit all of our needs. The spreadsheet is your friend, my friend. Use it.


Feel free to ask any questions here about using spreadsheets and math in your roleplays. In particular I'd like to thank Arkolon, with whom I've been making spreadsheet games for a few years now, and Ainin, who reviewed the design for the PDF of the guide.

Return to Portal to the Multiverse

Who is online

Users browsing this forum: Dragos Bee, Google [Bot], Hypron, Rudaslavia, Sao Nova Europa

Advertisement

Remove ads