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

learn more… | top users | synonyms

0
votes
1answer
188 views

AS3 random events using a timer

I'm making a game for an assignment at university. The game I am making requires random household appliances around a house to "turn on" at random times. The player must run around the house turning ...
1
vote
1answer
76 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 ...
1
vote
1answer
43 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
434 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 ...
4
votes
1answer
274 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 ...
13
votes
3answers
3k 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
138 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 ...
1
vote
2answers
93 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
5answers
177 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 ...
21
votes
12answers
3k 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 occur more often in the output than higher numbers. 1: extremely common | most likely 2: very common | 3: pretty ...
0
votes
1answer
41 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 ...
5
votes
6answers
782 views

Data structure for random outcome from a hit probability table

The basic idea of a hit-table is carried over from pen & paper role playing games. You roll a die or a number of dice representing your ability to attack an opponent. Your opponents defense is ...
0
votes
1answer
41 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 ...
20
votes
2answers
4k views

Algorithm for procedureral 2D map with connected paths

Problem to solve: Generate a random 2D dungeon map for a tile-based game where all rooms are connected. I am looking for better solutions than what I currently have. My current solution is that I ...
3
votes
3answers
111 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
46 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
62 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
212 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
113 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 ...
1
vote
2answers
296 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 ...
0
votes
1answer
100 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 ...
1
vote
1answer
82 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). ...
-1
votes
4answers
5k views

Random Between: using random with the instance_create function in GML

Hopefully this should be a simple one; I want to restrict the points that instances enter the screen from so they don't come in at the edges. In Game Maker I'm using the following code ...
0
votes
1answer
194 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 ...
16
votes
7answers
2k views

Weighted Random Distribution

I am currently contributing to a particle system for our game and developing some emitter shapes. My uniform random distribution along a line or along a rectangular area works fine - no problem. But ...
6
votes
3answers
117 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
4answers
114 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 ...
1
vote
3answers
369 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
196 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 ...
14
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 ...
11
votes
5answers
10k views

How do I shuffle cards for a card game?

I am trying to develop an card game for Android Can anyone suggest me how to write code for effectively shuffling the playing cards?
0
votes
0answers
107 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 ...
2
votes
2answers
552 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 ...
2
votes
2answers
230 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 ...
1
vote
1answer
82 views

How to change chance of spawn based on distance?

I am trying to make a cellular automate cave but want to keep the middle empty. How should I change the chance based on the distance from the middle? I don't want to completely deny it just want a ...
0
votes
1answer
172 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. ...
3
votes
3answers
507 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 ...
1
vote
2answers
256 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
2answers
204 views

Camera placement sphere for an always fully visible object

Given an object: With the bounds [x, y, z, width, height, depth] And an orthographic projection [left, right, bottom, top, near, far] I want to determine the radius of a sphere which allows me to ...
0
votes
2answers
775 views

Shuffle tiles position in the beginning of the game XNA Csharp

I'm trying to create a puzzle game where you move tiles to certain positions to make a whole image. I need help with randomizing the tiles start position so that they don't create the whole image at ...
2
votes
2answers
220 views

Algorithm that always returns the same pseudorandom output if given the same input of seed, x and y?

I've been trying to find an algorithm that will take in an x value, a y value, and a seed value and then spit out a number between 0 and 255 (or an int that I can cut up into bytes). I want to be able ...
8
votes
2answers
357 views

Can adversarial agents flip coins?

I was thinking about peer-to-peer games by considering a simple coin tossing game. You open up your version of P2PCoinFlipping Beta 2.3 and it displays a list of player name servers. After ...
4
votes
1answer
288 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 ...
0
votes
1answer
64 views

Randomised Path from A to B for cursor movement simulation

I'm trying to simulate the movement of the mousecursor, by creating a path from point A to B that has random variation. The algorithm I'm using at the moment is very basic, and is limited in that ...
0
votes
2answers
212 views

(Efficiently) Generate Unique Random Numbers [duplicate]

Sorry my terminology is somewhat limited so I'll have to use more words to explain what I mean. In games that require critical hits, I've heard it's not good to generate a random number but instead ...
34
votes
9answers
6k views

How can I make a “random” generator that is biased by prior events?

I am looking to implement a chance based system which is biased by prior event. Background: Some years back, I remember an update for World of Warcraft announcing that they implemented a new chance ...
1
vote
2answers
104 views

Non deterministic dice rolls [closed]

Are there any algorithms out there for non deterministic dice rolls? For example, I'd like to make a small mini-game: Liars dice. But the biggest issue here is dice rolling. When the cups are turned ...
3
votes
3answers
824 views

How to zoom randomly generated maps?

I made a Java program which generates a random map based on Perlin Noise + Poisson Algorithm + Voronoi Diagram. Here you can see a generated map. White are caves, black is empty. The problem is ...
17
votes
4answers
7k views

Generating tile map

I am programming a tile based game and I have some basic tiles (grass, dirt, etc..), but I can't figure out how to make good random map generation, because when I do some really random selection, if ...
7
votes
8answers
857 views

Random looking item placement that's deterministic?

I'm working on a sidescrolling game and I want to generate a forest for the background. I want the background to be the same for every one to make sure the quality is the same. I don't have access ...