Jump to content


Photo

3d Particle System Dll. And It's Pretty Darn Fast!


  • Please log in to reply
129 replies to this topic

#1 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 04 March 2009 - 08:11 AM

Last Update: Jan 03 2012 8:20 PM

GM8.1?? Sorry guys. GM7 AND 8 ONLY

OK, I've finally done it... I converted GM particle system to 3d!!!

3 hard and tedious days of analysing gm's particle system and re-implementing it in 3d right in a dll...

Thanks to X-tra fear and score_under for unlocking GM's functions so they can be used in a dll, I was able to make a particle system that is almost as fast in 3d as the original particle system. Works in 2d too!

**NOTE, Change the room in the GMK to see the right demo (Default is now the Spore Like Galaxy)
400k. (Because of sprites) GM7... You can convert it to gm6 with LGM. GM6er's Notes

vdieo
http://www.youtube.c...h?v=rSCXA992QbU

Download
http://host-a.net/ic...GM3dPartSys.zip

implements:
part_system
part_paticles
part_type
part_emitter
part_destroyer
part_deflector (Needs tweaking)
improves some of the original gm functions

missing
part_changer
part_attractor

Can be used to draw all your 3d models in your game MUCH faster than having a draw event in your 3d object WITHOUT transparency/alpha/interpolation artefacts. A bonuse is you get x,y,z motion, x,y,z gravity, z friction and x,y,z rotation (rot speed) so you may not even need a step event for many of your objects.
Adding more support for this feature.


Posted Image

Posted Image

Updates:

Offset Draw
Faster, gm8 proper support, "Error Defining External Function" problem solved
Better Draw And 4 Effects
Added Emitter system
Model Support and floating point exception fix
Destroyers Added
Now 30% faster, Source Included
Now 25% faster still
More particle options Beyond FOG exclusion, particle cut of and suspend and grouping for effect you dont want the CPU to calculate all the time and effect can be totaly ignored when not visible
Minor improvement on last update
More Features and Fix... Friction Added and access to particle data

My HUD don't draw!!!

Edited by icuurd12b42, 04 January 2012 - 01:37 AM.

  • 3

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#2 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts
  • Version:Unknown

Posted 04 March 2009 - 11:19 AM

I'm impressed.
  • 0

#3 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 04 March 2009 - 12:07 PM

If it works good on my computer, then there is a massive speed improvement. Even if you used a "hack".

I can't download, Host-A seems to be down.
  • 0

#4 Tokkes

Tokkes

    GMC Member

  • New Member
  • 8 posts

Posted 04 March 2009 - 01:59 PM

download doesnt work anymore
  • 0

#5 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 04 March 2009 - 06:53 PM

Host-a.net a back up... Link should work now
  • 0

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#6 X-tra Fear

X-tra Fear

    Behemoth Creator

  • GMC Member
  • 430 posts
  • Version:GM8

Posted 04 March 2009 - 08:08 PM

Excellent! Nice to see the library put to use. :)

Wow, that is fast! :)
30 fps - 3000 particles on my mom's crappy laptop. :)
(I didn't go as high as I could, I'm sure it could have went much higher!)

Edited by X-tra Fear, 04 March 2009 - 08:18 PM.

  • 0

#7 Phantom107

Phantom107

    Graphics Enthusiast

  • GMC Member
  • 2774 posts
  • Version:GM:Studio

Posted 04 March 2009 - 08:26 PM

The speed is very good for d3d, but the particles look horrible if you don't give them a much higher resolution.

Keep it up!
  • 0

GMCSignature.png

 

The most advanced GM game yet. Check out the Titan Rush GMC topic here! Developed by Phantom Technology

Talented spriting artist, looking for work? PM me. I'm working on a small project and need assistance. :)


#8 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 04 March 2009 - 09:48 PM

The speed is very good for d3d, but the particles look horrible if you don't give them a much higher resolution.

Keep it up!

Turn ON interpolation... They are Gm's particle (Exact clones because I could not get the original sprites in the exe; they are there and they are these sprites (except for the disk and square, mine are better)). I am adding a new draw method to be set by

gmexport double part3d_system_draw_order(double ind, double oldtonew)


where oldtonew can be 0 or 1 right now; 2 will be added to draw from furthest to nearest to camera... I sort of have it working right now by sorting them by distance to cam... But I need to sort by distance to camera plane instead... Later on today I hope to post an update.


So, yes, you better use better looking sprites than GM's default because at the distance you can be from the particle, it may turn ugly, much so if interpolate is off and if you don't sort the draw.

I will add support for actual 3d objects (d3d_model) eventually.

Edited by icuurd12b42, 04 March 2009 - 09:48 PM.

  • 0

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#9 mrperson

mrperson

    GMC Member

  • New Member
  • 513 posts

Posted 04 March 2009 - 10:29 PM

Wow, those pics are amazing! :) Im sure Ill have a use for this sometime. Keep up the great work!
  • 0

If I was able to help you, please click the green (+) icon in the lower-right of my post. Thank you!

I am known as Jacic on yoyogames.com and a lot of other places
Born-again christian and loving it!

#10 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 05 March 2009 - 04:09 AM

OK, I added the sort option for 3d mode from farthest to nearest as mentioned 2 posts ago... So now the particles are drawn according to the distance to the camera plane (not position) and not draw if they are behind the camera (Behind the camera plane). 2 birds in one stone... The distance to plane is fast and my pseudo optimised sort algorithm seems to be able to keep up...

part3d_system_draw_order(ind,draw order)

Draw order take the 0 and 1 (GM standard) and 2, Furthest first for 3d mode.

Added
part3d_particles_drawcount()
part3d_system_draw_alpha4()
Added angle cut off to PartSysSetCamData

Added Fire, with floating spark and smoke
Added Ground fog (Cool)
Added Fireworks
Added Particle Fountain


If you are a sort expert, I would like someone to look at my method... It's not a standard generic all purpose method...

Particle * _PDFirst = NULL;
Particle * _PDLast = NULL;
Particle * _PDLastAddedHi = NULL;
Particle * _PDLastAddedLow = NULL;
inline void AddToDList(Particle *p)
{
p->PartDPrev = NULL;
p->PartDNext = NULL;
	if(_PDFirst == NULL)
	{
		_PDFirst = p;
		_PDLast = p;
		return;
	}
	else if(p->dist <= _PDLast->dist)
	{
		_PDLast->PartDNext = p;
		p->PartDPrev = _PDLast;
		_PDLast = p;
		return;
	}
	else if(p->dist >= _PDFirst->dist)
	{
		_PDFirst->PartDPrev = p;
		p->PartDNext = _PDFirst;
		_PDFirst = p;
		return;
	}

	else if(p->dist-_PDFirst->dist < _PDLast->dist-p->dist)
	{
		Particle *i = _PDFirst;
		if(_PDLastAddedLow)
			if(_PDLastAddedLow->dist > p->dist)
				i = _PDLastAddedLow;
		while(i->dist > p->dist )
		{
			i = i->PartDNext;
			if(i==NULL) return;
		}
		Particle *first;
		Particle *second;
		Particle *third;
		first = i->PartDPrev;
		second = p;
		third = i;
		_PDLastAddedLow = p;
		if(first)
		{
			first->PartDNext = second;
		}
		if(second)
		{
			second->PartDPrev = first;
			second->PartDNext = third;
		}
		if(third)
		{
			third->PartDPrev = second;
		}
		return;
	}
	else
	{
		Particle *i = _PDLast;
		if(_PDLastAddedHi)
			if(_PDLastAddedHi->dist < p->dist)
				i = _PDLastAddedHi;

		while(i->dist < p->dist )
		{
			i = i->PartDPrev;
			if(i==NULL) return;
		}
		Particle *first;
		Particle *second;
		Particle *third;
		first = i;
		second = p;
		third = i->PartDNext;
		_PDLastAddedHi = p;
		if(first)
		{
			first->PartDNext = second;
		}
		if(second)
		{
			second->PartDPrev = first;
			second->PartDNext = third;
		}
		if(third)
		{
			third->PartDPrev = second;
		}
		return;
	}
}

draw
DrawCount = 0;
//ddebug("Draw",0);
			Particle *p = PartFirst; 
			//Particle *n = NULL;
			_PDFirst = NULL;
			_PDLastAddedLow = NULL;
			_PDLastAddedHi = NULL;
			while (p) 
			{
				p->dist = camplanedistance(p->x,p->y,p->z);
				if(p->dist>0) 
				{
					AddToDList(p);
					DrawCount++;
				}
				p = p->PartNext;
			}

			p = _PDFirst; 

			while (p) 
			{
				if(p->dist>0)
				{
					p->Draw();
				}
				p = p->PartDNext;
			}

Edited by icuurd12b42, 06 March 2009 - 03:33 AM.

  • 0

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#11 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 06 March 2009 - 10:29 PM

UPDATE:

Tested all functions, most passed
Added the emitter system
  • 0

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#12 Sindarin

Sindarin

    Indie Game Developer

  • New Member
  • 1644 posts
  • Version:GM:HTML5

Posted 06 March 2009 - 11:53 PM

ERROR in
action number 1
of Create Event
for object DemoObj:

Error defining an external function.


Are you sure you included the correct dll?
  • 0
GM 8.1 / GM:HTML5 User

#13 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 07 March 2009 - 12:13 AM

ERROR in
action number 1
of Create Event
for object DemoObj:

Error defining an external function.


Are you sure you included the correct dll?


Try again... It's the right dll. maybe you got a corrupted extract.

Reboot your system too. This is a common GM7 problem with all the dlls I have used and made. When GM starts to complain about a working dll, you basically have to reboot.

Though if you would provide the info/step you took, it would help. Did you convert to gm6 for example... Did you previously run another GMK that also used a DLL prior...
  • 0

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#14 Tepi

Tepi

    GMC Member

  • Global Moderators
  • 4248 posts
  • Version:GM:Studio

Posted 07 March 2009 - 12:31 AM

For GM6'ers: There are things to do after getting the editable LGM'd to gm6. There is in one part constant c_orange used. In many parts there is a constant ps_distr_invgaussian (what is its value?). You can fix this by throwing random values for the constants if you don't happen to know c_orange and that. There are luckily nothing more that'd need to be changed.

I ran into the same problems as I had run before with your camera system. It took me some time, but I managed to frame the problem into the few variables that limit the movement variables. I ignored them by doing argument0 instead of median(min,max,argument0) in those parts. And it worked. :D

-------------------

This is freaking awesome, dude! The particles run amazingly fast (as described), they look like the ones in 2D (just that in 3D), and the engine is incredibly easy to use! :D

I checked out some functions and I was surprised how well and easy you made the function controlling in 3D space. For example that the gravity works using a vector, and that the direction works with the yaw - pitch -system so to say. And if there indeed are equivalents for every single particle function, all I can say is wow. You've also commented the scripts very well, so that this could be used for anyone. I like it.

I'll surely know what to point to when someone comes asking again for how to make a 3D particle system. I'll say: you don't need to, it's been done for you, and it has been done very well. I'll most probably use this engine in my future games. And I'd rather not use anyone else's engines, that tells how good this is (and you'll be credited). :P

Perfection! Is there something it's missing?
  • 0

#15 Sindarin

Sindarin

    Indie Game Developer

  • New Member
  • 1644 posts
  • Version:GM:HTML5

Posted 07 March 2009 - 12:47 AM

Reboot your system too. This is a common GM7 problem with all the dlls I have used and made. When GM starts to complain about a working dll, you basically have to reboot.


Weird, never had that. In what environment do you compile? XP or Vista?

I know GM7 does funny things to DLLs but are you sure it's not a function/memory related problem?

Edited by Sindarin, 07 March 2009 - 12:50 AM.

  • 0
GM 8.1 / GM:HTML5 User

#16 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 07 March 2009 - 01:15 AM

For GM6'ers: There are things to do after getting the editable LGM'd to gm6. There is in one part constant c_orange used. In many parts there is a constant ps_distr_invgaussian (what is its value?). You can fix this by throwing random values for the constants if you don't happen to know c_orange and that. There are luckily nothing more that'd need to be changed.

I ran into the same problems as I had run before with your camera system. It took me some time, but I managed to frame the problem into the few variables that limit the movement variables. I ignored them by doing argument0 instead of median(min,max,argument0) in those parts. And it worked. :D


define c_orange 4235519
define ps_distr_invgaussian 2

in your constants

weird the invert gaussian is not in gm6

As for the camera median problem... I have no clue why GM6 would act differently... So going through all the camera scripts and removing those seems to do the job. Chances are, everyone would have his own cam anyway.

-------------------

This is freaking awesome, dude! The particles run amazingly fast (as described), they look like the ones in 2D (just that in 3D), and the engine is incredibly easy to use! :D

I checked out some functions and I was surprised how well and easy you made the function controlling in 3D space. For example that the gravity works using a vector, and that the direction works with the yaw - pitch -system so to say. And if there indeed are equivalents for every single particle function, all I can say is wow. You've also commented the scripts very well, so that this could be used for anyone. I like it.

I'll surely know what to point to when someone comes asking again for how to make a 3D particle system. I'll say: you don't need to, it's been done for you, and it has been done very well. I'll most probably use this engine in my future games. And I'd rather not use anyone else's engines, that tells how good this is (and you'll be credited). :P

Perfection! Is there something it's missing?


It's missing the destructors, deflectors, atractors and changers... But I may add them.

Some functions like the speed and direction, I am not 100% sure if it works 100% like the original. I would not mind someone taking a second look at that. For the direction, i'm not sure the step deviation is right and the wobble though as is, it does look like it's working and should do the job fine...

Some functions have extented features like the sprite function.

I plan to add model support and add a flag to NOT TILT the sprite towards the players but keep it oriented in the orientation and movement direction specified.


Oh and I managed to find a pretty fast metod to detect if the particle is in view BTW...

Distance to cam plane = adj, point_distance_3d = hyp... arcsin and you have an angle cutoff.
p->dist = camplanedistance(p->x,p->y,p->z);
				if(p->dist>0) 
				{
					if(asin(p->dist/point_distance_3d(p->x,p->y,p->z,camx,camy,camz))>anglecutoff)
					{
						AddToDList(p);
						DrawCount++;
					}
				}
				p = p->PartNext;

Works well enough... You can change the angle cut off if you plan to have huge stretched particles. Since the sprite is always oriented to the camera plane, worst case you set angle cut off to 0, you will never see anything appear out of nowhere while turning arround. Anything behind the cam will still be cut off. It works because, again, of the spite orientation. So I dont need to take the size of the particle into account.

With models, it's will be different though.


Reboot your system too. This is a common GM7 problem with all the dlls I have used and made. When GM starts to complain about a working dll, you basically have to reboot.


Weird, never had that. In what environment do you compile? XP or Vista?

I know GM7 does funny things to DLLs but are you sure it's not a function/memory related problem?


I have that happen quite a lot since I do a lot of dlls... Less now that I know the causes
1) If I convert a gm6 example with a dll, and forget to save as gmk before runing, I have a 30% chance of getting this error.. And I am screwed for any other gmk that use a dll.

2) If I run a gmk that uses a dll and it had an error (The game has GML error, variable does not sxist for example) and I abort (Quits without unloading the dll), the next run has increased chances of getting the error... When it does happen, I have to reboot. So, TIP, if you use a dll and you have an error, try to ignore it before quitting

3) I also have the error reported eroneously, clicking ignore and many times the dll was actually loaded and the game works fine when passed the errors.

I use dev c++ and it makes dll that have no dependencies but the last cause
4) MS compiled dlls that require undocumanted dll not everyone has one their system... That, my dlls do NOT suffer from.

I have gm7 and Vista

Edited by icuurd12b42, 07 March 2009 - 01:28 AM.

  • 0

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#17 Sindarin

Sindarin

    Indie Game Developer

  • New Member
  • 1644 posts
  • Version:GM:HTML5

Posted 07 March 2009 - 01:50 AM

I just moved the folder from my Desktop folder to a folder in my external drive and it worked.

It's like the dll cannot get directory names like Desktop, My Documents etc. I had the same problem when running GM games under Japanese locale and GM could not return the filename because Japanese Windows uses the Yen symbol to mark path slashes.
I currently have Greek locale on but I have no problems with other GM games or dlls. Maybe change the language in the version info of the dll or something?

Btw, this is really good looking and fast!
  • 0
GM 8.1 / GM:HTML5 User

#18 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 07 March 2009 - 02:10 AM

I just moved the folder from my Desktop folder to a folder in my external drive and it worked.

It's like the dll cannot get directory names like Desktop, My Documents etc. I had the same problem when running GM games under Japanese locale and GM could not return the filename because Japanese Windows uses the Yen symbol to mark path slashes.
I currently have Greek locale on but I have no problems with other GM games or dlls. Maybe change the language in the version info of the dll or something?

Btw, this is really good looking and fast!

I have yet to figure how to make Devc++ compile resource (.rc files) under Vista (A bug) to insert version info and stuff... Do me a favor, can you try any of my other dlls? Like the GMBinFile or even the GMFMODSimple.gmk and tell me if they have the trouble (links in tools in sig).... They should if the reasoning is right here.

In any case, directory stuff, that is beyond what my dll does. So the error must be with GM failing to see the dll to load it... Are you sure other dll gmks work? From the same folder mine failed?


[update]
Support For Models Added
Includes special scripts for placing static models in the game at a rotation angle and roation speed, so you can have noninterative stuff handled by the particle system (More 3d stuff is a great thing to have) as well as move the model arround like a normal particle
Changed the dll to use doubles all over instead of floats (GM was triggering silent floating point exception and would exit it'd own draw leaving the game running without updating the screen). So it should be a little slower now.

Edited by icuurd12b42, 07 March 2009 - 08:00 AM.

  • 0

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#19 HaRRiKiRi

HaRRiKiRi

    GMC Member

  • GMC Member
  • 1364 posts

Posted 08 March 2009 - 06:20 PM

Absolutely fantastic. Works beautifully and very fast. Aren't the particles drawn with the GM D3d? If yes, then is stunning how many things can GM actually draw in a 3d space. There was constant fps of 30 even with 3000 particles drawn on screen, and 6k total in the room. Thou there is some blending problems, I know that it is a GM problem thou. Like the smoke cloud in the sky blends beautifully with other particles, but the fog on the ground sometimes makes particles behind it disappear.
  • 0

#20 Tepi

Tepi

    GMC Member

  • Global Moderators
  • 4248 posts
  • Version:GM:Studio

Posted 08 March 2009 - 08:32 PM

Absolutely fantastic. Works beautifully and very fast. Aren't the particles drawn with the GM D3d?

Doesn't seem like it:
//gmexport double part3d_system_drawit(double ind) 
//This functions draws the particles in the system. You only have to call this when drawing is not automatic. It should be called in the draw event of some object.
with(argument0)
{
	external_call(global.dll_part3d_system_drawit,ind);
}

Thou there is some blending problems, I know that it is a GM problem thou. Like the smoke cloud in the sky blends beautifully with other particles, but the fog on the ground sometimes makes particles behind it disappear.

The blending problems aren't generally GM's fault. They occur in any and every tool and language you'll try to render the 3D with some transparency. Also, it's explained in the code comments:
//this sets the depth so particle systems draw "relatively" in order 
//thought their individual particles may interact badly with particles
//from other systems, Usually, it work well since particles are
//usually localized in an area of the map...
There's alot useful information in the comments. :D
  • 0

#21 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 08 March 2009 - 08:47 PM

Absolutely fantastic. Works beautifully and very fast. Aren't the particles drawn with the GM D3d? If yes, then is stunning how many things can GM actually draw in a 3d space. There was constant fps of 30 even with 3000 particles drawn on screen, and 6k total in the room.

Yes

draw_set_blend_mode(m_BlendMode);
	if(m_Model>-1)
	{
		d3d_set_culling(true);
		d3d_set_lighting(m_Lighting);
		draw_set_color((double)m_Color);
		draw_set_alpha(m_Alpha);
		d3d_transform_add_scaling(m_Size*m_XScale+sw,m_Size*m_YScale+sw,m_Size*m
_XScale+sw);
		d3d_transform_add_rotation_x(m_rx+m_Angle+aw);
		d3d_transform_add_rotation_y(m_ry);
		d3d_transform_add_rotation_z(m_rz+m_Angle+aw);
		d3d_transform_add_translation(x+fdx+m_PartSys->x,y+fdy+m_PartSys->y,z+fdz+m_PartSys->z);
		d3d_model_draw(m_Model,0,0,0,m_tex);
		d3d_set_lighting(false);
		d3d_set_culling(false);
	}
	else
	{
		d3d_transform_add_rotation_y(ry);
		d3d_transform_add_rotation_z(rz);
		d3d_transform_add_translation(x+fdx+m_PartSys->x,y+fdy+m_PartSys->y,z+fdz+m_PartSys->z);
		if(m_Sprite>-1)
			draw_sprite_ext(m_Sprite,m_image_index,0,0,m_Size*m_XScale+sw,
m_Size*m_YScale+sw,m_Angle+aw,(double)m_Color,m_Alpha);
		else
		{
			draw_set_alpha(m_Alpha);
			draw_point_color(0,0,(double)m_Color);
		}
	}
	d3d_transform_set_identity();

as you can see, it's all gm function calls to access the gm drawing space... Most other function are standard c/c++ code...

Thou there is some blending problems, I know that it is a GM problem thou. Like the smoke cloud in the sky blends beautifully with other particles, but the fog on the ground sometimes makes particles behind it disappear.

This is covered in the documentation... If you have multiple particle systems they will interfere with each other, Just like GM particle system (I think) but this becomes more obvious in 3d.

Splitting the effects in multiple system allows for faster and many tiny systems each with a decent number of particles, say a camp fire on the far side of a map, fireworks on another, as long as they are not close enough for their particles to intermix, it's a good setup. But the demo room is small enough to see this intermixing, sortof to show the problem of such setup and make you aware of it.

You can always place every particle in the same single huge particle system then everything works perfect but then you may end up halving the total number of particles in the entire room because the one system now has to order a huge amount of particles. The sort method is posted near the top of the 1st page (that code is older) but you see, if you have to sort many partices, it has the potential of getting expodentially slower

Edited by icuurd12b42, 08 March 2009 - 08:56 PM.

  • 0

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#22 FatHippieNinja

FatHippieNinja

    GMC Member

  • New Member
  • 4 posts

Posted 08 March 2009 - 09:00 PM

So cool thanks dude!
  • 0

#23 brett14

brett14

    GMC Member

  • GMC Member
  • 1151 posts
  • Version:GM8

Posted 09 March 2009 - 03:51 AM

Can you please post a mirror please? Host a net seems to not be liking my computer (I have slow internet, dl gets cut off half way through)
  • 0

P3DC V6.00 | Editor14 | Large 3D Terrain

GML programmer since 2005, C/C++ programmer since 2009, Java programmer since 2012


#24 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 09 March 2009 - 05:20 AM

Can you please post a mirror please? Host a net seems to not be liking my computer (I have slow internet, dl gets cut off half way through)


Done

Edited by icuurd12b42, 09 March 2009 - 05:22 AM.

  • 0

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#25 Spikehead777

Spikehead777

    GMC Member

  • GMC Member
  • 496 posts
  • Version:GM:Studio

Posted 09 March 2009 - 06:25 AM

Wow dude.

Someone send this guy a cookie, he deserves it.

It's very likely I will use this in a game I'm creating, if I get past creating the engine.
  • 0

#26 Alvare

Alvare

    Not an administrator

  • GMC Member
  • 1812 posts
  • Version:None

Posted 09 March 2009 - 10:57 AM

Cool! :)
I'm definitely going to try this out.
  • 0

#27 brett14

brett14

    GMC Member

  • GMC Member
  • 1151 posts
  • Version:GM8

Posted 11 March 2009 - 12:27 AM

Thanks for the mirror... This is an AWESOME .dll -- I knew using the library could do GM commands, but i didn't know it could draw things too...
I give it a definite 10/10 (It looks very realistic - finally we can have good fast rain/snow :) ) and it is also VERY FAST - GJ


U3D and X3D are very nice 3D dlls, the only problem is that they draw over game makers window, so all drawing has to be done in them, no d3d is possible. But this, this just draws the particles directly onto the screen using d3d. If somebody made a 3d dll (such as U3D) that drew directly on the screen (such as this), so that it allowed d3d use but drew using a faster method (such as Dx9, or openGL) it would be AWESOME!

Anyways, hope you continue to make awesome 3D dlls like this, and that there are a few updates. My next game is probably going to use this.
  • 0

P3DC V6.00 | Editor14 | Large 3D Terrain

GML programmer since 2005, C/C++ programmer since 2009, Java programmer since 2012


#28 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 12 March 2009 - 02:52 AM

Thanks brett and everyone

UPDATE:

Added particle destoyers
Half working particle deflectors (I'm working on it)

Thank tepi for the help on the odd shape collision detection
  • 0

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#29 mechanikos

mechanikos

    GMC Member

  • New Member
  • 453 posts

Posted 18 March 2009 - 12:18 AM

Am I missing something here?

It's long been known that GM's particle system natively works in 3d, you just need the right transformations, first stand the particles up, then rotate to the camera, then translate

d3d_transform_set_rotation_y(90)
d3d_transform_add_rotation_z(point_direction(x,y,camera.x,camera.y))
d3d_transform_add_translation(x,y,0)


I can get a few thousand particles going without much trouble.

Edited by mechanikos, 18 March 2009 - 12:20 AM.

  • 0

#30 Phantom107

Phantom107

    Graphics Enthusiast

  • GMC Member
  • 2774 posts
  • Version:GM:Studio

Posted 18 March 2009 - 12:28 AM

But simply rotating the particles to the camera doesn't suddenly give them any z-movement, do they?
  • 0

GMCSignature.png

 

The most advanced GM game yet. Check out the Titan Rush GMC topic here! Developed by Phantom Technology

Talented spriting artist, looking for work? PM me. I'm working on a small project and need assistance. :)


#31 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 18 March 2009 - 01:35 AM

Am I missing something here?

It's long been known that GM's particle system natively works in 3d, you just need the right transformations, first stand the particles up, then rotate to the camera, then translate

d3d_transform_set_rotation_y(90)
d3d_transform_add_rotation_z(point_direction(x,y,camera.x,camera.y))
d3d_transform_add_translation(x,y,0)


I can get a few thousand particles going without much trouble.


And where pre tel would you perform this call. Before the drawit call? And how about proper sorting of each particle so they draw in the right draw order?

But simply rotating the particles to the camera doesn't suddenly give them any z-movement, do they?


The depth of the particle system would likely match the z. But yes, no z movement.
  • 0

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#32 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 23 March 2009 - 08:54 AM

UPDATE:
Faster, limited number of GM calls by comparing old blend, alpha, culling and other values instead of doing a "blind" GM Function Call

Increases the number of drawn particles by 30%


NOTE: Now that one of the particle is an actual 3d tank model, The demo, if you tried the older sans tank model, will be a bit slower. You can change the tank particle to a regular sprite particle if you want to compare with the original.

NOTE: Also the particle destroyers, and deflectors now present in the demo will decrease performance from the original. Do note that if you have no destroyers or deflectors, the performance will increase drastically.


[edit]
I forgot to say, Source Included!

Edited by icuurd12b42, 23 March 2009 - 09:29 AM.

  • 0

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#33 Ruzzinator

Ruzzinator

    Xbox 360 Lover

  • New Member
  • 646 posts

Posted 23 March 2009 - 09:17 AM

I thought this was really fast when I first saw this but its 30% faster now?
*Faints*
  • 0

#34 Sindarin

Sindarin

    Indie Game Developer

  • New Member
  • 1644 posts
  • Version:GM:HTML5

Posted 23 March 2009 - 12:54 PM

Just an update thingy on the path problem. Yes, it seems that many dlls have path problems at some time with GM. I don't know the cause of it yet but still restarting fixes the problem. Never seen this happen on XP though. I am currently on Vista.

Aside from that the dll works. And works really good. I managed to get about 3000 particles with no fps drop.
  • 0
GM 8.1 / GM:HTML5 User

#35 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 24 March 2009 - 12:24 AM

Just an update thingy on the path problem. Yes, it seems that many dlls have path problems at some time with GM. I don't know the cause of it yet but still restarting fixes the problem. Never seen this happen on XP though. I am currently on Vista.

Aside from that the dll works. And works really good. I managed to get about 3000 particles with no fps drop.


It's a mistery (apart from the points I enumerated). At least it's intermitent.
  • 0

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#36 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 27 April 2009 - 09:24 AM

UPDATE:
I added a spore like galaxy just for fun.

**NOTE, Change the room in the GMK to see the right demo (Default is now the Spore Like Galaxy)
  • 0

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#37 Katuko

Katuko

    GMC Member

  • GMC Member
  • 5968 posts

Posted 30 April 2009 - 08:37 PM

From the vid it looks awesome and pretty fast. I'll be sure to use this once I really start making 3D stuff. :(
  • 0
My other profiles: WordPress | deviantART | Steam

#38 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 12 May 2009 - 10:54 PM

I have a question for you:

I've been working with your 3D particle system for a little mini game I started the other day, but now the hud doesn't draw...

obj_control step event:

part3d_system_depth(ps,point_distance_3d(global.placex,global.placey,0,camx,camy,camz)-1000000)
(global.placex/y are set to 0 because I didn't know what else to set them to.)

The hud object's depth is -10000000.

Hud object's draw event:
d3d_set_projection_ortho(0,0,640,480,0);
d3d_set_hidden(false);

...

d3d_set_hidden(true);

For the most part, I think its pretty much set up just like your demo gmk. Obviously the hud object wasn't there but if its drawn after anyways, shouldn't it draw over the particles? What could the problem be?


d3d_set_projection_ortho(0,0,640,480,0);
d3d_set_lighting(false);
d3d_set_depth(0); //<----

draw_sprite(sprite_index,-1,0,0);



In 3d, GM uses the depth as z (sometimes) moving your object along the zaxis to a position that is beyond the camera

Confusing, but I had the same problem with other tools.

the depth will still be at -10000000 but in the 3d word the zposition (d3d_depth) will be set back to 0 and so on the 0,0,640,480 (camera relative) plane at z 0. where it was as -1000000 (same a depth property) (behind the cam) before...

And no I have no idea why it does that, the paragraph above is pure speculation from my experience
  • 0

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#39 brett14

brett14

    GMC Member

  • GMC Member
  • 1151 posts
  • Version:GM8

Posted 18 May 2009 - 08:46 AM

I like the update and im glad to see you've included the source, I'm stating to learn c++ so it may help me ;)
  • 0

P3DC V6.00 | Editor14 | Large 3D Terrain

GML programmer since 2005, C/C++ programmer since 2009, Java programmer since 2012


#40 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 18 May 2009 - 09:35 PM

I like the update and im glad to see you've included the source, I'm stating to learn c++ so it may help me :)


I always include the source code. That way the work can go if anything happens. With people getting it and if in a few years I am gone, and the links go dead, at least people who downloaded it can send it to people who ask for it. Sounds grim but there are a few dead links on the forum with interesting stuff.


Also it gives you the option to mod it to your own specs.


I have a "how to make a dll" tutorial here and in the faq forum too.
  • 0

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#41 Keysle

Keysle

    GMC Member

  • GMC Member
  • 208 posts

Posted 16 July 2009 - 09:13 PM

it's really good.
I just can't the ability to lay objects on top of it like a HUD
----
EDIT -------
OPE!!okay found the answer

Edited by Keysle, 16 July 2009 - 09:32 PM.

  • 0
Posted ImagePosted Image

#42 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 16 July 2009 - 10:33 PM

Glad I put in that hud problem post... And glad you obviously found it.
  • 0

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#43 Keysle

Keysle

    GMC Member

  • GMC Member
  • 208 posts

Posted 17 July 2009 - 03:56 AM

Glad I put in that hud problem post... And glad you obviously found it.

AAAAAAAh... Now when I use a HUD the particles don't show up... ;)

DUDE those particles are awesome i need to use them...

Is there a way to have particles in my HUD? (non object particles that is)
  • 0
Posted ImagePosted Image

#44 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 17 July 2009 - 04:28 AM

Glad I put in that hud problem post... And glad you obviously found it.

AAAAAAAh... Now when I use a HUD the particles don't show up... ;)

DUDE those particles are awesome i need to use them...

Is there a way to have particles in my HUD? (non object particles that is)



OK, describe what you need (your problem). 'cause I thought I knew but obviously don't now.
  • 0

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#45 Keysle

Keysle

    GMC Member

  • GMC Member
  • 208 posts

Posted 17 July 2009 - 04:58 AM

when I use this HUD method


{
   d3d_set_projection_ortho(0,0,640,480,0);
  d3d_set_hidden(false);
  repeat 3
{
  draw_sprite_ext(sprite_index,-1,x+ran(15),y+ran(15),1,1,0,merge_color(c_white,c_black,random(.6)),random(.5)+.5);
}
  draw_sprite_ext(sprite_index,-1,x,y,1,1,0,c_black,1);
  
  d3d_set_hidden(true);
}

the particles are not being drawn correctly. They appear to be behind in the background.


How would I go about making a HUD?
Have you made a Display Menu (HUD) over this 3D particle technique?
I don't know 3D from scratch so I just used the tutorials HUD method
  • 0
Posted ImagePosted Image

#46 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 17 July 2009 - 05:15 AM

Well, set the depth of your backgound to 100000000
and try
d3d_set_depth(0)

in your draw... That is for your background...

set the depth of your hud to -100000000
and try
d3d_set_depth(0)

in your draw... That is for your hud...


Though I still don't get what you are saying... Are you talking about a background or a hud here

Or are you trying to draw 3d particles over the hud? I'm confused.

Maybe I can take a look at your project (zip it and include GM3dPartSys.dll)

Edited by icuurd12b42, 17 July 2009 - 05:16 AM.

  • 0

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#47 Keysle

Keysle

    GMC Member

  • GMC Member
  • 208 posts

Posted 17 July 2009 - 05:57 AM

Directly from your example I have tried to make a HUD.
I was able to but the particles dissapeared
  • 0
Posted ImagePosted Image

#48 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 17 July 2009 - 06:23 AM

Well, the explanation in the post right before your first post says how to fix this

set the depth to your hud to -10000000 to make sure it's drawn last and not in the middle of the particle effects samples, because I move them arround the depth layer (which you don't need to do if you use the same system for everything).

And set the 3d depth to 0 to bring back the sprite at z 0; You dont see the hud because it's drawn at an altitude of z 10000000... way above (or below you)

d3d_set_projection_ortho(0,0, room_width, room_height, 0);
d3d_set_depth(0)
d3d_set_culling(0)
draw_sprite(sprite_index,-1,x,y);
d3d_set_culling(1)


I updated the zip with a hud...

Edited by icuurd12b42, 17 July 2009 - 06:32 AM.

  • 0

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#49 Keysle

Keysle

    GMC Member

  • GMC Member
  • 208 posts

Posted 17 July 2009 - 03:46 PM

I did what you said with that and I still got some wierd stuff
here's the file
http://www.mediafire...04e75f6e8ebb871
IDK if it's vista or not


------

EDIT: your new ZIp File is not unzipping with files in it..


--------- Even Later EDIT:

OOHH!!! IT's working now!
Thanks!!!
;)

Thanks for all the help...
I will give big credit!

Oh yeah
is it possible to change the the particle colors?

Edited by Keysle, 17 July 2009 - 04:05 PM.

  • 0
Posted ImagePosted Image

#50 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 17 July 2009 - 07:43 PM

is it possible to change the the particle colors?


Of course. It has the same features as GM's particle system so use GM's help to know what to do + compare with the 3d equivalent to make sure there are no differences from the original. It's well documented in the scripts' comments.

For example
part_particles_create_color(ind,x,y,parttype,color
,number) This functions creates number particles of the indicated type at postion (x,y) in the system with the indicated color. This is only useful when the particle type defines a single color (or does not define a color at all).


Mine is a little different
//Note, unlike the gm equivalent, if you set (prior) a color cycle, this will replace the first color in the cycle


Other means of changing color
part_type_color1(ind,color1) Indicates a single color to be used for the particle.
part_type_color2(ind,color1,color2) Specifies two colors between which the color is interpolated.
part_type_color3(ind,color1,color2,color3) Similar but this time the color is interpolated between three colors that represent the color at the start, half-way, and at the end.
part_type_color_mix(ind,color1,color2) With this function you indicate that the particle should get a color that is a random mixture of the two indicated colors. This color will remain fixed over the lifetime of the particle.
part_type_color_rgb(ind,rmin,rmax,gmin,gmax,bmin,b
max) Can be used to indicate that each particle must have a fixed color but choosen from a range. You specify a range in the red, green, and blue component of the color (each between 0 and 255).
part_type_color_hsv(ind,hmin,hmax,smin,smax,vmin,v
max) Can be used to indicate that each particle must have a fixed color but choosen from a range. You specify a range in the hue saturation and value component of the color (each between 0 and 255).
  • 0

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button