# Render order in 3/4 view game

Game Development Asked by Chuan Li on January 10, 2021

I’m writing a 2D game with an internal 3D space. The view is 3/4 view. I’ve run into trouble with the render order of entites.

Context: The world uses a tile system, like a 3 dimensional lattice, each tile is a 1x1x1 space. Entities have a 3D coordinate position and do not snap to tiles(may straddle two tiles). Entities have their own width, height, and depth, all entities are strictly oblongs and do not rotate(only exist in right angles). Since the view angle is fixed and there is no perspective, the graphical representation of the tiles and entities are all 2D images(they are all sprites)

Question: How do I code for render orders in a 3/4 view?

So far, I’ve defined the render order using the y and z coordinate of the entity(I believe x coordinate is irrelevant in 3/4 view). However, it quickly dawned how using a single point to define the layer of an entity with a height and depth was bound to have issues. This is illustrated in the following image:

The horizontal axis is y, while the vertical axis is z. The dashed line represents the view angle.

The blue box and green box should be rendered above the red box. However, when the render order is determined by either the y or the z coordinate of the entity’s origin point(highlighted), it is impossible for the system to be consistant.

For instance, if the renderer renders from lowest to highest(layer based on z coordinate), the red box would cover the green box, which is incorrect. If the render renders from back to front(layer based on y coordinate), the red box would appear on top of the blue box, which is incorrect. A mixture of y and z coordinate(e.g. y + z = layer) would be inconsistant also, though it does agree with the example shown.

Without assumptions about the features of the game I am creating, is there a way to have a system that can consistantly order render layers correctly, given information of 3D coordinate position and dimensions of all entities? Also given that each entity is represented as a flat, 2D sprite?

I have encountered numerous sites warning people away from 3D, since it is "orders of magnitude" harder than 2D. Could I walk the tightrope and introduce some 3D elements to solve this issue, while keeping the game 2D and in 3/4 view angle? Thanks in advance.

## Related Questions

### My GameObject keeps spawning when it shouldn’t

2  Asked on November 9, 2021 by michael-hampshire

### SAT Collisions: Resolving rotations

1  Asked on November 9, 2021 by john-claire

### Texture blends into one single color

1  Asked on November 9, 2021 by andrey-k

### Gaps in custom body parts export for Daz Genesis 8 character

0  Asked on November 9, 2021 by dvid-lszl

### What is the process for porting my game SFML from Windows to Mac

1  Asked on November 9, 2021 by john_shreds

### Player jitters when Jumping at object edges

1  Asked on November 9, 2021 by cgaudet

### My bullets won’t bounce in Unity?

1  Asked on November 6, 2021 by kayra-yorulmaz

### How to save boolean to player prefs in Unity?

2  Asked on November 2, 2021

### How to time draw images to the window in d3d8

0  Asked on November 2, 2021 by kite

### Tank / turret animations

0  Asked on November 2, 2021 by lilkrit

### How to make the bounced light brighter in unity?

0  Asked on November 2, 2021

### Problems with recursive backtracking algorithm for a 3D maze

0  Asked on November 2, 2021 by janis-taranda

### How to specify font size in nifty GUI when using ttf fonts

0  Asked on November 2, 2021 by teeracroptus

### Add a sound to all the buttons in a project

3  Asked on November 2, 2021 by hamza-memon

### Reducing adjacency bookkeeping work in constrained Delaunay triangulation

1  Asked on November 2, 2021

### Editing terrain in Blender

0  Asked on November 2, 2021

### File saved to IndexedDB lost unless we change scenes

1  Asked on November 2, 2021

### Moving and shrinking circle to a circle inside of it (PUBG like zone)

1  Asked on November 2, 2021 by nicer

### What are the accessibility implications of requiring a button press or time-out on a game over screen?

3  Asked on November 2, 2021

### Fragment shader – map dot texture repeatedly over the sphere

1  Asked on November 2, 2021 by martin-perry