New answers tagged

0

Add some random points Repell points located too close to each other Add some points along the edges Do Delaunay Triangulation on all the points Done


2

The theory will tell that you're likely to get less cache misses (so 'more efficiency' w.r.t. response time) if your objects are close one to another in memory. This means that if you use an array, and your objects are contiguous, and you access each of them in a in-memory-sequential fashion, it will be more efficient than if you hop from here to there and ...


0

You have several options: Create a variable public GameObject TreeGroup in your DisableTrees behavior. The variable will now appear as a field in the inspector of DisableTrees. You can then drag the TreeGroup game object to it. Use GameObject.Find to find the tree group by its name. But keep in mind that this method is very slow on larger scene graphs. Add ...


0

Let's assume you have float gameTime; Let's also assume you spawn in the blocks completley randomly. And finally let's assume you have some kind of update method which gets called every frame. With the above assumptions you could probably write something like this float gameTime = 0; //The total game time, in seconds. float spawnTime = 0; //A counter to ...


1

A first aproach could be giving a varying weight to each type of block, modifying such weight each level, decressing the probability of spawning an easy blocks and increasing the probability to spawn a harder ones. I'm also going to suppose you have some kind of a parent Block class and different child classes for each type of block. public Block ...


0

I ended up implementing a Guillotine rectangle packing algorithm (with heuristic for picking free rectangles with smallest area) GUILLOTINE-BAF with some modifications: When a texture gets removed - the freed up space gets merged with other free rectangles that are adjacent and their width or height matches (this is done multiple times until there's ...


2

I would create a box and spawn object inside it. Or if your road is windy you can use multiple boxes or some other shape. Here is some code: using UnityEngine; using System.Collections; /// <summary> /// Spawns a prefab randomly throughout the volume of a Unity transform. Attach to a Unity cube to visually scale or rotate. For best results disable ...


0

Your problem is still open, in the sense there is so much research about optimizing pathfinding and reducing its time complexity (however there is much advancement if positions are constrained in euclidean space: so travelling cost is equal to distance), I don't know the details of your game, but I think you don't need to be 100% precise, if you have to ...


5

I haven't worked through the full equations for this yet, but here's some visuals to help wrap our heads around the problem. It boils down to some geometry: (Car icons via Kenney) From any given starting point and orientation, we can draw two circles with our minimum turning radius - one on the left, one on the right. These describe the points on the ...


1

This very much depends on the rest of your data model for the navigation. Ie. what data you have handy, what you can easily add data and how you consume it. Taking a similar scenario from a traffic system at water, and with the assumtion that you are in a game loop you have a node path system your cars behave like an autonomous objects that control ...


2

You could use a hashtable with a key which consists of both the x-coordinate and y-coordinate. Finding the tile at a specific coordinate is then a constant-time operation. When you want to cache the "outline", you could store it in another hashtable. Whenever a node is added, follow this algorithm: the new node is removed from the "outline" hashtable for ...


2

A lot of great stuff covered in the other answers. Here's my take on (the perception of) win/loss probabilities. In the case of PvP, consider different ways to track & show win loss scores either directly or in some sort of cooked format (I.E. player rank). Specific examples: Puzzle Pirates ranks player performance relative to all of the other players ...



Top 50 recent answers are included