Page 3 of 6

Re: Flame Painter Dev Thread

Posted: Thu Jan 06, 2011 5:24 pm
by k1net1k
dude thats fucking awesome :)

Re: Flame Painter Dev Thread

Posted: Fri Jan 07, 2011 8:55 am
by avansc
My attempt, i have a few parameters like noise, focus, force, and size, kinda tried to just emulate the applet thing.

If anyone is interested I'll chuck the source out there.

Image

Re: Flame Painter Dev Thread

Posted: Fri Jan 07, 2011 10:59 am
by pritam
avansc wrote:My attempt, i have a few parameters like noise, focus, force, and size, kinda tried to just emulate the applet thing.

If anyone is interested I'll chuck the source out there.

Image
Nice, and please do :)

Re: Flame Painter Dev Thread

Posted: Fri Jan 07, 2011 11:16 am
by xiphirx
avansc wrote:My attempt, i have a few parameters like noise, focus, force, and size, kinda tried to just emulate the applet thing.

If anyone is interested I'll chuck the source out there.

Image
Since I sorta want to do this on my own... no D:

Just shows my shitty physics skills since you got way better results in one build :P

;)

Re: Flame Painter Dev Thread

Posted: Fri Jan 07, 2011 2:13 pm
by avansc
xiphirx wrote:
Since I sorta want to do this on my own... no D:

Just shows my shitty physics skills since you got way better results in one build :P

;)
I'll just put the zip up.

I use almost no physics on this one, this is literally the only physics, and that just describes the motion of a independent particle.

Code: Select all

void Painter::update(const float dt)
{
	this->vel.x += this->accel.x * dt;
	this->vel.y += this->accel.y * dt;
	
	this->pos.x += this->vel.x*dt + (this->accel.x*dt*dt)/2; 
	this->pos.y += this->vel.y*dt + (this->accel.y*dt*dt)/2; 
	
	this->accel.x = 0;
	this->accel.y = 0;
	
	this->vel.x *= 0.999;
	this->vel.y *= 0.999;	
}

Re: Flame Painter Dev Thread

Posted: Fri Jan 07, 2011 3:45 pm
by xiphirx
Thanks for that.

I'm currently trying to fix my delta timing stuff... timestep is messing up when you fullscreen it :/

Re: Flame Painter Dev Thread

Posted: Fri Jan 07, 2011 5:20 pm
by dandymcgee
Out of curiosity, where in the world did you come up with that code, avansc?

Re: Flame Painter Dev Thread

Posted: Fri Jan 07, 2011 5:59 pm
by avansc
dandymcgee wrote:Out of curiosity, where in the world did you come up with that code, avansc?
These are all just kinematic motion equations.

okay lets take a look


the first bit is the velocity equation, accel here really is just a force acting on the particle.

this->vel.x += this->accel.x * dt;
this->vel.y += this->accel.y * dt;

Velocity_final = Velocity_initial + acceleration * delta_time // acceleration pertime gives velocity

now that we have out current velocity we can use the displacement equation. i just used this one, but there are many, V = D/T and so on.

this->pos.x += this->vel.x*dt + (this->accel.x*dt*dt)/2;
this->pos.y += this->vel.y*dt + (this->accel.y*dt*dt)/2;


I reset the "force"

this->accel.x = 0;
this->accel.y = 0;

This part just dampens there velocity, a kind of friction if you will.

this->vel.x *= 0.999;
this->vel.y *= 0.999;
}

http://en.wikipedia.org/wiki/Kinematics

Re: Flame Painter Dev Thread

Posted: Fri Jan 07, 2011 8:46 pm
by xiphirx
Hmm... So I tried to put what you had in your update function avansc, but I get pretty bad results... How do you calculate the acceleration?

Re: Flame Painter Dev Thread

Posted: Sat Jan 08, 2011 3:26 pm
by avansc
being bored.
http://img443.imageshack.us/img443/1778 ... 8at422.png

something like that.

Code: Select all

for(int a = 0;a < MAX;a++)
	{
		cVec2 t = cVec2(tx,ty);
		t -= it[a]->pos;
		
		//t.normalize();
		
		/*
		 FORCE = general attraction force : 0.3f
		 FOCUS = total spread	: 1.0f
		 SPRING = force that keeps ajacent particles together : 10.0f
		 */
		float f = ((a+1)/(float)MAX)/FORCE*(FOCUS - ((a+1)/((float)MAX+SPRING)));
		
		t*=f;
		
		//apply accel
		it[a]->accel.setX(t.getX());
		it[a]->accel.setY(t.getY());
		
		//some noise
		it[a]->vel.x += (NOISE*(rand()%1000/999.0f-0.5f));
		it[a]->vel.y += (NOISE*(rand()%1000/999.0f-0.5f));
	}

Re: Question about Math and Algorithm

Posted: Sat Jan 08, 2011 3:45 pm
by eatcomics
dandymcgee wrote:That would make an awesome screensaver.
That's exactly what I did, and its a bad ass one :D

Re: Question about Math and Algorithm

Posted: Sun Jan 09, 2011 11:17 am
by GroundUpEngine
This looks awesome!
dandymcgee wrote:That would make an awesome screensaver.
Agreed!

Re: Flame Painter Dev Thread

Posted: Mon Jan 10, 2011 1:45 am
by Falco Girgis
This thread is win. Avansc is a bamf!

Re: Flame Painter Dev Thread

Posted: Mon Jan 10, 2011 7:39 am
by MrDeathNote
avansc wrote: I'll just put the zip up.
Did you ever put this up, i'd definitely like to have a look at the source :)

Re: Flame Painter Dev Thread

Posted: Mon Jan 10, 2011 8:07 am
by avansc
MrDeathNote wrote:
avansc wrote: I'll just put the zip up.
Did you ever put this up, i'd definitely like to have a look at the source :)
I'll get on that, It's just very very messy atm. but i'll chuck something out there.