• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Game Mechanics Generating Experience - Random values

P

Patty_James

Guest
Hellooo :) !

So I've been planning out a game for a couple of months, and one of the main Game-Mechanics is that you, the player, is not necessarily repressented as a character.
You control chatacters in the game, making them do stuff, however you don't really control them as far as "making them jump over objects", but you really just set them tasks and the like.

In my game, you will start off by generating your two characters. When spawned, each character will have a different name and skills levels. You will not be able to choose their skills/levels in any way, and so if your character does not have the skills you like, you will need to generate another character.

This can not be done at any point in the game and has to be chosen from the very start.

The skill levels each character has will affect the quality of impact each character has on the game. If they are, for example, inexperienced at crafting, then anything they create/make will be very weak and break easily.

As each character does different tasks, their skill stats will improve alongside their chances of creating a quality item in that category.

As of yet, the known categories include:

  • Shooting: The characters ability to shoot rifles/guns/other weapons to fight or go hunting, etc. The lower their experience, the more likely that they will miss and the lower their chances of dealing a critical hit.
  • Cooking: The characters ability to cook/prepare food. The lower their experience, the shorter the shelf-life of the food, higher chance of food poisoning debuff as well as a lower affect on hunger for each player.
  • Crafting: The characters ability to craft objects. The lower their experience, the weaker and more easily it will break.
  • Tailoring: The characters ability to craft cloths/armor from materials gathered. The lower their experience, the weaker/less health each clothing piece will have as well as the lower itā€™s protection.
  • Mining: The characters ability to mine. The lower their experience, the slower/longer it will take as well as the less resources extracted.
  • Farming: The characters ability to farm. The lower their experience, the slower/longer it will take as well ass the less resources extracted.

My Question is: What would be the smartest way of generating the amount of EXP at the start for each character?

I want each one to spawn with random experience levels in each skill; none of them being very high to start off with, but still at different levels such as Shooting = 0, crafting = 3, mining = 1.

The way in-which I would do it would be to set each character to having a starting amount of experience overall, such as 50. Then to split that up into each skill until it is equal to 0.

I would use the choose() function to determine the amounts so they don't go too high in one skill and little to none in another.

Would this work or would there be a cleaner way of doing this, because the only way I can see is to:

Set the overall-starting-experience to a value of, say, 50.​

Then, in a step event go: choose(skill1, skill2, skill3, skill4...) *setting what this equals to a varible*;
if (*varible from above* == skill1){
character1Experience = choose(x, x, x, x...);
}else{​

And so on.

Any ideas would be awesome, thanks.

James Patmore :)
 

Yal

šŸ§ *penguin noises*
GMC Elder
If you're just interested in the technical side of how to do this, I'd just do something like this:
Code:
repeat(50){
  skill_experience[choose(0,1,2,3)]++
}
Just be aware that since this is a sum of several independent stochastic variables, the end result will approach Gaussian distribution... or in layman's lingo, most characters will have very average stats, and characters that are skilled in one thing and unskilled in another will be a rare occurence. If you want characters with a more extreme stat distribution, you might want to distribute stats another way... e.g. distribute set bonuses of 25, 15, 8 and 2 points randomly to stats; sometimes you get a character with 50 points in one stat, sometimes you get one with 25 in one stat and 25 in another, and sometimes they have points in all stats but are notably better at one thing than another.

Also, make sure that all characters' stats actually have equal usefulness so that any distribution is viable if the player knows what they're doing. For instance, cooking feels like it's useless on its own without farming or shooting skills (since hunting and farming are the main ways of getting food), so you should also make a character with high Cooking skill be better at foraging edible fruit and mushrooms, create medicine, or stuff like that so they can survive without having to also have access to another stat that brings in raw material to cook.
 
P

Patty_James

Guest
If you're just interested in the technical side of how to do this, I'd just do something like this:
Code:
repeat(50){
  skill_experience[choose(0,1,2,3)]++
}
Just be aware that since this is a sum of several independent stochastic variables, the end result will approach Gaussian distribution... or in layman's lingo, most characters ...
Riiight, duh. I totally forgot about the repeat(){} function, haha.

I think what I am going to do is to make sure that the skills all have at least one. Or else I am just going to make it so if one character is particularly poor at one skill, another is good at that. The idea being that you need both characters to function. As the game goes along, you will get more characters to control.

As for the evenly distributed EXP, I have tested it a little bit and played around and so instead of using just skill_experience[choose(0,1,2,3)]++, I am making it add a random value of 2, 4, 6 or 8 using the choose(); function, but only if the global.manSKILLexp (variable that says how much EXP will be randomly spread over each skill in the beginning of the game) is divisible by 2 (meaning it's even).

I am still playing around, but I have a fairly good idea as to where to go on from here. Thanks so much for your help, Yal! I will keep you posted if I have anymore questions :).
 
D

DariusWolfe

Guest
A way I've seen it done, to enable a semi-balanced skill level, is to have a point pool that is depleted as the game randomly assigns points to the various values. This was for attributes rather than skills, which allowed the remainder to be dumped into a final stat at the end, but it could work similarly for skills, too.

Something like... 60 points, distributed between 5 skills; Each skill would be initialized at 1, so it'd really be 55 points in the pool. Then randomly select the order you apply points to the skills, (this keeps the points from being consistently weighted toward the top of the list, which I'm assuming is desirable) and reduce the pool value each time you add points to a skill.

Something like:

var skill1 = 1
skill2 = 1
skill3 = 1
skill4 = 1
skill5 = 1
pool = 55

while pool > 0
{

temp = choose(skill1,skill2,skill3,skill4,skill5)
val = floor(random(x)) //x = value you want to add per iteration, maybe 1, maybe some other number
if val < pool //prevents you from taking your pool negative, if x is larger than 1
{

temp+=val
pool-=val
}
}

While I wrote this code on the spot, I have a similar need for my game-in-development that I haven't yet reached the point where I'm writing the code; Even if it doesn't help you, I'm a step further on my own game, now.
 
Top