Flame Painter Dev Thread

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

User avatar
k1net1k
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 563
Joined: Sun Nov 07, 2010 2:58 pm
Contact:

Re: Flame Painter Dev Thread

Post by k1net1k »

dude thats fucking awesome :)
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: Flame Painter Dev Thread

Post 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
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
pritam
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 991
Joined: Thu Nov 13, 2008 3:16 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Amiga, PSOne, NDS
Programming Language of Choice: C++
Location: Sweden

Re: Flame Painter Dev Thread

Post 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 :)
User avatar
xiphirx
Chaos Rift Junior
Chaos Rift Junior
Posts: 324
Joined: Mon Mar 22, 2010 3:15 pm
Current Project: ******** (Unkown for the time being)
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Contact:

Re: Flame Painter Dev Thread

Post 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

;)
StarCraft II Zerg Strategy, open to all levels of players!

Looking for paid work :< Contact me if you are interested in creating a website, need a web design, or anything else you think I'm capable of :)
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: Flame Painter Dev Thread

Post 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;	
}
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
User avatar
xiphirx
Chaos Rift Junior
Chaos Rift Junior
Posts: 324
Joined: Mon Mar 22, 2010 3:15 pm
Current Project: ******** (Unkown for the time being)
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Contact:

Re: Flame Painter Dev Thread

Post by xiphirx »

Thanks for that.

I'm currently trying to fix my delta timing stuff... timestep is messing up when you fullscreen it :/
StarCraft II Zerg Strategy, open to all levels of players!

Looking for paid work :< Contact me if you are interested in creating a website, need a web design, or anything else you think I'm capable of :)
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Flame Painter Dev Thread

Post by dandymcgee »

Out of curiosity, where in the world did you come up with that code, avansc?
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: Flame Painter Dev Thread

Post 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
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
User avatar
xiphirx
Chaos Rift Junior
Chaos Rift Junior
Posts: 324
Joined: Mon Mar 22, 2010 3:15 pm
Current Project: ******** (Unkown for the time being)
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Contact:

Re: Flame Painter Dev Thread

Post 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?
StarCraft II Zerg Strategy, open to all levels of players!

Looking for paid work :< Contact me if you are interested in creating a website, need a web design, or anything else you think I'm capable of :)
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: Flame Painter Dev Thread

Post 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));
	}
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
User avatar
eatcomics
ES Beta Backer
ES Beta Backer
Posts: 2528
Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois

Re: Question about Math and Algorithm

Post by eatcomics »

dandymcgee wrote:That would make an awesome screensaver.
That's exactly what I did, and its a bad ass one :D
Image
User avatar
GroundUpEngine
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 835
Joined: Sun Nov 08, 2009 2:01 pm
Current Project: mixture
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Location: UK

Re: Question about Math and Algorithm

Post by GroundUpEngine »

This looks awesome!
dandymcgee wrote:That would make an awesome screensaver.
Agreed!
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Flame Painter Dev Thread

Post by Falco Girgis »

This thread is win. Avansc is a bamf!
User avatar
MrDeathNote
ES Beta Backer
ES Beta Backer
Posts: 594
Joined: Sun Oct 11, 2009 9:57 am
Current Project: cocos2d-x project
Favorite Gaming Platforms: SNES, Sega Megadrive, XBox 360
Programming Language of Choice: C/++
Location: Belfast, Ireland
Contact:

Re: Flame Painter Dev Thread

Post 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 :)
http://www.youtube.com/user/MrDeathNote1988

Image
Image

"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: Flame Painter Dev Thread

Post 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.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
Post Reply