[IDE] Particle Engine

All Helbreath Server Source Discussion here.
Post Reply
Orkl
Loyal fan
Posts: 376
Joined: Sat Sep 17, 2005 2:31 pm

Post by Orkl »

Ok so i'm developing a particle engine for Helbreath, but I need to convert the engine to DX7/8 to make it look nice :) This will open up the door to limitless in-game effects... Such as new glowing weapons, new spells, new armors, new terrain features, etc.

This is going to take me a little while to do, and will be quite a bit of work.. So I need a few coders who have experience in coding with DirectX in C++ (preferably DX8), that are willing to help me with this small project. Once i'm done i'll release full source on the forum for everyone... But note - it wont be a thing that any nub can do, you'll have to have some sort of brain to implement it properly.

Anyone interested can send me a PM and i'll get back to you.
<!--QuoteBegin-crazymnig88+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (crazymnig88)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->by notepad??? it didn't show any code, just show words wif no mean<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br><!--QuoteBegin-charlie+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (charlie)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->he'll probably save it as 600pagebook.bmp<br><br>400gb file plzkthnx<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd-->
Orkl
Loyal fan
Posts: 376
Joined: Sat Sep 17, 2005 2:31 pm

Post by Orkl »

KK fuck you all, I'll do it myself.. No released source now :(
<!--QuoteBegin-crazymnig88+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (crazymnig88)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->by notepad??? it didn't show any code, just show words wif no mean<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br><!--QuoteBegin-charlie+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (charlie)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->he'll probably save it as 600pagebook.bmp<br><br>400gb file plzkthnx<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd-->
juggalo2
Spamtastic
Posts: 1144
Joined: Sun Jul 17, 2005 5:28 pm

Post by juggalo2 »

i would give it a shot but im to bissy with work so i cant realy help working from 5am till 8 pm
<img src='http://lifeplaysu420.com/unknow/nightsign.png' border='0' alt='user posted image' /><br>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>Wanna make money for surfing the net sing up at <br><a href='http://www.cashfiesta.com/php/join.php? ... yprivitera' target='_blank'>cash fiesta</a><br>its all free hey why ntot make money while fucking around on the computer<br><br><br>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drajwer
&lt;3 bd long time
Posts: 841
Joined: Fri Dec 10, 2004 3:24 pm

Post by Drajwer »

if you really can do it then you should work for <a href='http://www.helbreath.org' target='_blank'>hbpl</a> (~300ppl online)
<img src='http://img440.imageshack.us/img440/2627/15pt.jpg' border='0' alt='user posted image' /><br><br>HBPolska characters:<br><br>Hellios 150+ Aresden Hero Mage<br>TheBill 120 Aresden plrider<br>Kill_Me 100 Full-Hero plrider<br>Rockeater 110+ Aresden Plate Mage<br><br><a href='http://www.helbreath.org' target='_blank'>http://www.helbreath.org</a> come and play (250 ppl online)
Orkl
Loyal fan
Posts: 376
Joined: Sat Sep 17, 2005 2:31 pm

Post by Orkl »

I dont speak polish in the slightest...
<!--QuoteBegin-crazymnig88+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (crazymnig88)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->by notepad??? it didn't show any code, just show words wif no mean<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br><!--QuoteBegin-charlie+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (charlie)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->he'll probably save it as 600pagebook.bmp<br><br>400gb file plzkthnx<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd-->
Sprint
Spamtastic
Posts: 1000
Joined: Tue Jun 06, 2006 6:59 am
Location: Far from home
Contact:

Post by Sprint »

Orkl wrote: I dont speak polish in the slightest...
lol...
I think that they are able to speak English too :D
<span style='color:blue'><span style='font-size:19pt;line-height:100%'><u><b>FUCK Helbreath!</b></u></span></span><br><br><span style='color:gray'><a href='http://www2.analystica.com/users/anttu/online/ngd' target='_blank'>ngdnetwork</a> OFFICIAL WEBSITE OF Northern Game Developers. Do visit! (THEY ARE UP!)<br><a href='http://project3d.x.am' target='_blank'>Project3d development forum</a> plz join and discuss,develop,give ideas,feedback. Anything goes as long it helps the project!</span><br><br>Zepto Znote 6625WD: 1.8Ghz dual core, 2GB, 512mb graphics card(dedicated), 160GB HDD<br><img src='http://www.signaturebar.com/uploads/images/10111.jpg' border='0' alt='user posted image' /><br><img src='http://www.signaturebar.com/uploads/images/13229.jpg' border='0' alt='user posted image' /><br><img src='http://www.signaturebar.com/uploads/images/8852.png' border='0' alt='user posted image' />
Orkl
Loyal fan
Posts: 376
Joined: Sat Sep 17, 2005 2:31 pm

Post by Orkl »

I'm not sure whether I should convert the entire Helbreath graphics engine to DX8 (lots of fucking work). Or whether I should just hook a DLL for my particle engine.. Any thoughts? :)
<!--QuoteBegin-crazymnig88+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (crazymnig88)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->by notepad??? it didn't show any code, just show words wif no mean<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br><!--QuoteBegin-charlie+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (charlie)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->he'll probably save it as 600pagebook.bmp<br><br>400gb file plzkthnx<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd-->
xenx
Member
Posts: 169
Joined: Tue Oct 03, 2006 7:08 am

Post by xenx »

if you could get spells, and possibly even maps working like that, it would prolly improve performance no end,
and pave the way for better graphics all round.
*edit* ooh ooh and NPC's */edit*
Sprint
Spamtastic
Posts: 1000
Joined: Tue Jun 06, 2006 6:59 am
Location: Far from home
Contact:

Post by Sprint »

aggh I think i forgot to read the whole topic :rolleyes:

Orkl, if you can make this one out, release a src with a missing .h file just so that every n00b wont get their fingers on it :rolleyes:
But this is a fking great idea, If you get it work ill maby test hb again :) .

If I could code a bit better, I would certainly join :) .

Good luck
<span style='color:blue'><span style='font-size:19pt;line-height:100%'><u><b>FUCK Helbreath!</b></u></span></span><br><br><span style='color:gray'><a href='http://www2.analystica.com/users/anttu/online/ngd' target='_blank'>ngdnetwork</a> OFFICIAL WEBSITE OF Northern Game Developers. Do visit! (THEY ARE UP!)<br><a href='http://project3d.x.am' target='_blank'>Project3d development forum</a> plz join and discuss,develop,give ideas,feedback. Anything goes as long it helps the project!</span><br><br>Zepto Znote 6625WD: 1.8Ghz dual core, 2GB, 512mb graphics card(dedicated), 160GB HDD<br><img src='http://www.signaturebar.com/uploads/images/10111.jpg' border='0' alt='user posted image' /><br><img src='http://www.signaturebar.com/uploads/images/13229.jpg' border='0' alt='user posted image' /><br><img src='http://www.signaturebar.com/uploads/images/8852.png' border='0' alt='user posted image' />
Kiruku
Loyal fan
Posts: 268
Joined: Wed Feb 22, 2006 12:00 pm
Contact:

Post by Kiruku »

yea if u release make any .h missing but not Game.h i dont want to code days for get the source :S
<img src='http://lichtdrache.lima-city.de/helbrea ... aramba.gif' border='0' alt='user posted image' />
xenx
Member
Posts: 169
Joined: Tue Oct 03, 2006 7:08 am

Post by xenx »

or u could just not be lame and release the whole thing, this is outpost after all not some "iv got more files than u" forum
Orkl
Loyal fan
Posts: 376
Joined: Sat Sep 17, 2005 2:31 pm

Post by Orkl »

Particle Engines are a very simple concept, but can be very, very complex. It'll take me a while, i'll release it... But not every noob will be able to implement it... People have trouble with implementing a few lines of code, let alone an entire new graphics engine.. :D
<!--QuoteBegin-crazymnig88+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (crazymnig88)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->by notepad??? it didn't show any code, just show words wif no mean<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br><!--QuoteBegin-charlie+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (charlie)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->he'll probably save it as 600pagebook.bmp<br><br>400gb file plzkthnx<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd-->
Sprint
Spamtastic
Posts: 1000
Joined: Tue Jun 06, 2006 6:59 am
Location: Far from home
Contact:

Post by Sprint »

So have you made up your mind, dll or new engine?

PS check your PMs Orkl
<span style='color:blue'><span style='font-size:19pt;line-height:100%'><u><b>FUCK Helbreath!</b></u></span></span><br><br><span style='color:gray'><a href='http://www2.analystica.com/users/anttu/online/ngd' target='_blank'>ngdnetwork</a> OFFICIAL WEBSITE OF Northern Game Developers. Do visit! (THEY ARE UP!)<br><a href='http://project3d.x.am' target='_blank'>Project3d development forum</a> plz join and discuss,develop,give ideas,feedback. Anything goes as long it helps the project!</span><br><br>Zepto Znote 6625WD: 1.8Ghz dual core, 2GB, 512mb graphics card(dedicated), 160GB HDD<br><img src='http://www.signaturebar.com/uploads/images/10111.jpg' border='0' alt='user posted image' /><br><img src='http://www.signaturebar.com/uploads/images/13229.jpg' border='0' alt='user posted image' /><br><img src='http://www.signaturebar.com/uploads/images/8852.png' border='0' alt='user posted image' />
ADDKiD
&lt;3 bd long time
Posts: 967
Joined: Tue Jul 12, 2005 8:07 pm
Location: Washington, USA
Contact:

Post by ADDKiD »

Orkl wrote: I'm not sure whether I should convert the entire Helbreath graphics engine to DX8 (lots of fucking work). Or whether I should just hook a DLL for my particle engine.. Any thoughts? :)
That would work.. There was actually something Intelligent I was going to say.. x.x Erm.. Why not Release to those who would know how to use it without a fucking tutorial.. x.x Seriously Orkl.. Gotta quit being so nice..
Orkl
Loyal fan
Posts: 376
Joined: Sat Sep 17, 2005 2:31 pm

Post by Orkl »

Ok so i've decided to use DirectX7 and use textures as the particle features. Basically because DX8 is a pain in the ass and I don't like doing hybrid engines unless I really have to.

If you're too retarded to read instructions, dont try this... Code is commented well enough so that if you have some sort of maths and physics knowledge you should be able to understand.

This is unfinished and is just getting us started. I will edit the post and add more later :)

YOU WILL NEED THE FOLLOWING:

Code: Select all

-DirectX7 SDK
-C++ 6.0
-A Brain
WILL BE EASIER FOR YOU IF YOU HAVE EXPERIENCE IN:

Code: Select all

-Graphics Programming
-Strong knowledge of physics
-Strong knowledge of mathematics
------------------

I suggest starting this in a new project, until we implement it into the Helbreath engine itself.

So first we need to create some new files, isn't that fun ? :)

CREATE::

Code: Select all

Particle.h
Particle.cpp
ParticleSystem.h
ParticleSystem.cpp
So lets start off with our header files

IN Particle.h::

Code: Select all

//--------------------------------------------------------------------------
//
//  File:       Particle.h
//
//  Contents:   Declaration of Particle
//
//	To do:  N/A at this time
//
//	Note:  This isn't a good example of a Class
//    I chose not to use access routines - feel free to use them if you really want to.
//    Particle system has full access to particle.
//      
//      Created By:   Orkl
//---------------------------------------------------------------------------

#ifndef __PARTICLE_H_
#define __PARTICLE_H_

#pragma once

#include "D3DTypes.h" //D3D required file

friend class ParticleSystem; //Its my friend ^^


class Particle
{
	
public:

	//Constructor, Destructor
	Particle();
	~Particle();

	//Time-Based movement
	bool Update( float fTimeDelta );
	
	// Last particle location
	D3DVECTOR  m_d3dvPrevLocation;
	
	// Current particle location
	D3DVECTOR  m_d3dvLocation;

	// Current particle velocity (yes, particles use physics!)
	D3DVECTOR  m_d3dvVelocity;

	// Colour, and colour over time
	D3DCOLORVALUE	m_d3dcColor;
	D3DCOLORVALUE	m_d3dcColorDelta;

	// Particles age (seconds) [Particles have an age, defines when to make the particle "Dissapear" (see next)
	float  m_fAge;
	
	// Lifetime (see above)
	float  m_fLifetime;
	
	// Particles size, and size over time (we can make it grow, or shrink)
	float  m_fSize;
	float  m_fSizeDelta;

	// Transparency and over time
	// 0.0f alpha = transparent
	float  m_fAlpha;
	float  m_fAlphaDelta;

	// gravity, and over time
	// this is proportional to normal gravity and can be a negative value (ie. it floats away)
	float  m_fGravity;
	float  m_fGravityDelta;
	
	// ParticleSystem = Parent of Particle
	void  SetParent(ParticleSystem* Parent){ m_pParent = Parent;}

private:
	// our parent <3
	ParticleSystem* m_pParent;
	

};

#endif
Simple enough, right?

IN ParticleSystem.h::

Code: Select all

//--------------------------------------------------------------------------
//
//  File:       ParticleSystem.h
//
//  Contents:   Declaration of ParticleSystem
//
//	To do:  N/A at this time
//
//	Note:  This isn't a good example of a Class
//    I chose not to use access routines - feel free to use them if you really want to.
//    MyD3DApplication had full access to ParticleSystem
//      
//      Created By:   Orkl
//---------------------------------------------------------------------------

#ifndef __PARTICLESYSTEM_H_
#define __PARTICLESYSTEM_H_

#pragma once

//we need these, so dont fuck them up
#include <windows.h>
#include "D3DApp.h"
#include "D3DMath.h"
#include "D3DTextr.h"
#include "D3DUtil.h"

#include "Particle.h" //Include our particle header ^^'

// return a float in the range 0.0f - 1.0f
#define RANDOM_NUM      (((FLOAT)rand()-(FLOAT)rand())/RAND_MAX)

// return a vector. x,y,z are between 0.0f and 1.0f (not a normalised vector)
#define RANDOM_VECTOR   D3DVECTOR(RANDOM_NUM,RANDOM_NUM,RANDOM_NUM)

// max number of particles (dont fuck with this too much)
#define MAX_PARTICLES	10000 

// some definitions!
#define MIN_SPEED  0.0f	// world units / sec
#define MIN_LIFETIME	0.1f	// seconds
#define MIN_SPREAD  0.01f	// degrees
#define MIN_EMISSION	1.0f	// particles / sec
#define MIN_SIZE  0.5f	// world units
#define MIN_GRAVITY  -5.0f	// multiple of normal gravity 
#define MIN_ALPHA  0.0f	// ratio 

#define MAX_SPEED  250.0f	// world units / sec
#define MAX_LIFETIME	10.0f	// seconds
#define MAX_SPREAD  180.0f	// degrees
#define MAX_EMISSION    1000.0f	// particles / sec
#define MAX_SIZE  10.0f	// world units
#define MAX_GRAVITY  5.0f	// multiple of normal gravity 
#define MAX_ALPHA  1.0f	// ratio 

#define MAX_TEXTURES  	5  //Dont fuck with it unless you add more textures

// add new presets = change this number
#define MAX_PRESETS    9
//---

// guarantee that values are within a given range
#define Clamp(x, min, max)  x = (x<min  ? min : x<max ? x : max);

// class
class ParticleSystem
{
	// give access to private members of particlesystem
	friend class MyD3DApplication;

public:
    ParticleSystem(); //constructor
   ~ParticleSystem(); //destructor

	// Update particles and system with timedelta
	bool  Update(float fTimeDelta);
	// render
	void  Draw(LPDIRECT3DDEVICE7 lpd3dDevice);
	// Not used, but can be used to move the particle system (defined it because it could be useful later)
	void  Move(D3DVECTOR vLocation);

	// this is bad.. Normally you would access routines to change the data
	void  ChangeParams(const BYTE Keys[]);
	
	// is system moving, colliding, or attracting?
	bool  IsMoving();
	bool  IsColliding();
	bool  IsAttractive();

	// find where system is in world space
	void   GetLocation(D3DVECTOR& vLocation);
	// number of active particles
	unsigned int NumParticles();
	// Load current texture into D3D
	HRESULT   LoadCurrentTexture(LPDIRECT3DDEVICE7 lpd3dDevice);

private:
	// pointer main app, incase reference is needed
	void*	m_pApplication;

	// texture ID so we know which one is being used
	unsigned int	m_uTextureID;

	// particles per second to emit
	unsigned int	m_uParticlesPerSec;

	// stores what particles are currently active
	unsigned int	m_uParticlesAlive;

	// last known location of system, used for interpolation
	D3DVECTOR  m_d3dvPrevLocation;
	// current location of system
	D3DVECTOR  m_d3dvLocation;
	// current velocity as a vector
	D3DVECTOR  m_d3dvVelocity;
	// current system direction.  particles emit using vector and a variant
	D3DVECTOR  m_d3dvDirection;

	// as particles age, we keep interpolating between start and end parameters
	// var parameter is used to keep things a little random
	// we change particle parameters over time to create various different effects, from explosions, to "wind" effects.

	// percentage of normal gravity. gravity could be made as a vector to show gravity pushing in a different direction (wind effect)
	float m_fGravityStart;
	float m_fGravityVar;
	float m_fGravityEnd;

	// particle size (world units)
	float m_fSizeStart;
	float m_fSizeVar;
	float m_fSizeEnd;

	// transparency of particles. Alpha 0 = invisible, Alpha 1 = full visibility
	float m_fAlphaStart;
	float m_fAlphaVar;
	float m_fAlphaEnd;

	// colour, start and finish
	// colour is interpolated between the two values over time
	D3DCOLORVALUE	m_d3dcColorStart;
	D3DCOLORVALUE	m_d3dcColorVar;
	D3DCOLORVALUE	m_d3dcColorEnd;

	// scalar speed is combined with normalised diection vector of system to get a velocity vector
	float m_fSpeed;
	float m_fSpeedVar;

	// particle life (seconds)
	float m_fLife;
	float m_fLifeVar;

	// randomness of particles in directional vector
	float m_fTheta;

	// is system moving autonomously?
	bool m_bIsMoving;
	// are particles attracted to system?
	bool m_bIsAttractive;

	// can particles be emitted? or will they build up?
	bool m_bIsSuppressed;

	// are particles colliding with ground?
	bool m_bIsColliding;

	// age of system (seconds)
	float m_fAge;
	
	// last time system was updated
	float m_fTimeLastUpdate;

	// value that allows precise amounts of particles to be emitted.
	// example: if we wanted 0.5 particles/sec to be emitted, it cant be done because 0.5 particle != full particle
	// therefore we remember what wanted to be emitted and add that to the next emission value
	// This can be used to create some cool effects, for example, water that is very slowly leaking.. The particle mass will become bigger and bigger until there is enough for it to "Drip"
	float m_fEmissionResidue;

	// fixed particle array
	CParticle	m_rParticles[MAX_PARTICLES];

    // Geometry
	// 4 quad vertices. D3DLVertices means we handle lighting (custom lighting = better effects :D)
	D3DLVERTEX   m_Mesh[4];

};

#endif
So there are our header files, now we just need to implement them. But that will do for now.. Will write more later

-Orkl
<!--QuoteBegin-crazymnig88+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (crazymnig88)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->by notepad??? it didn't show any code, just show words wif no mean<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br><!--QuoteBegin-charlie+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (charlie)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->he'll probably save it as 600pagebook.bmp<br><br>400gb file plzkthnx<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd-->
Post Reply