Results 1 to 3 of 3

Thread: The Math is *significantly* different than I thought it would be

  1. #1

    Thread Starter
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,646

    The Math is *significantly* different than I thought it would be

    Please allow me to ramble for a moment. If you've read anything else I've posted recently you probably know I'm trying to create a game without having a clue what I'm doing.

    So to create content I decided to make a Tree that branches off randomly so that all branches don't have the same number of choices or outcomes.

    Each node in the Tree can be set up to give or take away points in various attributes - health points, experience points, etc.

    I started filling in some of the branches with test data just to see how it was working.

    Some of the test data was the point thing I mentioned above. Most nodes don't affect points at all. And the ones that do normally don't do anything point-wise until the end of the branch.

    This is where it got interesting for me.

    I realized I had no way of knowing how I well I was balancing the game. I was keeping track in my head.

    E.g. I gave a health point here. I took one away somewhere else.

    I was just doing it willy-nilly.

    (This tree is in an Access DB).

    I decided to write a few queries to tell me how many nodes gave + points per attribute and how many gave negative points per attribute. That assumed evenly distributed die-rolls and that all nodes had equal weight.

    It didn't take me long to realize that all nodes are no equal.

    For example, let's say there are 100 Entry points.

    You roll a d100.

    One branch doesn't branch any farther. If you roll that number you get one health point.

    You have a 1/100 chance of gaining 1 HP.

    Another branch breaks off into three more branches. One of those branches gives you 2 HP. You have a 1/300 chance of landing on the branch.

    So how to add all this together.

    I didn't think it really mattered much until I sat down and started doing some math.

    So let's multiply the above by 300 to make it easy.

    The 1/100 chance means 3 HP in 300 rolls.

    The 1/300 chance means 2 HP in 300 rolls

    So every 300 rolls you get five HP.

    I was wracking my brain trying to figure out how to do this recursively in real time to go through the tree and give me real-time updates where I'm at as far as balance goes.

    I figure some pretty big numbers will happen. In this game there will be hundreds of thousands if not millions of die-rolls.

    So then I had a brain-storm.

    When the tree is created just pass down the chance of the parent and multiply that times 1 over the number of children of that parent. Then store that percentage with each node.

    The ultimate percent chance (if I'm doing my math right and I don't know jack about probability) is the number of points divided by the chance to land on that node.

    So if the node is 1/300 but gives 2 points the the chance is 2/300 or 1/150 as demonstrated above in 300 die rolls.

    So now I can do a query on that.

    In other words, Nodes are definitely *not* created equal.

    I guess I should have known that but I didn't think about it until I started wondering if I was balancing the game properly.

    The way I plan to set it up is have it as 50/50 as possible and just supply raw numbers to the game engine.

    The the engine can modify those numbers by nerfing them for new players and making them harder for experienced players.

    So for a new player say 10% modifier.

    Multiply the Good stuff x 1.1 and multiply the bad stuff x 1 / 1.1. The good stuff is better and the bad stuff is less bad.

    And for experienced players make it say x 0.9 for the good stuff and 1 / 0.9 for the bad stuff. The good stuff is less good and the bad stuff is more bad.

    This is a learning experience.

    That is all.

    Also too, I got the algorithm right. I've run it several times and checked the math manually to make sure the numbers are right.

  2. #2
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,211

    Re: The Math is *significantly* different than I thought it would be

    It sounds like what you are describing is the Expected Value for each node.

    Sounds like you're having fun with it, which is great!

  3. #3

    Thread Starter
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,646

    Re: The Math is *significantly* different than I thought it would be

    I think I might understand what you're saying but not sure. Hopefully because I just finished the app that uses this and am about to upload the source in databank.

    So if I'm understanding this, then the way I'm calculating Probability is correct but determining how many points that will net (assuming enough equally distributed die-rolls) is the "Expected Value", correct?

    Thanks. Sorry it took me so long to get back to you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width