Questions tagged [random]

Algorithms or methods to produce events or behavior that is random in nature.

Filter by
Sorted by
Tagged with
1 vote
1 answer
72 views

Random display of a character in Godot 4

I made a character in Godot 4 that enters from one side of the image and exits from the other side, which shows its different modes randomly each time. I have written these codes for it: ...
Nina Monti's user avatar
-1 votes
1 answer
172 views

The Random.Range function isn't activating when I call it. How do I get the function to work properly and call from a range of numbers?

As you can see, I'm attempting to set the random prey integer to a number within a random range like so: randomPrey= Random.Range(0,10); As I type the code out the .Range doesn't turn yellow and the ...
Gideon Falls's user avatar
0 votes
2 answers
97 views

Randomization algorithm that trades between more variance and higher total value

I need to generate discrete integer variables that each have meaning, so does their sum. I am essentially looking to partition a normal distribution into n bins. You can think of them as stats. The ...
Amilia C's user avatar
19 votes
5 answers
4k views

1v1 bartering brain game – see any problems?

While in line at Disneyland, my friends and I came up with a 1v1 bartering game. Here's how it works: Two players are negotiating the price of a good. One player is the buyer, one is the seller. ...
harkinian's user avatar
  • 301
0 votes
1 answer
59 views

Navmesh agents trying to go to destroyed objects

I am still working on the RTS and have added a system that allows enemies to randomly wander. However, when multiple enemies fight one of my units, they will just clump up Afterwords instead of going ...
Crystalline787's user avatar
0 votes
0 answers
60 views

Techniques for "fairer" dice rolls? [duplicate]

Suppose I have a game with 6 players, each of which gets a payout on a different side of a D6 roll. The D6 is rolled many times over the course of the game. This yields an even payout in the long run, ...
sdgfsdh's user avatar
  • 275
1 vote
2 answers
144 views

Methods for generating unevenly distributed item stats?

Conceptually, generating item stats is the same as placing balls into buckets. An even distribution of 50 balls into 5 buckets looks like this: [10,10,10,10,10] whereas an uneven distribution might ...
user2108462's user avatar
16 votes
5 answers
4k views

Looking for a middle ground between raw random and shuffle bags

I am working on a RPG that I have implemented spells with status effects that can be applied x% of the time. For instance a fire spell has a 25% chance to apply a burning debuff. Initially I just put ...
TyCobb's user avatar
  • 329
1 vote
1 answer
266 views

Generate random line path with no intersection

The idea is to generate a path with a certain distance m. Currently the generation pseudo code is as follows: ...
EEAH's user avatar
  • 113
0 votes
1 answer
212 views

Random value is chosen 2-3 times, then after that it's always 1

...
Daniel Lip's user avatar
  • 1,727
0 votes
1 answer
106 views

array of classes then give each class different properties, class selection random

So iam trying to practice java with a text based adventure game. This code gives out an enemy of an array(random) and then gives it a Randoam health between 0 and 100. What I want to do is give each ...
vampsz's user avatar
  • 15
0 votes
1 answer
762 views

Spawn crops/3D game objects randomly on a mesh/plane surface

I am stuck on a problem that might be quite simple yet it's getting on my nerves. I want to spawn crops on different plane shapes like in the attached screenshot. So far my progress is that I am able ...
Syed Munim Raza's user avatar
3 votes
2 answers
234 views

Should in-game events (raids) be announced?

Many survival games such as Rimworld will announce when significant events happen in-game. For example, when a raid, a disaster or a significant event occurs, the game will send a notification and ...
caleidon's user avatar
  • 561
0 votes
0 answers
176 views

How to assign a new value to a global variable in GML

I have a variable called global.goldchance = irandom(99);. I use it to get a random number from 0 to 99. However, I need to be able to run it again so that the ...
gmlnoob's user avatar
0 votes
1 answer
109 views

How to lerp between diferent spot angles

I have this code that Change spot angle randomly between 'minAngle' and 'maxAngle' each 'interval' seconds: ...
magdalena molinari's user avatar
1 vote
0 answers
193 views

how to raycast against a mesh instead of the object in unity

So I am trying to make random map generation for a game, and right now I am trying to use a raycast to get the height of the spot where a prefab will be generated, I am using a terrain and generating ...
Mason Walker's user avatar
-2 votes
1 answer
2k views

How to randomly spawn prefabs on the X axis?

I created an infinite runner game. I need to make random spawning obstacles in 3D. How do I randomly spawn prefabs on the X axis using a C# script?
Саша Ростягай's user avatar
0 votes
1 answer
179 views

Slots - Reel with a predefined symbol positions or make each symbol change independently on the others

I'm making a slot machine game and I need some advice on how to implement the spinning reels or how it's usually done. Right now, I'm thinking about two different approaches that would make sense - if ...
matronator's user avatar
0 votes
1 answer
134 views

Deriving multiple properties from a single random seed

I'm interested in designing a game with a randomly-generated world. I'd like the world to be generated from a seed value, so that players could share these seeds among each other and play in the same ...
Evan Kaye's user avatar
1 vote
1 answer
111 views

RNG random numbers/preset payout rate contradiction

Taking a casino slot machine for example: How can the probability of a payout TRULY be random with a preset payout rate? If a casino has slots programmed to a specific rate or percentage of payout, ...
Bill's user avatar
  • 11
0 votes
1 answer
152 views

Random Spawning Traffic at Pace Fitting "Frogger"-style Gameplay

In my game level, you have to cross a busy road to buy something and then cross back again. The general gameplay mechanics are now set up and playable. But I wanted to know if this routine I used to ...
I_Keep_Trying's user avatar
5 votes
2 answers
2k views

Can you show rng code running in real time in a game?

First off, I know almost nothing about game development/rng but I will learn. So apologies for sounding uninformed. I want to make a sandbox ios game with several activities to do within, one of which ...
Toddd's user avatar
  • 51
0 votes
1 answer
1k views

Why is Random.Range(0,3) generating only 0, 1 or 2 when 3 is supposed to be inclusive?

I'm currently having trouble getting my head around how Random.Range() and Array[].Length are working in the script below. ...
Meireles's user avatar
1 vote
0 answers
1k views

How to randomly change the color of a Shader Graph Material for only a specified GameObject, with C# script?

I'm working on a game, in Unity3D, where the player picks up trash from Trash cans, and dumps the trash from the Trash cans into a Trash Truck. The world of the game itself is randomly generated, with ...
Fox GAMING_NTF's user avatar
2 votes
1 answer
1k views

Given a 2D array, how do I generate a random path of fixed length from a random point at length 0 to a random point at max length?

I'm trying to generate a random path on a 2D grid given that: The width and height of the grid are given The length of the path to generate is given The path can't move "back" The path ...
Oro Portaluri's user avatar
1 vote
1 answer
344 views

How do I generate platforms in a specific position in godot?

I am making a rogue-like game in Godot. Currently, I am stuck with the world generation. I know how to add children, but I am wondering if there is a way to add those children in a specific position. ...
TheWorldSpins's user avatar
0 votes
1 answer
93 views

Preferred way of calculating run chances in Game of Cricket

For modelling a simple game of cricket, Considering a batsman has a single attribute rating. I can go about deciding run chances by weighted probabilities. ...
SomeTypeFoo's user avatar
1 vote
0 answers
104 views

How to create a random, warped 2D grid?

How do you create a random grid where the lines aren't orthogonal (and cells aren't a perfect square), but are warped? Here's an example of what I mean: (Credit: screenshot taken from a video by ...
Pandaqi's user avatar
  • 113
2 votes
1 answer
943 views

How can I create a persistent seed for each chunk of an infinite procedural world?

I'm coding a chunk-based 2D game. I generate chunks as the player explores the world. Chunks follow a procedural generation algorithm (with only one biome implemented at the minute, but I'll ...
Featherball's user avatar
0 votes
1 answer
373 views

Random.range giving me the same value at the same time

I created a random direction in x and y-axis at where to move, then my problem is when I tried to randomize it sometimes I get the same value at the same time on both x and y-axis. How do I not let ...
Saidus's user avatar
  • 91
0 votes
1 answer
593 views

How can I make an instantiation random?

I'm trying to do it so when I have an instantiated an item upon the game starting, it is random as to whether it actually instantiates or not. Here's the code I have so far: ...
BroCodeNode's user avatar
0 votes
1 answer
128 views

Random enemy generation algorithm help

I've been working on a program for my friends to use for a homebrewed roleplay system that we all use for our campaigns that can generate random enemy statlines with certain constraints. The program ...
lumamaster's user avatar
2 votes
3 answers
956 views

If and why is randomness a bad thing in competitive games?

AFAIK it is a consensus within esports that randomness should be reduced? League of Legends has little RNG, Dota has more but both games employ rng smoothing algorithms (details for Dota, LoL). The ...
gaazkam's user avatar
  • 937
0 votes
0 answers
212 views

Random world Points in GLSL for tree placement

I'm doing tree placement in the geometry shader in GLSL. I've made a seeded random vec3 function based on gold noise that looks like this: ...
Figwig's user avatar
  • 196
0 votes
2 answers
1k views

C++ Generate random float values between a range

In my current situation I have a game world, in that game world I want to place loads of tree models. It is a waste of time for me to actually explicitly define the x y and z values of each tree model,...
Kyle_Pearce's user avatar
3 votes
1 answer
431 views

How to generate random waves for a bullet hell game that feel balanced and natural

My game consists of 'waves' of objects called 'spawners', which once every certain amount of time (their firetime), move to a new place on the screen and spawn an enemy. Each wave has 4 important ...
NipIsTrue's user avatar
0 votes
2 answers
2k views

Random point on a square floor

I have a flat 10x10 surface (floor) made out of cubes of 1x1x1. I am spawning objects from the "sky" and I want them to fall on random points of the surface without exceeding the surface limits. Is ...
Thorvald's user avatar
  • 103
0 votes
1 answer
413 views

Is it possible to find a seed based on 10,000 generated random numbers?

I'm currently entertaining an idea I've had about procedurally generating a world. I would like the entire world to be procedurally generated on the fly. So when a chunk is loaded, it uses a seeded ...
Joe Fioti's user avatar
  • 123
1 vote
2 answers
185 views

How can I make my race game fair with all players and keep it climatic?

I'm making a minigame where up to 5 players have to race against AI or another player(the "enemy"). The race consists of prompts, the current player is asked to press a key in a given amount of time ...
Daniel's user avatar
  • 111
1 vote
1 answer
1k views

Saving predesigned tilemap "rooms" and access them in script in Unity3D?

I'm working on a top-down rogue-like in Unity3D, and I already have some kind of dungeon generation. The next feature I'd like to implement, is to predesign some kind of "event rooms" (i.e. boss ...
Tudvari's user avatar
  • 721
2 votes
1 answer
130 views

Quick way to approximate a truncated gaussian distribution?

I'm doing some procgen stuff and I need a truncated gaussian distribution. Basically, I need a way to get the same thing as this: ...
Schilcote's user avatar
  • 296
4 votes
1 answer
406 views

How to create characters randomly with a given skill and weighted abilites

I am trying to create random characters in my game. Each character has 33 abilities and one of 6 jobs. For each job you need to skill/increase other abilities. I am calculating an overall skill (...
basti12354's user avatar
0 votes
1 answer
138 views

How do I add a random number of points to my score stored in Player Preferences?

My problem is the value I get from Random.Range is not stored, but I get another value instead. In level 1 I press the "claim" button to store a randomly-chosen score In level 2 I retrieve the level ...
Rahul Patil's user avatar
3 votes
2 answers
629 views

How can I create a random deck of 7 cards every time they are all used?

I'm trying to create a Tetris like game in C# (Unity) and I've run into quite a problem on how I can generate 7 cards (tetrominoes) of which none are the same and when I run out of cards, I regenerate ...
Victor Raduca's user avatar
0 votes
0 answers
116 views

How can I change the parameters of the random events for each game entity?

I'm trying to write an easy-to-use random event system that has certain conditions and effects in Unity. It's a simulation game that contains multiple Person, City, Country, Faction elements. I have ...
Doğa Can Kılıç's user avatar
0 votes
1 answer
80 views

Random range issues

i tried to make a random spawn system, but when i tried to start it, it spawns more than 1 prefab, which is not intended as i wanted to spawn only one by one. tried some method to prevent from ...
Chan Ming's user avatar
2 votes
1 answer
766 views

Calculate a random position inside a 2D area excluding a subset

Given this area - - - - - X X - - X X - - - - - I have a GameObject size 4x4 and inside another GameObject size 2x2. I know how to calculate a random position ...
Jordi Huertas's user avatar
0 votes
0 answers
71 views

Optimal way to select a random item from a list based on its chance to appear in Unity [duplicate]

I am creating a random object spawning script in Unity with c#, and am wondering what the ideal way to do this task would be. So I have a list of 31 objects or so, of my special class type. Each one ...
Morgan's user avatar
  • 45
0 votes
1 answer
64 views

How to store information about a simulated sport match in a browser game?

There is a browser game called Soccerstar where users play in a soccer team and compete in matches against other teams. Matches are scheduled at specific times of the day and played automatically and ...
firion's user avatar
  • 109
2 votes
3 answers
773 views

Are dice-rolls for damage calculation bad design for a tactic focused game?

I'm trying to come up with a combat system for a turn-based RPG that is inspired by pen & paper RPGs, but with more importance on positioning and strategy. I feel like in games where a good ...
Gistiv's user avatar
  • 133

1
2 3 4 5 6