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

learn more… | top users | synonyms

0
votes
1answer
37 views

What should I use instead of randomized start positions for good-looking 2D rain?

Right now I'm randomizing the position of my 2D rain's spawn positions on both the X and, slightly, on the Y axis. It looks pretty weird right now, it has a bunch of huge clumps and unfilled areas: I ...
-1
votes
1answer
45 views

Spawn a prefab at random y position with different gap between prefabs

I have this code, and I want to be able to spawn my Wall prefab at random heights and gaps between the upper wall and wall under it, but it seems that my code will only spawn the wall with same gap ...
0
votes
1answer
34 views

How to use MaterialPropertyBlocks to randomly change the color of multiple materials on an object?

I have a character prefab for a civilian with 5 materials. Each one should be a random color but I don't want a new material for every civilian in the game. I asked a question earlier and had a good ...
0
votes
1answer
51 views

How to have random and different colors on multiple objects with one material?

I want to have one material applied to multiple objects that has a random color on each object. How can I achieve this so that I don't need to use a different material for every object? This is in ...
0
votes
1answer
55 views

Generate a random number of enemies to appear on screen

I am currently trying to create 2d shmups. I am trying to: Generate a random number of enemies to appear on screen Whatever number is generated will then be added to my List (the list is used to ...
-2
votes
1answer
82 views

What kind of algorithm can be used to have a random selection of question, just like in a quiz game, using Unity 5?

We were trying to create a mobile game using Unity 5, and we don't have any idea for what kind of algorithm we're going to use. Our game is like a logic quiz game, and we want the questions to be ...
14
votes
10answers
3k views

Random noise based on seed

I am currently working on a program that should generate random noise on a screen based on the 'coordinates' of a pixel. The coordinates should have the same color every time you restart the program. ...
0
votes
2answers
324 views

Unity Random.Range not repeat same position

I have this code that generates blocks in random position and it works but some times it generates blocks at the same position ,how can I fix it? var dupeobject : GameObject; function Start(){ ...
0
votes
2answers
67 views

How to balance spawn system with multiple objects?

I'm trying to make a top-down endless runner. I have divided my screen into 3 columns. Right now I have some objects spawned from the bottom of the screen that go up towards the top. I have 3 ...
0
votes
2answers
93 views

Different executions with different results using the same Random seed in LIBGDX

In my Libgdx project (for PC) I am using a Java Random object initialized with a constant seed. I use the Random object to generate a lot of different pseudorandom integers. I am not using ...
0
votes
1answer
88 views

What algorithm to use for random terrain? [closed]

(Please note, I am aware that the generation is not truly random and relies on mathematical equations, and that my language of choice is C++) So I've been learning programming for a while now and I'm ...
2
votes
1answer
147 views

How to create “broken glass” animation?

I have started making a 3D game in Unity5 that consists in avoiding obstacles. It is very easy but I want to add a collision effect when I collide on the wall. I would like to slice the screen into ...
0
votes
0answers
35 views

How can I use curves to bend Horizons smoothly?

I have been developing an endless runner game for some time and I wanted it try and make the environment to bend horizon randomly like subway surfaces I download this Horizon Bending asset from the ...
0
votes
1answer
29 views

How to create a random array of Transforms and Instantiate the random item?

I'm trying to make a rock that after you break it, it will spawn a random item from the minerals array. How can I pick a random item from the minerals array and then instantiate it? var ...
11
votes
5answers
2k views

How to improve this random number generation in my context?

In my game there is a word at top of the screen, letters are raining down from top and the user has to touch the letters to complete the word. Currently I am generating letters randomly (actually ...
0
votes
0answers
39 views

Spawning multiple objects randomly

I have gold spawning all the time though I sometimes ( rarely ) want to spawn a gem, and at other times I want to spawn boosts, how would I make a function to choose between what item to spawn. I ...
-1
votes
2answers
77 views

Game Maker - Random Won't Stop

I make a project. I want to make randomize number & draw the number result. So, I make obj_BossText, which has a draw event & executes a code inside the event. This is the code: randomize(); ...
-1
votes
2answers
63 views

SFML Increasing random falling meteors [closed]

Im working on a small project where i have to creat a 2d game using C++ and SFML (it wasn't my choice to use them) i did every thing like creating the ship ,shooting ,score counter ..etc i managed to ...
2
votes
1answer
98 views

Most effective approach when creating % chance of something

When dealing with % chance in a game what are the most effective ways to achieve this? When I use random.random()[python] or Math.random()[javascript] and use an if/elif/else conditional it seems like ...
2
votes
1answer
205 views

Procedural generation of evenly distributed random points (2d)

I am coming here because I've have a performance problem with my current implementation of an algorithm. I am the idea of Voronoi diagrams to distribute patches on an infinte 2d layer. For a Voronoi ...
4
votes
1answer
481 views

Unwanted Perlin Noise result

I've finally managed to write a working Lua version of Perlin's improved noise for Love 2D. However, when I run it, i get this: Which is just fine, I guess. But I would like something that looks more ...
4
votes
1answer
492 views

Set a 'chance to spawn' for each GameObject in an array

I have an array of gameObjects in a spawner. I want to randomly spawn these gameObjects based on a weighted chance. I want to be able to manually set in the Inspector a percentage chance that an ...
1
vote
2answers
358 views

How to randomly spawn objects off-screen close to the player?

I am making a zombie game. I want to have it so zombies randomly spawn. My code for this is: instance_create( obj_player.x + irandom_range(-300, 300), obj_player.y + irandom_range(-300, 300), ...
3
votes
3answers
154 views

Increasing chance of good loot after multiple tries

I'm looking for a way to make chances of getting better loot increase the more you've looted. I do not want it to be possible to get a rare item the first 5 times and not being able to get an epic ...
3
votes
5answers
327 views

Generate random numbers in loop without repeating

How to generate Random numbers without repeating any numbers in the given target like(1-5000) there should be no reparation and I should be able to get 5000 randomized numbers. I should be able to run ...
25
votes
12answers
5k views

Random number in a range, biased toward the low end of the range [duplicate]

I have an input of two values, let's say 1 and 10. Lesser numbers should overall occur more often in the output than higher numbers, while there is a peak in the probability at #2: 1: very common 2: ...
0
votes
1answer
95 views

Random equidistant points like a tree branch (JS)

I'm working on an algorithm to generate a "graph" like array of points in my game world. See Image Below: Here is what i'm working on so far, which will generate the black line.. but this may not be ...
0
votes
1answer
82 views

Using timestamp as a random seed returns identical results

And here is the random number generator again. I work on a game, where a user can create and schedule some levels to player later. For simplicity, let's say I play chess. I create a new game with ...
14
votes
3answers
6k views

What's the difference between UnityEngine.Random and System.Random?

What's the different between this int randomNumber = UnityEngine.Random.Range(0, 10); and this // on top of the class private System.Random _rnd = new System.Random(); // inside a methode of the ...
3
votes
3answers
224 views

Random numbers with a left or right biased skew

Within Java I have a table of objects ranging from horrible (1%) to wonderful (100%) from which one is randomly selected. This is simple enough and appears on a bell curve with a normal distribution ...
0
votes
1answer
69 views

Generate objects on playground on random location

How can I generate an object on my play ground? Note that there are some locations where the new generated item can't be placed. (Click on image to see the real size) I was following a tutorial on ...
-2
votes
2answers
109 views

Randomly changing game scenes in unity c# [closed]

Is there any way that I can randomly change scenes in Unity C# using arrays?
-3
votes
2answers
428 views

Random AI Movement

So I'm creating a zombie game where the zombies are passive and just walk randomly all over the area when player is not near. My question is: how would I make zombies move randomly? I code in C#. ...
2
votes
0answers
202 views

Formula to generate random enemies

In my endless game i need to generate random enemies for each "level". For each level i need to generate the total number of enemies that have to be spawn, and spawn them a few at a time. When they ...
0
votes
1answer
207 views

Choosing random array indexes in Unity C# [closed]

I want to change a string by randomly choosing an index in an array, using the random.range command in unity. Bare in mind that I'm using strings here, not floats or integers. Here is a code example(...
1
vote
2answers
1k views

Is there a random command for Boolean variables in Unity C# [closed]

Can you randomly choose a Boolean's value in Unity C#. I tried random.range, but it only works with floats. Here is an example of what I'm trying to do: Boolean = (random boolean value command)(false,...
1
vote
1answer
102 views

My attempt at a drunkard walk algorithm seems to generate large groups instead of more linear paths

...and I'm not sure if that's normal due to the random nature of the algorithm or am I doing something wrong. What I'm doing is: Set a random point within map boundaries (which I called a sandbox). ...
0
votes
1answer
357 views

Generating objects randomly from prefabs in Unity2D

I am developing an infinite runner using Unity. I have already figured out how to loop a set of backgrounds randomly but I am having problems doing the same for the objects. So, I have a few objects ...
6
votes
3answers
130 views

How do I make hit damage a Gaussian distribution centered around a value?

I'd like my character's attacks to on average 10 damage, but to vary anywhere from 0 to 20. Instead of a linear spread, I would like a normal distribution, so most of their hits are between 10-15, ...
1
vote
3answers
743 views

AI Random Path Genenrating

I would like to make an enemy walk randomly around a map I have made and if the player is in his zone of sight the enemy to change state to attacking/following. So how would I accomplish something ...
0
votes
3answers
309 views

Löve2D: Making a random map/city generator [closed]

So I'm making a game using love2d where the player will find himself in an zombie infested city but I don't want the city/map to be just the same all the time, so I want to create a random map/city ...
15
votes
3answers
1k views

What is the difference between “dynamic generation” and “procedural generation”?

When I think of a dynamically generated game, I think of things like Diablo with randomly generated levels. When I think of a procedurally generated game, I think of things like Flappy Bird and other ...
0
votes
0answers
162 views

How do I create tile based world generation

I was planning on making a tile based 2D game that has a random world generation. The game world itself is made out of several floating islands and the later half of the game world is generated as a ...
1
vote
4answers
132 views

How to load and unload objects at a certain radius from the player?

I am making a procedurally generated space exploration game in unity. I'm currently generating 5000 stars in a cube of a fixed size. Each star just gets a random 3d coordinate. What I would like to do ...
2
votes
2answers
240 views

Manually creating cycles in planar, procedural trees?

I am creating a procedural map using delaunay triangulation and an MST. I'd like to have a bit more control over my final graph. Like when i was looking looking at the MST I wondered how I can connect ...
2
votes
2answers
920 views

How to randomly spawn obstacles for infinite runner?

I am trying to create randomly generated path properly? Think of flappy bird (its not really) but my code/algorithm is all wrong. If I make BarMax, BarMin too large, then player can cheat cos in ...
0
votes
1answer
393 views

Random Y Axis Movement Within Set Limits (C#)

I've searched everywhere for this answer but everything I find is in Javascript and a lot of it doesn't help/work in my situation since most of it is Vector3's and using each axis, and my game is 2D. ...
1
vote
2answers
533 views

How to get this type of movement in LibGDX?

I want objects in my game to move randomly but always from right side of the screen to the left side. The movement must be as smooth and natural as possible, like they are following a path. Can i ...
3
votes
3answers
660 views

Algorithm for dividing a 2D grid into organic looking plates

the title pretty much says it all: How could one go about segmenting a 2D grid into smaller parts? My goal here is to create tectonic plates for further procedural world generation Details to ...
5
votes
1answer
385 views

Filling a room with random furniture

This is a rather complex question and I'm more hoping for general algorithms anyone might have heard of. I wish to generate randomly sized rooms. Each of these rooms has a type and a corresponding ...