Jump to content


Photo

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


  • Please log in to reply
121 replies to this topic

#61 icuurd12b42

icuurd12b42

    Self Formed Sentient

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

Posted 03 March 2010 - 07:15 AM

Changes March 03 2010
added part3d_type_stepN
added part3d_type_born
added part3d_type_culling
added part3d_type_lighting
added part3d_type_parent_speed
added part3d_type_parent_gravity
added part3d_type_friction
added part3d_particles_set_item_lighting
added part3d_particles_set_item_alpha
added part3d_particles_get_item_x
added part3d_particles_get_item_y
added part3d_particles_get_item_z
added part3d_particles_get_item_rx
added part3d_particles_get_item_ry
added part3d_particles_get_item_rz
added part3d_particles_get_item_alpha
added part3d_particles_get_item_color
added part3d_particles_get_item_visible
fixed gravity not being applied in some cases
fixed (I hope) createRotXYZ particle which sometimes were created with speed and angular speed
  • 0

#62 icuurd12b42

icuurd12b42

    Self Formed Sentient

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

Posted 05 March 2010 - 07:58 PM

OOPS... the last updates, I forgot to link to the right download. sorry about that.
  • 0

#63 Spartan117John

Spartan117John

    GMC Member

  • GMC Member
  • 579 posts

Posted 10 March 2010 - 11:17 PM

WOW... this is definitely one of the best DLLs I've ever seen... people can finally create awesome particle-effects in 3D with very little FPS cost. Great job icuurd12b42!
  • 0

#64 Arty Dragon

Arty Dragon

    GMC Member

  • New Member
  • 8 posts

Posted 12 March 2010 - 02:59 AM

This is truely amazing. Thousands of particles with low-cost fps... just wow... But, I'm having a depth problem. Simple to fix I imagine but this really isn't my area of expertise... then again, I dunno what is. I've merged the GM3dPartSys editable, Slayer 64's Project K, and Movenow!. I'm testing out the GroundFogObj and the particles are drawing in front of everything(the map and player). I had toyed around with the part3d_system_depth function.

Here is the editable: Posted Image
Ignore the incorrectly textured player models and map. I can fix those later.

Edited by Arty Dragon, 12 March 2010 - 03:08 AM.

  • 0

#65 icuurd12b42

icuurd12b42

    Self Formed Sentient

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

Posted 12 March 2010 - 06:23 AM

You are calling
d3d_set_hidden(0);

in your control draw... comment it out, you dont want that...

Set the controller dept to 1000000 too

And dont call part3d_system_depth() in the controller... with hiddeen set to true and the particle draw order set to 2 (sort by dist to cam, like it is now), this is not needed.

However, it would be best if the particle system would draw LAST in your games, after the scene is rendered, so transparent particle show the right things behind/through them
part3d_system_depth(-100)

and move that
d3d_transform_set_identity();
in the player, it's in the if statement. it should be after the if statement else it wont be called sometimes


since you dont use an extra
d3d_transform_set_identity();
in the begining of your draw (to be safe, but slower), you have to be careful that
d3d_transform_set_identity();
is ALWAYS called after you issued transform calls else the next object in line will be transformed with these calls on top of their own.

Edited by icuurd12b42, 12 March 2010 - 06:32 AM.

  • 0

#66 Arty Dragon

Arty Dragon

    GMC Member

  • New Member
  • 8 posts

Posted 13 March 2010 - 12:47 AM

Thanks! Works now. :medieval: And thanks for that d3d_transform_set_identity() bit too.
  • 0

#67 IamCalle

IamCalle

    GMC Member

  • GMC Member
  • 444 posts

Posted 14 March 2010 - 01:31 AM

Again: Nice work on the updates.
  • 0

#68 ewic

ewic

    GMC Member

  • New Member
  • 252 posts

Posted 25 March 2010 - 12:28 AM

Wow very nice, this is more than I ever could have hoped for! I did find a small, simple bug though after downloading it today.

You get an error immediately when you run the executable because in the Room Start Event for DemoObj, the second line in the code:

spr = sprite_add("tank.png",1,0,0,0,0,0);

There is one too many arguments, so take away a 0 from that list and the game works fine. :P
  • 0

#69 icuurd12b42

icuurd12b42

    Self Formed Sentient

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

Posted 25 March 2010 - 01:54 AM

Wow very nice, this is more than I ever could have hoped for! I did find a small, simple bug though after downloading it today.

You get an error immediately when you run the executable because in the Room Start Event for DemoObj, the second line in the code:

spr = sprite_add("tank.png",1,0,0,0,0,0);

There is one too many arguments, so take away a 0 from that list and the game works fine. :P


Not tested on GM8... so you'll be the first... fix the arguments to match the function change, GM8 changed the arguments. sorry aboiut that.
  • 0

#70 Jepie0

Jepie0

    GMC Member

  • GMC Member
  • 213 posts

Posted 25 March 2010 - 02:59 AM

AWESOME it now works with gm8!!!! I had no idea you had added gm8 support iccuurd12b42 i thought you where waiting on the gmapi update?

Thanks, Jepie0
  • 0

#71 icuurd12b42

icuurd12b42

    Self Formed Sentient

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

Posted 25 March 2010 - 05:03 AM

AWESOME it now works with gm8!!!! I had no idea you had added gm8 support iccuurd12b42 i thought you where waiting on the gmapi update?

Thanks, Jepie0


Yep I did have to wait for it. Latest gmapi is now gm8 complient, I updated all my dlls that use it...
  • 0

#72 Alvare

Alvare

    Allrounder

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

Posted 03 April 2010 - 08:44 AM

I'm going to try this. :mellow:
Must be really fast!
  • 0

#73 Drara

Drara

    GMC Member

  • GMC Member
  • 325 posts

Posted 15 April 2010 - 05:12 PM

That is great, and I mean realy great!!!
I got on my middle-high-end PC 2650 things to draw (not just there, but drawed) at an speed of 29-30 fps.
Thats a lot better then the build-on functions I think.

And I like how you made the example.
Flying tanks, realy great ;)
  • 0

#74 icuurd12b42

icuurd12b42

    Self Formed Sentient

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

Posted 16 April 2010 - 01:35 AM

That is great, and I mean realy great!!!
I got on my middle-high-end PC 2650 things to draw (not just there, but drawed) at an speed of 29-30 fps.
Thats a lot better then the build-on functions I think.

And I like how you made the example.
Flying tanks, realy great ;)


That's good
  • 0

#75 Tepi

Tepi

    GMC Member

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

Posted 15 May 2010 - 04:51 PM

Hmm... Are you aware of some kind of small offset in particle positions that this system seems to have? The difference is really small and the problem could be mine as well (although I currently can't see how in the world I could've caused it), but it becomes obvious if you want to locate a single small particle exactly to a position.

How the problem appears is that the particles are drawn a little off from the actual particle position. In a game I'm making I could rotate the camera around and see the particles go in an ellipse of some kind around the position where it should've been. Hours of trial-and-error locating the particle stream exactly at the desired position, while it was always a little off led me to figure this out. The camera direction visibly affects the offset, but not in any obvious pattern (such as always being a little above the position on screen).

I hacked a solution to this, which was to set the particle sprite origin to (23,19) (The sprite was stretched to the resolution 64x64 just in case it would matter). Now this looks rather random, but it gave me a result where the deviation was sufficiently small not to be seen.

Anyway, do you have any idea of what's exactly causing this?
  • 0

#76 icuurd12b42

icuurd12b42

    Self Formed Sentient

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

Posted 15 May 2010 - 06:35 PM

...


I'm prety confident it's the sprite size vs sprite origins, like you have conclude. Taking a look at my sprite, I had fixed this a while back, but ruined it cropping all the sprites to save on the gmk size.

The pixel sprite should be dead center (could you confirm).. size 5x5 origins 2,2 but others, you can look at them, both alpha mask and sprite, any one that has a width or height of even value (64 instead 65) should cause this offset problem.

Originaly, all had 64x64 size. then my fix was to rescale to 65x65, to have an exact center origin clicking the center button. Later I cropped them a ruined it. I did not think it would; I assumed the crop would retain a the intended uneveness of the width or heigh values... Look at spark, one side is even and the other is not. I blame the GM crop function LOL...

Edited by icuurd12b42, 15 May 2010 - 06:36 PM.

  • 0

#77 sub

sub

    EVIL GENIUS

  • GMC Member
  • 1889 posts
  • Version:GM6

Posted 04 June 2010 - 09:18 PM

i've been trying to make use of GM's inbuilt save / load feature while using this particle dll, but it's not working properly.

upon loading, there seems to be leftover models and particles?

what i did
pressed F5 to save
resumed playing for @ 10 seconds
pressed F6 to load
the objects that were in those last 10 seconds seemed to end up in the new loaded game.

i will try implemeting a save feature that quits the game immediately afterwards, and a load feature that can be used in the game starting menu.

do you know of a workaround.. or how i might be able to clear off any particles / models..
i think i am correctly freeing the dll and clearing particles/models on game ending, as required.
  • 0

#78 icuurd12b42

icuurd12b42

    Self Formed Sentient

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

Posted 04 June 2010 - 09:39 PM

i've been trying to make use of GM's inbuilt save / load feature while using this particle dll, but it's not working properly.

upon loading, there seems to be leftover models and particles?

what i did
pressed F5 to save
resumed playing for @ 10 seconds
pressed F6 to load
the objects that were in those last 10 seconds seemed to end up in the new loaded game.

i will try implemeting a save feature that quits the game immediately afterwards, and a load feature that can be used in the game starting menu.

do you know of a workaround.. or how i might be able to clear off any particles / models..
i think i am correctly freeing the dll and clearing particles/models on game ending, as required.


Yes, I have one for FMOD. the concept is the same here. you need to catch the save and load and re-setup everything. It it a tedious task, mor so here. For one, I recomend you use a a mission based based system where you only save when a mission is done. Thay way you only need to save, in an ini, which mission (room) you have to do next, that way almost no management is required but what you have now... But here is the concept to do the GM save load

http://gmc.yoyogames...p;#entry3251089
  • 0

#79 icuurd12b42

icuurd12b42

    Self Formed Sentient

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

Posted 10 June 2010 - 12:30 AM

So now you have an idea... lets me tell you why you NEED to create a NEW partsys when you load a game...

say partsys an instance (say id 100100) wrapping the real partsys pointer (address 0x1234ABCD) held in a variable in that partsys instance.

you save... GM will save the instance AND the varaibles including that variable with the real ps adress 0x1234ABCD

when you save and load, GM does NO memeory management of the dll.


So, you save. GM save the ps manager instance and the variable with value 0x1234ABCD
In the dll, this 0x1234ABCD adress is valid. the code loops using this adress, through all the particles...
You load... gm loads the variable with the value 0x1234ABCD... It's still valid, as the dll still have that spot allocated. the game will run.

BUT. if you quit the game. the next time you run it, the ps variable will have 0xABCD0001 (for example, to have the location of the ps in the dll. the game runs fine, I dont care where the memory is. BUT now you do a load game. GM replaces 0xABCD0001 with the saved value of 0x1234ABCD. Such memory is not used by the current execution of the dll. This is bad. The partsystem using 0x1234ABCD will now crash you game.

That is why you have to create a NEW partsys when you load the game. not just clear the current one.

Save:
before you save
temp = global.partsys;
global.partsys = noone; //invalid in file
instance_deactivale_object(Part3d) //deactivated in file
game_save() //save
global.partsys = temp //reset for current use
instance_activale_object(Part3d) //reset for current use

this way, no part3d will be active when you load and the global.partsys is invalid, cant be used by any instances


Load:
clear and free the current partsys right before the game_load call free everything.

with(Part3dEmit) part3d_emitter_destoy(id);
with(Part3dType) part3d_type_destoy(id) ;
and so on for part deflector and part destructor and any other
with(Part3dSys) part3d_system_destoy(id);

and set global.partsys to noone so NO other instances (yours) try to play with the partsyst while in the load detection mode

call game_load()

detect the game load as per that fmod thread then wen detected
instance_activale_object(Part3d) //right after you load, reactivating the invalid instances saved
with(Part3d) instance_destroy() //kill them (the loaded ones) without actually calling their dll stuff
recreate the part3d stuff the room needs, partsys and all, and tell your instances that used the global.partsys to reconstruct themselves, re associating their stuff with the new partsys.


That way, everytime you load, the old <current> system is cleared, freed. The old saved system is destroyed, while being inactive for the duration of the load detection scheme. while other instances cant access the global.partsyss, noone while in the detection scheme. then reset to a fresh one when the load is detected.

It's very, very twisty yes?

Edited by icuurd12b42, 10 June 2010 - 12:33 AM.

  • 0

#80 C3PO the Dragon Slayer

C3PO the Dragon Slayer

    GMC Member

  • New Member
  • 70 posts

Posted 11 July 2010 - 08:06 PM

This is weird.

It's not working in GM8.

I'm opening the same file in GM7 and GM8, and it works in GM7, but not GM8.
  • 0

#81 icuurd12b42

icuurd12b42

    Self Formed Sentient

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

Posted 12 July 2010 - 12:25 AM

This is weird.

It's not working in GM8.

I'm opening the same file in GM7 and GM8, and it works in GM7, but not GM8.

change the sprite_add("tank.png",1,0,0,0,0,0,0); parameters to the gm8 equivalent.
  • 0

#82 Desert Dog

Desert Dog

    GMC Member

  • GMC Elder
  • 6409 posts
  • Version:Unknown

Posted 13 December 2010 - 03:24 AM

Finally got around to trying this.

Never a fan of using DLL's, but I'll make an exception with this one, I think. Very cool!
  • 0

#83 Arial

Arial

    GMC Member

  • Banned Users
  • 580 posts
  • Version:GM8

Posted 13 April 2011 - 07:41 PM

FATAL ERROR in
action number 1
of Other Event: Room Start
for object DemoObj:

COMPILATION ERROR in code action
Error in code at line 2:
spr = sprite_add("tank.png",1,0,0,0,0,0,0);
^
at position 43: Wrong number of arguments to function or script.


WTF?

sprite_add unknown command

Edited by Arial, 13 April 2011 - 08:11 PM.


#84 icuurd12b42

icuurd12b42

    Self Formed Sentient

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

Posted 13 April 2011 - 08:42 PM

FATAL ERROR in
action number 1
of Other Event: Room Start
for object DemoObj:

COMPILATION ERROR in code action
Error in code at line 2:
spr = sprite_add("tank.png",1,0,0,0,0,0,0);
^
at position 43: Wrong number of arguments to function or script.


WTF?

sprite_add unknown command


Send Mark an email to complain it's NEVER a good idea to change arguments for an existing function...

and it's at position 43: Wrong number of arguments to function or script.
NOT UNKNOWN COMMAND

Fix the arguments to match GM8 or just remove the tank particle from the demo. As I have stated like 10 times in this thread.

Edited by icuurd12b42, 13 April 2011 - 08:43 PM.

  • 0

#85 GamerXP

GamerXP

    GMC Member

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

Posted 15 April 2011 - 04:10 AM

Pretty nice. Only 1 think - what about addin some timestep/delta time argument? Will be pretty useful
  • 0

#86 icuurd12b42

icuurd12b42

    Self Formed Sentient

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

Posted 15 April 2011 - 07:19 PM

Pretty nice. Only 1 think - what about addin some timestep/delta time argument? Will be pretty useful


?? Not present in GM's particle system
  • 0

#87 GamerXP

GamerXP

    GMC Member

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

Posted 15 April 2011 - 07:34 PM

I know. Thats why GM/s PS is pretty boring. Adding new function won't break anything I think. Why are you limiting with GM's particles functions?
  • 0

#88 Arial

Arial

    GMC Member

  • Banned Users
  • 580 posts
  • Version:GM8

Posted 15 April 2011 - 08:41 PM


FATAL ERROR in
action number 1
of Other Event: Room Start
for object DemoObj:

COMPILATION ERROR in code action
Error in code at line 2:
spr = sprite_add("tank.png",1,0,0,0,0,0,0);
^
at position 43: Wrong number of arguments to function or script.


WTF?

sprite_add unknown command


Send Mark an email to complain it's NEVER a good idea to change arguments for an existing function...

and it's at position 43: Wrong number of arguments to function or script.
NOT UNKNOWN COMMAND

Fix the arguments to match GM8 or just remove the tank particle from the demo. As I have stated like 10 times in this thread.

Listen brother i looked the entire gm8 help. But could not find how to upload external sprites. Nevermind i am waiting for gm8.1 keys pherhaps gm8.1 is better then gm8.

Whats the phone number of Mark Overmars? I have seen some of his gm class photo shots where he rapes boys so i do not whish to see him in person. I will complain him on phone.

#89 hi123

hi123

    GMC Member

  • GMC Member
  • 7 posts

Posted 16 April 2011 - 12:01 AM

This is the first time I've ever used a dll in GM. I tried to whittle this down to strictly the main engine so I could export the scripts and a resource file and load them up in a game I'm working on. I have deleted all the demo objects, paths, rooms, camera options, and basically everything except the scripts not involved with the demo, the sprites, and objects not involved with the demo. When I tried loading the resources, it wasn't recognizing the dll (yes, I put it in the same folder as my game). I don't really know what I'm doing here. Could you post a short guide about how to do this, or maybe a cut down version so I can just import the resources into Game Maker and jump right into creating particle systems. This would be very much appreciated. Thanks!
  • 0

#90 icuurd12b42

icuurd12b42

    Self Formed Sentient

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

Posted 16 April 2011 - 04:27 AM

See update below (post #91)

Listen brother i looked the entire gm8 help. But could not find how to upload external sprites. Nevermind i am waiting for gm8.1 keys pherhaps gm8.1 is better then gm8.

Whats the phone number of Mark Overmars? I have seen some of his gm class photo shots where he rapes boys so i do not whish to see him in person. I will complain him on phone.


sprite_add differs in arguments from gm7 and gm8 (I hate Mark for having done that). This was created for gm7. Just change the argument in the sprite_add call in line 2 of DemoObj to match what gm8 expects

This is the first time I've ever used a dll in GM. I tried to whittle this down to strictly the main engine so I could export the scripts and a resource file and load them up in a game I'm working on. I have deleted all the demo objects, paths, rooms, camera options, and basically everything except the scripts not involved with the demo, the sprites, and objects not involved with the demo. When I tried loading the resources, it wasn't recognizing the dll (yes, I put it in the same folder as my game). I don't really know what I'm doing here. Could you post a short guide about how to do this, or maybe a cut down version so I can just import the resources into Game Maker and jump right into creating particle systems. This would be very much appreciated. Thanks!


Does the demo work as is? are you using gm8? Is it an existing game? If Gm8 Load the demo, make a export package, export everything, then import the package into your game. Place the 3 demo rooms as the top 3 room in your game and hit run.

I'm currently hunting down "error importing function" problems... Is that what your are experiencing?

Edited by icuurd12b42, 16 April 2011 - 06:12 AM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users