phyzills update

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
M_D_K
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1087
Joined: Tue Oct 28, 2008 10:33 am
Favorite Gaming Platforms: PC
Programming Language of Choice: C/++
Location: UK

Re: phyzills update

Post by M_D_K »

avansc wrote:
M_D_K wrote:well I got forces working :)
s4.png
And dude XNA!?
There is a huge bug in it, that is if you use it when you walk down the street all you hear is Dancing Queen :)
hahaha, did you use your own force claculations or mine, mine is very primitive.
well if you dont use microsoft products you are just more manly anyways.
I used my own calculations.
What the pic doesn't show is that the particle stream becomes unstable after passing through the second force controller (I sound like a physicist at the LHC :) )
Gyro Sheen wrote:you pour their inventory onto my life
IRC wrote: <sparda> The routine had a stack overflow, sorry.
<sparda> Apparently the stack was full of shit.
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: phyzills update

Post by avansc »

M_D_K wrote:
avansc wrote:
M_D_K wrote:well I got forces working :)
s4.png
And dude XNA!?
There is a huge bug in it, that is if you use it when you walk down the street all you hear is Dancing Queen :)
hahaha, did you use your own force claculations or mine, mine is very primitive.
well if you dont use microsoft products you are just more manly anyways.
I used my own calculations.
What the pic doesn't show is that the particle stream becomes unstable after passing through the second force controller (I sound like a physicist at the LHC :) )
thats wither because your particle ammiter is emiting them to far apart. or not at the same speed. but i bet its the former.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
User avatar
M_D_K
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1087
Joined: Tue Oct 28, 2008 10:33 am
Favorite Gaming Platforms: PC
Programming Language of Choice: C/++
Location: UK

Re: phyzills update

Post by M_D_K »

nope all particles are emitted at the same speed. The controllers modify velocity so the longer a particle is in the controller the more the particles velocity is affected. So you are right-ish. But its no biggy just makes it more interesting :)
Gyro Sheen wrote:you pour their inventory onto my life
IRC wrote: <sparda> The routine had a stack overflow, sorry.
<sparda> Apparently the stack was full of shit.
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: phyzills update

Post by avansc »

M_D_K wrote:nope all particles are emitted at the same speed. The controllers modify velocity so the longer a particle is in the controller the more the particles velocity is affected. So you are right-ish. But its no biggy just makes it more interesting :)
actually i am completely right, i said i think its the former. which is that your particle spread is to much. thus the big delta in time spent in a force.

you could make particles adhear to each other, that would be a simple solution.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
User avatar
M_D_K
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1087
Joined: Tue Oct 28, 2008 10:33 am
Favorite Gaming Platforms: PC
Programming Language of Choice: C/++
Location: UK

Re: phyzills update

Post by M_D_K »

Ok your completly right o great one :bow:

I don't know if I want to make the particles adhere to each other cause right now there is this really cool fluidity going on.
It just looks cool :)
I also rewrote how my force controllers handle input. I gave them a manager which looks after all force controllers and updates them on position and radius based on input.
The way I was doing it before the mouse kept losing focus on the controller if you moved it too fast :)
Gyro Sheen wrote:you pour their inventory onto my life
IRC wrote: <sparda> The routine had a stack overflow, sorry.
<sparda> Apparently the stack was full of shit.
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: phyzills update

Post by avansc »

M_D_K wrote:Ok your completly right o great one :bow:

I don't know if I want to make the particles adhere to each other cause right now there is this really cool fluidity going on.
It just looks cool :)
I also rewrote how my force controllers handle input. I gave them a manager which looks after all force controllers and updates them on position and radius based on input.
The way I was doing it before the mouse kept losing focus on the controller if you moved it too fast :)
i wrote a InputHandler class that does all that for me. like if the mouse button clicks is sees what force its in, then if the mouse button stays down, the force xy will allways be updated with the mouse xy. then once the mouse button is release it looses focus. i also made it so that if the mouse moves over a force it changes color indicating that you can select it. and lastly i made a way with my right click to make the force bigger. you can no make the force bigger by just moving the mouse over the force perimiter, so then its the same with click and drag, exept that the force does not move but the radius does.

i also added 3 new forces an 2 area object

i added the attraction force.
i added a accelerate force, ie just make the particles go faster what ever way that are going.
i added a decelerate force.

and i added a teleport area. (its a two areas and if the particles hits one it teleports to the area)
and i added a charge-flip: if a particle goes through it the polarity changes and it does opposite of whatever the force is. (i think i might take this out, its really hard making a level where it actually works nice.)

im done with this project for now. i'm going to port it to pure OpenGL and use some shaders. and make a demo version available,
and if there is enough interest i'll keep activly developing it into a complete game with levels menus, and junk like that.

i was surprized how much fun i had doing this project, best 3 days i have spent in a long time.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
User avatar
M_D_K
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1087
Joined: Tue Oct 28, 2008 10:33 am
Favorite Gaming Platforms: PC
Programming Language of Choice: C/++
Location: UK

Re: phyzills update

Post by M_D_K »

avansc wrote:
M_D_K wrote:Ok your completly right o great one :bow:

I don't know if I want to make the particles adhere to each other cause right now there is this really cool fluidity going on.
It just looks cool :)
I also rewrote how my force controllers handle input. I gave them a manager which looks after all force controllers and updates them on position and radius based on input.
The way I was doing it before the mouse kept losing focus on the controller if you moved it too fast :)
i wrote a InputHandler class that does all that for me. like if the mouse button clicks is sees what force its in, then if the mouse button stays down, the force xy will allways be updated with the mouse xy. then once the mouse button is release it looses focus. i also made it so that if the mouse moves over a force it changes color indicating that you can select it. and lastly i made a way with my right click to make the force bigger. you can no make the force bigger by just moving the mouse over the force perimiter, so then its the same with click and drag, exept that the force does not move but the radius does.

i also added 3 new forces an 2 area object

i added the attraction force.
i added a accelerate force, ie just make the particles go faster what ever way that are going.
i added a decelerate force.

and i added a teleport area. (its a two areas and if the particles hits one it teleports to the area)
and i added a charge-flip: if a particle goes through it the polarity changes and it does opposite of whatever the force is. (i think i might take this out, its really hard making a level where it actually works nice.)

im done with this project for now. i'm going to port it to pure OpenGL and use some shaders. and make a demo version available,
and if there is enough interest i'll keep activly developing it into a complete game with levels menus, and junk like that.

i was surprized how much fun i had doing this project, best 3 days i have spent in a long time.
Totally agree with you on that! It's good to work on a shiny project every once and awhile.

I already had an input manager. Its just I hacked it into the force controllers directly so that made it suck :)
And I did the same thing with my right click :)

Well I'm nearly at your point in the dev. I've just gotta add the eye candy and finish my in-game level editor and the level class :)

I'll post some more pics and stuff tomorrow...gotta sleep right now :)

EDIT: Can't sleep so I'm going to keep coding YAY :)
Gyro Sheen wrote:you pour their inventory onto my life
IRC wrote: <sparda> The routine had a stack overflow, sorry.
<sparda> Apparently the stack was full of shit.
User avatar
M_D_K
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1087
Joined: Tue Oct 28, 2008 10:33 am
Favorite Gaming Platforms: PC
Programming Language of Choice: C/++
Location: UK

Re: phyzills update

Post by M_D_K »

So I've been working on the level and in-game editor stuff. I didn't get nearly as much done as I would have liked. And as a result can't show that stuff yet.

so instead here is me playing with the controllers and colors :)
s7.png
s7.png (65.45 KiB) Viewed 1366 times
Gyro Sheen wrote:you pour their inventory onto my life
IRC wrote: <sparda> The routine had a stack overflow, sorry.
<sparda> Apparently the stack was full of shit.
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: phyzills update

Post by avansc »

M_D_K wrote:So I've been working on the level and in-game editor stuff. I didn't get nearly as much done as I would have liked. And as a result can't show that stuff yet.

so instead here is me playing with the controllers and colors :)
s7.png

that really looks nice. i would suggest having some sort of indicater of what direction/type of force it is.

i have changed mine as follows.

my force is just a circle, but when the mouse moves over it, it displays an arrow in the direction of the force.
my colors also dont immediately change when entering a force, they fade to the new color, this makes it look much better.

those are the main differences. im also in the process of changing some of my structures for a better design ann making it more versatile.

could you post your code. i would like to look over it.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
User avatar
M_D_K
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1087
Joined: Tue Oct 28, 2008 10:33 am
Favorite Gaming Platforms: PC
Programming Language of Choice: C/++
Location: UK

Re: phyzills update

Post by M_D_K »

My code is a big mess of hacks right now. I'm cleaning it up. I'll post it later.
Also I'm in the process of adding some shiny stuff to the game and editor :)

Oh one thing I would like you to look over is this code that takes an angle(direction of emitter) and turns it into a vector(of sorts). See when you create the emitter you tell it the starting velocity on x and y for every particle it makes.

Code: Select all

Vector AngleToVector(double angle, int radius, int velocity)
{
	float x, y, x1, y1;
	x = sin(angle) * radius;
	y = cos(angle) * radius;
	float div;
	if(x < 0)
		x1 = -x;
	else if(x > 0)
		x1 = x;
	if(y < 0)
		y1 = -x;
	else if(y > 0)
		y1 = y;

	div = velocity / (x1 + y1);
	
	return Vector(div * x, div * y, 0);
};
It works and the reason it exists is so in the editor you can just rotate the emitter and then it does the rest.
so if you do AngleToVector(110, 30, 150) you'd get vector.x = 109.97307436162489446225 and vector.y = 40.02692563837510553775.
Gyro Sheen wrote:you pour their inventory onto my life
IRC wrote: <sparda> The routine had a stack overflow, sorry.
<sparda> Apparently the stack was full of shit.
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: phyzills update

Post by avansc »

M_D_K wrote:My code is a big mess of hacks right now. I'm cleaning it up. I'll post it later.
Also I'm in the process of adding some shiny stuff to the game and editor :)

Oh one thing I would like you to look over is this code that takes an angle(direction of emitter) and turns it into a vector(of sorts). See when you create the emitter you tell it the starting velocity on x and y for every particle it makes.

Code: Select all

Vector AngleToVector(double angle, int radius, int velocity)
{
	float x, y, x1, y1;
	x = sin(angle) * radius;
	y = cos(angle) * radius;
	float div;
	if(x < 0)
		x1 = -x;
	else if(x > 0)
		x1 = x;
	if(y < 0)
		y1 = -x;
	else if(y > 0)
		y1 = y;

	div = velocity / (x1 + y1);
	
	return Vector(div * x, div * y, 0);
};
It works and the reason it exists is so in the editor you can just rotate the emitter and then it does the rest.
so if you do AngleToVector(110, 30, 150) you'd get vector.x = 109.97307436162489446225 and vector.y = 40.02692563837510553775.

uummmm... i would do it a little differently.
also note that cos is related to the X, not Y.
X = cos(theta)*vel;
Y = sin(theta)*vel;

X, Y is just your 2 component form of vel

Y Vel
| /
| /
| /
|/___X

also you dont have to worry about checking for - values. sin and cos are smart enough to do that.

cos=0
sin=1
90
cos=-1 | cos=1
sin=0 | sin=0
180-------|------- 0/360
|
|
270
cos=0
sin = -1


Code: Select all

#define PI 3.14........

Vector AngleToVector(double angle, int velocity)
{
	return Vector( cos(angle/180*PI) * velocity, sin(angle/180*PI) * velocity, 0);
};
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: phyzills update

Post by avansc »

you might have to add or subrackt 90 from your angle dependign on how you formatted you cordinates system.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
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: phyzills update

Post by Falco Girgis »

Wow, you guys are doing some seriously great work on this. I'm thinking about downloading the source and at least having a look at it this weekend. It's looking great, gentlemen.
User avatar
M_D_K
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1087
Joined: Tue Oct 28, 2008 10:33 am
Favorite Gaming Platforms: PC
Programming Language of Choice: C/++
Location: UK

Re: phyzills update

Post by M_D_K »

If i have it:

Code: Select all

	x = cos(angle) * radius;
	y = sin(angle) * radius;
the result is backwards so I flipped it. What I'm doing is generating an emit direction from the angle thats why I pass the velocity to the function.
velocity is split proportionally to create a starting velocity for a particle

Code: Select all

//Emitter(int max_particles, double lifespan, Vector emit_position, Vector emit_direction)
//emit_direction: default velocity
Emitter *emitter = new Emitter(1000, 5, Vector(30,20,0), Vector(150, 0, 0));
that emit direction is 150 on x when you give 90 degrees, 45 degrees would be Vector(75, 75, 0)
When you create a new particle and you give a starting velocity your passing it emit_direction

particle movement:

Code: Select all

	//removed z axis from calc
	//reason not needed
	m_velocity.x += m_acceleration.x * dt;
	m_velocity.y += m_acceleration.y * dt;

	m_position.x += m_velocity.x * dt;
	m_position.y += m_velocity.y * dt;
Gyro Sheen wrote:you pour their inventory onto my life
IRC wrote: <sparda> The routine had a stack overflow, sorry.
<sparda> Apparently the stack was full of shit.
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: phyzills update

Post by avansc »

whe when do we get to see your code???
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
Post Reply