Nick:  
Pass:     
Help Register


Post Reply 
Modding Particle modding
Author Message
Rasmus Offline
Main developer of Dwelvers
Dwelvers Developers

Posts: 3.619
Joined: Sep 2013
Reputation: 502
Post: #1
Particle modding
Sorry about all these moding features, they don't progress the game, they only give me the tools to progress the game faster in the future.

So first I started on the creature moding, then I was forced to make the items modable so that the creatures can hold items that aren't hardcoded. Then I came to the situation where the creatures should be able to throw items as well, as the Impanzee throwing rocks for example, this forced me to be able to make the items as projectiles as well and give the projectile damage and so on.

And once I made the items as projectiles I had to do something about the cannonball as that is a projectiles as well, so I added cannonballs as an item that the cannons shoot. But as the cannonballs have particle effects as exploding for example I had to make the particle effects modable as well.

So this is how it works to make particle effects at this moment:

First of all I have added a particles folder into the media folder like this:

[Image: FolderParticles.png]

All xml files in this folder will be loaded as particle packages and their name can be called in any other xml mod to create this particle effect.

This is how it looks inside the CannonBallExplosion.xml:

Code:
(particlepackage)
  (particle)CannonBallExplosionFire(/particle)
  (particle)CannonBallExplosionFragments(/particle)
  (particle)CannonBallExplosionSmoke(/particle)
(/particlepackage)

What this particle package does is telling the game what particle systems it is that should be used in this particle effect.

This brings us to the particlesystems folder:

[Image: FolderParticleSystems.png]

Here you can see the particle effects mentioned in the particle package above. All xml files in the particle systems folder will be loaded automatically by the game from start. So if you want to add another particle effect you just create the particlesystem in this folder and then add its name to the cannonballexplosion.xml package.

The reason I have different particle systems to create the cannon ball explosion for example is because the physics for the smoke, fragments and the fire is different and need to be kept seperate to create the best effect possible.

If we take a look into the "CannonBallExplosionFire.xml" it will look like this:

Code:
(?xml version="1.0" encoding="UTF-8"?)

(!-- Cannonball explosion fire --)

(particle)
  (chance)100(/chance) (!-- Chance value 0 = none, 1000 = every frame--)
  (particlesperframe)120(/particlesperframe) (!-- Num generated particles per frame, this is based on 60fps --)
  
  (posmin)0,0,0(/posmin) (!-- Min position ((x, y, z) * tile / 1000) --)
  (posmax)0,0,0(/posmax) (!-- Max position ((x, y, z) * tile / 1000) --)
  (posdirmin)0(/posdirmin) (!-- Min position towards ingame direction (x * tile / 1000) --)
  (posdirmax)0(/posdirmax) (!-- Max position towards ingame direction (x * tile / 1000) --)
  
  (velmin)-3000,-3000,-3000(/velmin) (!-- Min velocity ((x, y, z) * tile / (sec * 1000)) --)
  (velmax)3000,3000,3000(/velmax) (!-- Max velocity ((x, y, z) * tile / (sec * 1000)) --)
  (veldirmin)-3000(/veldirmin) (!-- Min velocity towards ingame direction (x * tile / 1000) --)
  (veldirmax)-3000(/veldirmax) (!-- Max velocity towards ingame direction (x * tile / 1000) --)
  
  (accmin)0,0,0(/accmin) (!-- Min acceleration ((x, y, z) * tile / (sec * sec * 1000)) --)
  (accmax)0,0,0(/accmax) (!-- Max acceleration ((x, y, z) * tile / (sec * sec * 1000)) --)
  (accdirmin)0(/accdirmin) (!-- Min acceleration towards ingame direction (x * tile / 1000) --)
  (accdirmax)0(/accdirmax) (!-- Max acceleration towards ingame direction (x * tile / 1000) --)
  (negaccvelmin)-3000,-3000,-3000(/negaccvelmin) (!-- Min acceleration against velocity ((x, y, z) * (-vel) / 1000) --)
  (negaccvelmax)-3000,-3000,-3000(/negaccvelmax) (!-- Max acceleration against velocity ((x, y, z) * (-vel) / 1000) --)

  (sizemin)1500(/sizemin) (!-- Min size (x * tile / 1000) --)
  (sizemax)2500(/sizemax) (!-- Min size (x * tile / 1000) --)

  (blendinspeedmin)500(/blendinspeedmin) (!-- Min (blend in + out = 0 = instant), (x * lifetime / 1000) --)
  (blendinspeedmax)500(/blendinspeedmax) (!-- Max (blend in + out = 0 = instant), (x * lifetime / 1000) --)
  (blendoutspeedmin)250(/blendoutspeedmin) (!-- (Blend in + out = 0 = instant), (x * lifetime / 1000) --)
  (blendoutspeedmax)1000(/blendoutspeedmax) (!-- (Blend in + out = 0 = instant), (x * lifetime / 1000) --)

  (rotationspeedmin)0(/rotationspeedmin) (!-- Min rotation speed along the depth axis (x / (sec * 1000)) --)
  (rotationspeedmax)0(/rotationspeedmax) (!-- Max rotation speed along the depth axis (x / (sec * 1000)) --)
  (flipX)2(/flipX) (!-- Flip texture X (0 = no flip, 1 = flip, 2 = random flip) --)
  (flipY)0(/flipY) (!-- Flip texture Y (0 = no flip, 1 = flip, 2 = random flip) --)
  (colormin)255,180,180,64(/colormin) (!-- Min (R,G,B,A) color (0 - 255) --)
  (colormax)255,255,255,128(/colormax) (!-- Max (R,G,B,A) color (0 - 255) --)
  (brightnessmin)0(/brightnessmin) (!-- Brightness min (x / 255) --)
  (brightnessmax)128(/brightnessmax) (!-- Brightness max (x / 255) --)
  
  (lifetimemin)200(/lifetimemin) (!-- Min lifetime (x / sec * 1000) --)
  (lifetimemax)400(/lifetimemax) (!-- Max lifetime (x / sec * 1000) --)
  (bloommin)500(/bloommin) (!-- Min bloom value (x / 1000) --)
  (bloommax)750(/bloommax) (!-- Max bloom value (x / 1000) --)
  (texture)Fire1.png(/texture)
  (texture)Fire2.png(/texture)
  (texture)Fire3.png(/texture)
  (texture)Fire4.png(/texture)
(/particle)

I have made some comments in the code describing what each thing does, but it may still be a little confusing, I think the best way to get a hang of it by tinkering with the values. And this is the best part, every xml files can be edited and reloaded inside the game by just pressing "ALT+R" for instant feedback on the result of the editing. This makes it much faster to edit and polish many aspects of the game.

In the end of the code I added some lines named (texture)(/texture), for each particle created the particle will choose a texture by random of the once named in the xml file to create more variety.

This brings me to the particle texture folder:

[Image: FolderParticleTextures.png]

Just add a texture into that folder and name it in the particle system file and it will use it. There is a limit of 256 different particle textures, if the number exceeds that the game will complain, but as many particle systems uses the same textures I hardly think that will be a issue atm, maybe I will have to expand it then, but for now it will have to do Smile

And a little screenshot of the result:

[Image: ParticleResult.png]
(This post was last modified: 20-04-2014 10:00 AM by Sebt.)
09-03-2014 12:35 AM
Find all posts by this user Quote this message in a reply
Seriously Unserious Offline
The Ninja Dinosaur

Posts: 1.607
Joined: Jun 2013
Reputation: 69
Post: #2
RE: Particle moding
Awesome work Ras, you're a programming fiend.

+1
[Image: 11619898803_7d3a89e6bd_n.jpg]
The Golden One!
09-03-2014 12:42 AM
Find all posts by this user Quote this message in a reply
Sebt Offline
The Evil Admin
Evil Admins

Posts: 1.567
Joined: Aug 2013
Reputation: 98
Post: #3
RE: Particle moding
The power! Big Grin
I support The Venus Project & Resource-Based Economy - The feasible plan to get rid of scarcity, poverty, and other incoming global issues.
09-03-2014 09:07 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Rasmus Offline
Main developer of Dwelvers
Dwelvers Developers

Posts: 3.619
Joined: Sep 2013
Reputation: 502
Post: #4
RE: Particle moding
This has made my work sooo much easier, for those of you that knows programming probably knows the satisfaction one gets by throwing out useless code Big Grin
10-03-2014 12:00 AM
Find all posts by this user Quote this message in a reply
Seriously Unserious Offline
The Ninja Dinosaur

Posts: 1.607
Joined: Jun 2013
Reputation: 69
Post: #5
RE: Particle moding
Ooohhh hell Yeah! [Image: action-smiley-035.gif]
[Image: 11619898803_7d3a89e6bd_n.jpg]
The Golden One!
10-03-2014 12:34 AM
Find all posts by this user Quote this message in a reply
Mello Tonin Offline
Guru O' Mello

Posts: 2.216
Joined: Aug 2013
Reputation: 176
Post: #6
RE: Particle moding
Yeah, nothing like taking someone's web page full of TDs ad TRs and smackin em with some DIVs. I just started looking into some tutorials on C++ as I'm seeing I really need to start learning app development a bit more and stop relying on others for my dev needs here in the office.

Anyways another good addition to Dwelvers Rasman! Get that guy a beer!
10-03-2014 10:00 PM
Find all posts by this user Quote this message in a reply
Rasmus Offline
Main developer of Dwelvers
Dwelvers Developers

Posts: 3.619
Joined: Sep 2013
Reputation: 502
Post: #7
RE: Particle moding
Ahh sounds really fun, feel free to ask questions about c++ or if you want to discuss something, I love talking programming Tongue
10-03-2014 11:49 PM
Find all posts by this user Quote this message in a reply
Seriously Unserious Offline
The Ninja Dinosaur

Posts: 1.607
Joined: Jun 2013
Reputation: 69
Post: #8
RE: Particle moding
Mellow Tonin Wrote:Get that guy a beer!
Here you are Ras. Smile
[Image: kokanee-7.jpg]

EDIT: Here's a little math for you:
[Image: mi20060810a_pitfiend.jpg] + [Image: computer.jpg] = Rasmus.

Tongue
[Image: 11619898803_7d3a89e6bd_n.jpg]
The Golden One!
(This post was last modified: 14-03-2014 04:28 AM by Seriously Unserious.)
14-03-2014 04:24 AM
Find all posts by this user Quote this message in a reply
Club Sandbox Offline
Belgian Game Vlogger

Posts: 83
Joined: May 2014
Reputation: 12
Post: #9
RE: Particle modding
Nice, can make particule so i see a lot of traps comming !
Maybe some new spell xD ?
~ French Fan site Community, manager.
[Image: 195677userbarfactoriofofoxav.png]
~ Looking for Sandbox games ? look my Blog or youtube (Eng sub soon)
[Image: 176032userbarclubsandboxxavfofo.png]
20-05-2014 05:22 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Rasmus Offline
Main developer of Dwelvers
Dwelvers Developers

Posts: 3.619
Joined: Sep 2013
Reputation: 502
Post: #10
RE: Particle modding
(20-05-2014 05:22 PM)Club Sandbox Wrote:  Nice, can make particule so i see a lot of traps comming !
Maybe some new spell xD ?

The particles is just a visual add-on that other game-objects can link too. To make a creature spell you can make a new item, connect a particle effect to it, define this item as a projectile and let creatures use this item as a ranged attack.

When a item get defined as a projectile you can add particle effects to its launch, while it is in the air, and when it hits a enemy, then add data to what will happen to that enemy when it is hit by the projectile.
21-05-2014 04:17 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)


© 2013-2017 Dwelvers | Contact