Questions tagged [random]

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

Filter by
Sorted by
Tagged with
1
vote
0answers
39 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 ...
2
votes
1answer
144 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 ...
0
votes
1answer
54 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 ...
0
votes
1answer
41 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: ...
0
votes
1answer
39 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 ...
0
votes
1answer
135 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 ...
0
votes
0answers
49 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: ...
0
votes
2answers
86 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,...
3
votes
1answer
168 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 ...
0
votes
2answers
76 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 ...
0
votes
1answer
238 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 ...
1
vote
2answers
139 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 ...
1
vote
1answer
260 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 ...
2
votes
1answer
60 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: ...
4
votes
1answer
370 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 (...
0
votes
1answer
65 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 ...
3
votes
2answers
260 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 ...
0
votes
0answers
55 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 ...
0
votes
1answer
73 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 ...
2
votes
1answer
139 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 ...
0
votes
0answers
22 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 ...
0
votes
1answer
48 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 ...
2
votes
3answers
348 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 ...
0
votes
2answers
92 views

Weighted random events with conditions

I'm building a system for distributing ingame events for a strategy game. The game is heavily driven by the events and each country/player should receive one or more per time unit. The algorithm is ...
1
vote
2answers
47 views

Spawn chance, modulated by probability weighted by progress

I've been struggling with this for over a day now. What seemed a simple task, has just wrecked me. I hope someone here can help me figure out what I'm missing. Please, please help me :) The ...
1
vote
0answers
41 views

how can this random scene code run well when it is reloaded?

I have a code for random scenes, the scenes that I have are 10 randomized scenes, but when I reload the scene there is only one scene. ...
-1
votes
1answer
76 views

Are there any formulas/algorithms that could allow level to decide how many dice can be used for a roll?

See, I'm trying to work on an cRPG system and I want a formula or algorithm I guess, where the level affects how many dice can be rolled for any action (in addition to a default number of dice and ...
1
vote
1answer
233 views

How simulate a random distribution?

I'm working on a battle algorithm for a text-based game and I stumble when it comes to randomly distributing attacks on a set of units. E.G, 100 archers shoot 100 targets at the same time. I thought ...
0
votes
1answer
101 views

Bullet Spray RNG

So I have a Nuclear-Throne like weapon system in my game, and I'm working on bullet spray. Originally, there was equal odds that the bullet sprayed at any angle within the spray range. That felt ...
2
votes
1answer
161 views

Figuring out damage distribution

My problem - Each round, each of the 5 champions get to strike each of the 99 monsters once; however, their attacks are such that one third of each champion's attacks are ineffective, causing 0 ...
35
votes
7answers
17k views

How do I create a weighted collection and then pick a random element from it?

I have a loot box that I want to fill with a random item. But I want each item to have a different chance of being picked. For example: 5% chance of 10 gold 20% chance of sword 45% chance of shield ...
4
votes
1answer
2k views

Creating random path in grid

I need to find a path with required length in the NxN matrix without loops and deadlocks. For example: We Have a grid 7x7 (49 blocks in total) with START (orange) point. We need to build random ...
2
votes
1answer
114 views

Logic for npc/customer for cafe simulator game

I need help for logic or pseudo code on how to implement a rules/formula for customer in how they choose drinks(& the toppings). I have more than 10 types of customer and I want to set preferences ...
1
vote
2answers
402 views

How can Perlin Noise be modified to not tile?

In vanilla perlin noise, the texture repeats after 256 coordinates, due to the way it picks a gradient vector. In games that require an infinite procedural world, however, this is not an acceptable ...
4
votes
3answers
519 views

How to use Moving Average to avoid lucky streaks in RNG

I spent the last week reading about Luck Mitigation and what a dev can do to avoid extreme cases where the player's psychology will be messed up. I came up to this question How do I avoid “too” lucky ...
0
votes
3answers
138 views

What are the differences between random encounters and permanent mobile enemies?

Random Encounter: A player has a 10% chance to encounter an enemy. while moving through a 5x5 grid. Permanent Mobile Enemies: There is one enemy that constantly moves through the 5x5 grid and only ...
0
votes
2answers
198 views

Random NPCs - possible yet? [closed]

Traditionally, non-unique game mobs and NPCs are of the cookie-cutter type. Seen one, seen 'em all, and you instantly know their behavior, stats and strong/weak points. Games however become ever ...
0
votes
3answers
76 views

Help generating clues in a treasure finding game

I am a high school student creating a small game in unity for fun and would greatly appreciate your opinions on this game mechanic. I have a treasure finding game that takes place in a randomly ...
3
votes
1answer
410 views

Procedural Star Generator

I want to develop a procedural galaxy / starfield generator. A rather simple approach would be to use some pseudo-random algorithm to repeatedly create a star and its properties (such as position, ...
4
votes
2answers
704 views

How to randomly rotate a D20 Dice in Unity?

I'm working on a Dice Application in Unity that involves randomly rotating a dice model on instantiation and then dropping it. But in order for this application to be useful I need to guarantee that ...
0
votes
1answer
93 views

Map growing algorithm

I'm quite new to programming games and I'm currently working on a group project in university on creating one. In the game we've got a set of squares (cities, other entities) which are placed on the ...
2
votes
1answer
604 views

Random 2d terrain algorithm for map generator

I'm new to game development and I need some advice. I'm building a web based 2d random map generator and I wonder which algorithms there are to create such random terrains in a simple matrix as seen ...
1
vote
1answer
119 views

Random Sobol 3D Cell in Unity

There is a blueprint in UE4 for making Sobol random 3D cell. It places random objects inside cell structure. How to make this in Unity? For example, if I make a sphere prefab I would need to generate ...
0
votes
1answer
320 views

Checkers games with computer random movement

Im studying Java OOP, and I have to make first assignment about making checkers board game. I have to get input from user if he plays, and than when his turn is over the computer will play. Computer's ...
1
vote
2answers
488 views

Procedural dungeon algorithms for a more open dungeon

I'm working on a game that I want dungeon generating in, but I plan on having ranged weapons in it, so I want it a bit more open. I'd like to avoid corridors and I don't want to use a grid of custom ...
1
vote
1answer
67 views

Prioritizing prefabs in array for procedural generation

I am trying to create procedural space background with a bunch of sprites of nebulas and stars. I have made few prefabs with different types of sprites attached to them. I have created an array ...
0
votes
1answer
449 views

Intuitively, why is 3.5 the average (mean) roll of a six-sided die?

Every page I could find on the web that answers this question explains it with Expected Value statistic probability math. $$(1 * \frac 16) + (2 * \frac 16) + (3 * \frac16) + (4 * \frac16) + (5 * \...
1
vote
2answers
314 views

How can I generate a random 2D surface

I'm trying to build an old game (Lander) where you try to land a spaceship on a flat platform. But I have no idea how to generate a random surface. Something like in the picture would be nice. Edit: ...
4
votes
2answers
374 views

Messy results from simple cellular automata algorithm?

I wrote something that will first randomly populate a square a with grass tiles, and then from there it will calculate tile types from each tile's surrounding tiles. My ultimate goal is generate a ...
2
votes
2answers
147 views

Using seeds for rng. A reliable way of saving bandwidth?

Imagine a server-client game application. While running, the server is constantly generating numbers for various random events and sending them over the network to inform the clients of the result. ...

1
2 3 4 5 6