Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more

Questions tagged [sorting]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2 votes
2 answers
193 views

Topological sorting optimization

I'm creating a 2d isometric game that uses topological sorting to correctly depth sort all of the oddly-shaped isometric objects. I spent a lot of time writing this from scratch, and it works great. ...
Andrachie's user avatar
0 votes
1 answer
83 views

Sort an array of Node3Ds by distance with closest first

I am working on kart racing game. I have created a series of respawn points (Node3Ds) for when a player falls off of the track. Currently, I am trying to get the closest respawn point to the player ...
mjbelanic's user avatar
0 votes
0 answers
48 views

Sorting layer of wall in top down game 2d

I made tilemap using tiled app. I try to sort layer so the when the player is in front of wall he visible and when he is behind the wall then not viable, it's commonsense. But problem only one line ...
TECH VR Gamers's user avatar
0 votes
1 answer
60 views

Vertex sorting to match triangle list definition of an hexagon

I’m working on a project to display molecules with DirectX that I’m updating regularly to add visual effects. The one I’m working on is simple: display a flat transparent hexagon that match a ...
philB's user avatar
  • 139
0 votes
2 answers
234 views

Numbering sprites in a sprite sheet left-to-right, top-to-bottom

I'm using this program called Quadtastic which is a sprite sheet management tool that lets you define quads on a sprite sheet, name them, etc, and export to metadata with those names (+ position, size,...
Garflington's user avatar
  • 1,055
0 votes
0 answers
169 views

Render Queue Sorting - Best method for generating sorting IDs

I'm trying to implement a method for sorting my renderable items before drawing them into screen. To do so, I have been tinkering with the idea of using an 64 bit key to store the state of each ...
Devem's user avatar
  • 11
3 votes
1 answer
392 views

Isometric ordering issue with moving entities taller than one block

I'm having a lot of trouble sorting it in such a way that it works with a moving entity that is "taller" than a "block" size in this map. I've recorded my problem here: https://www....
RadicalRaid's user avatar
0 votes
1 answer
180 views

How to sort leaderboards, given wins and total games played?

The game is card game. The only results I get is wins and TGP (total games played). Losses = TGP - wins. I want to rank the players in the most fair way without making it too complex. What I have ...
Janis Taranda's user avatar
0 votes
0 answers
106 views

Layer sprites according to their vertical position

I need advanced blitting options in my game. It's a 2D game that has trees' sprites along with the player's sprite. I want that every tree sprite to be displayed either in front of or behind the ...
Salem's user avatar
  • 226
0 votes
0 answers
19 views

Sprite sorting is working fine but tilemap sorting is working the opposite way I want it to [duplicate]

I provided some screenshots to display what I'm talking about. The blue tile is a sprite, and the bushes are made from tilemap, each being 4 16x16 tiles. My transparency sort axis is set to 0,1,0. I'...
SethD02's user avatar
0 votes
2 answers
318 views

Tower Defense: Sorting Algorithm with multiple weights (enemy AI)

I'm writing a sorting algorithm for a tower defense mobile game. As a quick synopsis, I have a "tower" that can shoot at incoming threats that are within X distance from the base of the ...
Tyler Beauregard's user avatar
0 votes
1 answer
514 views

How should I store the objects to render?

From what I understand, in order to show all elements of a 2D game in the proper way, I need to render them in order, from the further away from the camera to the closest. So I should sort them by ...
Gian's user avatar
  • 113
1 vote
1 answer
105 views

Self-sorting objectives list in Unity

I'm new to Unity and C#, so I'll try to be as thorough as possible. I'm working on an objectives menu for my game (in Unity) and I'm not sure how to implement a behavior I'd like it to have (the ...
Hyperific's user avatar
0 votes
0 answers
76 views

how to order entities by their distance from 0 on the x axis

I'm creating an infinite runner game in which you control several characters at once. Right now when you press the spacebar, they all jump at once but, I want them to jump at separately, one after ...
yasko kai's user avatar
0 votes
1 answer
710 views

Sorting layer issue with multiple sprites and a Tilemap in Unity

I have a particle system that draws a blood splat. I have a Tilemap that represents terrain. However, the blood splats, which are on a sorting layer in front of the terrain, are somehow rendered both ...
slerfsterdn's user avatar
1 vote
1 answer
540 views

How to sort polygons without a depth buffer

Please help me getting understanding how did they sort polygons in old games from the eighties. They did not use z-buffer or anything like this, thats for sure. Please look at the screenshot. How ...
fitnezz's user avatar
  • 11
0 votes
1 answer
1k views

Sprites draw-order sorting for top-down 2D game with floors and bridges

I am working on custom 2D engine for a game. I am having trouble figuring out a working system for sprite drawing-order sorting for this specific game. Game description: 2D Top-down perspective ...
Riva's user avatar
  • 171
2 votes
1 answer
2k views

Issue with Sorting Layers with an NPC and Tilemap

I have a weird thing happening, that I can't quite explain. I have two scenes, my starting town, and an Arcanist's shop. When I go into the Arcanist's Shop, the Arcanist NPC stays on the same ...
Thomas Hutton's user avatar
0 votes
1 answer
149 views

How to sort scores and assign positions based on the scores?

I have three game objects each with an individual score. I was wondering how I should go about sorting these scores in ascending order. I want to also give these objects a position based on their ...
dripdrops's user avatar
0 votes
1 answer
354 views

How can I sort a list of integer pairs in sequence?

I have a list of paired integers, every nth integer paired with every nth+1 integer. I'm trying to sort the list such that the pairs form a chain. For example: Input: {12,72, 38,2, 72,38, 2,12} ...
IanLarson's user avatar
  • 771
0 votes
1 answer
280 views

Unity: Unable to rearrange "Sorting Layer" for 2D game

Since yesterday I got a bit into game development with Unity (i've never done game development before), and I am currently making a small 2D game. I am attempting to rearrange the various layers in ...
ImJustACowLol's user avatar
1 vote
0 answers
713 views

How to sort cards' on-screen positions by their suit?

I have a 13 cards and sort button. When I click that button, I want all the cards of each suit to be grouped-together on screen. So if I have 4 diamond cards in my 13-card hand, all 4 diamonds must ...
Deepak Gaurav's user avatar
1 vote
1 answer
760 views

Sorting sprites based on Z index

I am working on a 2D game engine in C# using OpenGL. I am trying to find a collection to satisfy my needs for sprite ordering, and I can't seem to find the combination of performance and functionality....
ForeverZer0's user avatar
0 votes
0 answers
40 views

walking up/down slowed by z coordinate layering

I am making a 2D topdown sprite game. I got myself a controller script that handles input and makes the character move/attack etc. I eventually added objects you could walk in front of or behind, like ...
Nap D. Lover's user avatar
0 votes
1 answer
2k views

How can I sort vertices efficiently in a specific direction (CW/CCW)?

I am trying to triangulate a set of points using a very simple approach where a base vertex is chosen, and then every other vertex is joined to its neighbouring vertex and then back to the base vertex,...
jjmcc's user avatar
  • 233
0 votes
1 answer
204 views

Array with multiple linked objects in Unity

This might be too primitive, but for my use case, I need to maintain an array in which two attributes are linked to each other... For example - If I want to do Score gathering... Then I need an array ...
ViNk's user avatar
  • 140
0 votes
1 answer
705 views

How to manage changing Z-Index in an Entity-Component-System?

If got an Entity Component System based game-project (like classic zelda). The Player as well as Enemys are Entities with sprite- and tranform-components. The Weapons are also Entities with sprite- ...
EchtFettigerKeks's user avatar
2 votes
1 answer
1k views

In Unity, why do I get a "does not implement right interface" error when trying to sort my list of objects?

I am trying to create a crafting panel that sorts the list of items you can make alphabetically, yet I cannot figure out why .Sort() is not working. What I have ...
rackemup420's user avatar
0 votes
1 answer
516 views

How to sort entities order by nearest entity distance?

I have created a comparator class called DistanceSquaredComparator and implements it with Comparator<Entity>. Then in the ...
ronscript's user avatar
  • 501
0 votes
0 answers
273 views

Using Sorting Layers with 3-d meshes

I have 3 layers of objects in a game that I am working on. The layers are the "map" layer (Background), "UI" layer (Labels, etc), and the "Object" layer (Movable objects). I am working on a 2-D game, ...
PearsonArtPhoto's user avatar
0 votes
1 answer
304 views

Did they remove Sprite sorting layers from Unity?

I can't figure out how to set it. I thought it was a setting on the sprite renderer but it doesn't seem to be there? Google isn't turning up any results.
dave's user avatar
  • 113
0 votes
2 answers
11k views

Why is my TextMesh always on top?

I have a 2-d game that I am making, using 3-d assets, including TextMeshes for text. I have decided that in some instances, I would like to have the TextMesh appear behind objects in the foreground. ...
PearsonArtPhoto's user avatar
7 votes
1 answer
640 views

Optimal batching for 2D objects with transparency

I have a collection of 2d objects with transparency. Each object has a depth value to determine draw order and a material. I'm trying to batch them in an optimal way to minimize draw calls. Assume ...
Pris's user avatar
  • 904
4 votes
1 answer
1k views

Reorder a set of points in order to draw a triangle fan (example)

I'm doing a light engine (c++, using sfml), and to connect the light vertices, I thought about drawing a triangle fan. Here is a representation of a triangle fan (sfml documentation): The points HAVE ...
Riptide's user avatar
  • 292
3 votes
1 answer
921 views

Transparency sorting in 3D world with different render types

I am rendering a world, object, and models from an older game format. The world is presented in a BSP tree so I can quickly iterate through. The opaque surfaces are rendered front to back. Then ...
user923's user avatar
  • 171
1 vote
1 answer
548 views

Drawing order of 2D tiles with 3D bounding volume

I'm wondering which algorithm was used to draw the sprites of the video game Commandos in the correct order. Each sprite has a 3D bounding volume (either a polygon or a cylinder), this is how the ...
h3k's user avatar
  • 11
4 votes
1 answer
117 views

What is a viable way of finding the minimum swaps to sort numbers in pyramid?

I have made a game that consists of a pyramid of hexagons with numbers from 00 to 99 randomly positioned in groups of 6, 10 or 15 elements. Now, I'm working to create an auto-solver but for the last 2 ...
the-alchemist's user avatar
6 votes
2 answers
10k views

How do I determine the draw order of isometric 2D objects occupying multiple tiles?

My current sorting method works only for objects that occupy 1 tile and fails for multi-tile objects. For examle, the bed in the above picture occupies 1×2 tiles, and the sorting fails. Also that bed ...
Matthew's user avatar
  • 399
1 vote
1 answer
291 views

Texture Packer - Any way to make it combine intelligently

I am making a Pokemon Clone, using libgdx. I have the different types of sprites: e.g. Back, front, back shiny, and front shiny. The current way the Texture Packer combines the textures seems to be ...
chbachman's user avatar
2 votes
1 answer
129 views

Why do the order of uniforms gets changed by the compiler?

I have the following shader, everything works fine when setting the value of one of the matrices but I've discovered that getting a value back is incorrect for View ...
aybe's user avatar
  • 773
0 votes
2 answers
527 views

How to control which polygons get rendered first in a batch (e.g. to draw leaves)?

Sorting transparent objects is a well-known problem. If you send a bunch of transparent polygons (e. g. leaves and branches on a tree) into the GPU and render them with alpha blending enabled, the GPU ...
cubrman's user avatar
  • 1,551