"A FPS Game" Online Game
Moderator: PC Supremacists
- LeonBlade
- Chaos Rift Demigod
- Posts: 1314
- Joined: Thu Jan 22, 2009 12:22 am
- Current Project: Trying to make my first engine in C++ using OGL
- Favorite Gaming Platforms: PS3
- Programming Language of Choice: C++
- Location: Blossvale, NY
Re: "A FPS Game" Online Game
I'm trying to take the difference of the distances between the X and Z of the two objects.
Then seeing if the distance is less than the radius.
But this doesn't always work, because sometimes the values are negative...
Then seeing if the distance is less than the radius.
But this doesn't always work, because sometimes the values are negative...
There's no place like ~/
- Ginto8
- ES Beta Backer
- Posts: 1064
- Joined: Tue Jan 06, 2009 4:12 pm
- Programming Language of Choice: C/C++, Java
Re: "A FPS Game" Online Game
Create an absolute value function, like this:LeonBlade wrote:But this doesn't always work, because sometimes the values are negative...
Code: Select all
int abs( int number )
{
if( number < 0 )
return -number;
return number;
}
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
- LeonBlade
- Chaos Rift Demigod
- Posts: 1314
- Joined: Thu Jan 22, 2009 12:22 am
- Current Project: Trying to make my first engine in C++ using OGL
- Favorite Gaming Platforms: PS3
- Programming Language of Choice: C++
- Location: Blossvale, NY
Re: "A FPS Game" Online Game
Wow... I can't believe I never thought of that haha.
It works too!!!
Thanks so much dude, your the best!
It works too!!!
Thanks so much dude, your the best!
There's no place like ~/
- Ginto8
- ES Beta Backer
- Posts: 1064
- Joined: Tue Jan 06, 2009 4:12 pm
- Programming Language of Choice: C/C++, Java
Re: "A FPS Game" Online Game
No problem, glad I could help.LeonBlade wrote:Wow... I can't believe I never thought of that haha.
It works too!!!
Thanks so much dude, your the best!
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
- LeonBlade
- Chaos Rift Demigod
- Posts: 1314
- Joined: Thu Jan 22, 2009 12:22 am
- Current Project: Trying to make my first engine in C++ using OGL
- Favorite Gaming Platforms: PS3
- Programming Language of Choice: C++
- Location: Blossvale, NY
Re: "A FPS Game" Online Game
I'm almost there...
So, what I'm doing is setting my Velocity to 0 when I encounter a collision.
Now what I'm doing is making it so you can only move in the set velocity if it's negative of it's current...
But that isn't working right... it was earlier...
So, what I'm doing is setting my Velocity to 0 when I encounter a collision.
Code: Select all
private void CheckCollisions()
{
for (int i = 0; i < objects.Length; i++)
{
float delta_x = abs(player.Center.X) - abs(objects[i].Center.X);
float delta_z = abs(player.Center.Z) - abs(objects[i].Center.Z);
float sum = (player.Sphere.Radius * objects[i].Sphere.Radius) * 2;
if (delta_x <= sum && delta_z <= sum)
{
if (player.Velocity.X != -player.Velocity.X)
{
hit_x = true;
}
else
{
hit_x = false;
}
if (player.Velocity.Z != -player.Velocity.Z)
{
hit_z = true;
}
else
{
hit_z = false;
}
}
}
}
But that isn't working right... it was earlier...
There's no place like ~/
- M_D_K
- 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: "A FPS Game" Online Game
You should really include Y axis checking in that.
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.
- LeonBlade
- Chaos Rift Demigod
- Posts: 1314
- Joined: Thu Jan 22, 2009 12:22 am
- Current Project: Trying to make my first engine in C++ using OGL
- Favorite Gaming Platforms: PS3
- Programming Language of Choice: C++
- Location: Blossvale, NY
Re: "A FPS Game" Online Game
Yeah I know, but I'm not doing Y collision just yet.
But that shouldn't effect it in the way that it does.
When you encounter an object, you stop on both X and Z axis, and then if you try to move away, it does nothing...
I'm stopping the update of the player's position, not the velocity, so you still should be able to adjust velocity and get (unstuck) but it's not working right...
But that shouldn't effect it in the way that it does.
When you encounter an object, you stop on both X and Z axis, and then if you try to move away, it does nothing...
I'm stopping the update of the player's position, not the velocity, so you still should be able to adjust velocity and get (unstuck) but it's not working right...
There's no place like ~/
- M_D_K
- 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: "A FPS Game" Online Game
But doesn't velocity update position?
And why did you have a variable called bleed in your update loop shouldn't you be multiplying by delta time(currentTime - lastTime).
And why did you have a variable called bleed in your update loop shouldn't you be multiplying by delta time(currentTime - lastTime).
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.
- LeonBlade
- Chaos Rift Demigod
- Posts: 1314
- Joined: Thu Jan 22, 2009 12:22 am
- Current Project: Trying to make my first engine in C++ using OGL
- Favorite Gaming Platforms: PS3
- Programming Language of Choice: C++
- Location: Blossvale, NY
Re: "A FPS Game" Online Game
Yes Velocity Updates Position... but you can still modify Velocity even when I lock the Position.
And I don't know how to get currentTime - lastTime so I just bleed off the velocity like that.
And I don't know how to get currentTime - lastTime so I just bleed off the velocity like that.
There's no place like ~/
- MarauderIIC
- Respected Programmer
- Posts: 3406
- Joined: Sat Jul 10, 2004 3:05 pm
- Location: Maryland, USA
Re: "A FPS Game" Online Game
<cmath> has abs() by the way, which is an absolute value fn.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
- LeonBlade
- Chaos Rift Demigod
- Posts: 1314
- Joined: Thu Jan 22, 2009 12:22 am
- Current Project: Trying to make my first engine in C++ using OGL
- Favorite Gaming Platforms: PS3
- Programming Language of Choice: C++
- Location: Blossvale, NY
Re: "A FPS Game" Online Game
M_D_K helped me out big time with some stuff!
So I'm getting there, thanks again M_D_K!
So I'm getting there, thanks again M_D_K!
There's no place like ~/
Re: "A FPS Game" Online Game
Are you going to implement guns?
Hyde from That 70's Show wrote:Woman are like muffins... Once you have a muffin you will do anything to have another muffin... And they know that.
- LeonBlade
- Chaos Rift Demigod
- Posts: 1314
- Joined: Thu Jan 22, 2009 12:22 am
- Current Project: Trying to make my first engine in C++ using OGL
- Favorite Gaming Platforms: PS3
- Programming Language of Choice: C++
- Location: Blossvale, NY
Re: "A FPS Game" Online Game
Lol yes... it would be pretty shitty FPS without guns don't you think? HahaAeolus wrote:Are you going to implement guns?
Right now still working on basic game mechanics...
There's no place like ~/
Re: "A FPS Game" Online Game
No i mean multi-guns.
Deagle, M-16, m-4, etc...
Deagle, M-16, m-4, etc...
Hyde from That 70's Show wrote:Woman are like muffins... Once you have a muffin you will do anything to have another muffin... And they know that.
- LeonBlade
- Chaos Rift Demigod
- Posts: 1314
- Joined: Thu Jan 22, 2009 12:22 am
- Current Project: Trying to make my first engine in C++ using OGL
- Favorite Gaming Platforms: PS3
- Programming Language of Choice: C++
- Location: Blossvale, NY
Re: "A FPS Game" Online Game
Oh... yeah probably, for now it will just be one gun though.
There's no place like ~/