# Particle Depth - Isometric/Dynamic

#### Turgon

##### Member
I'm making an isometric game right now, and am wondering if anyone has found a way to draw particles at their current isometric depth within the same particle system?

E.g. when a bullet hits a wall it creates a number of particles on impact. The problem is that the created particles ignore isometric depth (depth = -y / 10000) since they are drawn at the particle system's depth.

I have thought of a few possible solutions so far but none seem ideal:

1) Change the particle system's depth on each impact to match the correct depth. This would draw the latest impact at the right depth, however any particles still in the process of drawing would jump depths which ruins the effect.

2) Create a separate object and particle system for every impact, which is then destroyed once the particles are complete. This way each set of particles could be drawn at the correct depth, however intuitively it seems like this would be a big drag on system resources? Memory, etc. Since there are often multiple different particle effects being created per second in the game.

3) Ditch the particle system and switch to individual objects/sprites. This would be the most versatile but also the most resource expensive by far due to the quantity of desired particles, to the point of being impractical.

L

#### Laseph

##### Guest
Indeed with the current way game maker is set up it isn't really easy with depth being seperated from x and y instead of just adding a z-axis. This means with how things are set up with the particle system you can directly create particles with a certain position but you cannot change the depth directly. I think the best solution would be to go for option 2 but instead of creating and destroying many particle systems and emitters. When the particle systems are done you can add their indexes to a queue, when you need to emit particles at a new position and depth you can adjust a used system from the queue instead of having the overhead of creating and destroying the particle systems. (I'm not an expert on game maker and it's particle system I looked trough the documentation and thought this would probably work fairly well)

Last edited by a moderator:

#### Nocturne

##### Friendly Tyrant
Forum Staff
Option 2 would be your best bet, and if handled carefully then it shouldn't be too much of a stress on the system as long as you're not creating dozens of particle systems at a time. My old game Gauntlet Revisited did this and I had no issues with lag or anything because of it. HOWEVER, if you know that you'll only ever need a few particle effects onscreen at once then you could also simply create an array of particle systems and then use them consecutively setting the depths for each as you use it. For example:

Code:
``````// CREATE THE SYSTEMS AT THE START OF THE GAME
global.p_sys_num = 0;
for (i = 0; i < 10; i++;)
{
global.p_sys[i] = part_system_create();
}

// WHEN YOU WANT TO BURST THE PARTICLES
if ++global.p_sys_num > 9 global.p_sys_num = 0;
part_system_depth(global.p_sys[global.p_sys_num], depth);
// burst particles``````
In the above code we create 10 particle systems and then step through them one at a time to create the effects at different depths.

#### Yal

##### š§ *penguin noises*
GMC Elder
One plus with going for approach 2.... having one particle system per effect would also allow you to mix additive and normal blending per effect, and that could be used to make effects more varied. (Additive blending is great for fire and explosions, normal blending is better for smoke and debris)