Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
MasterSlowPoke
Oct 9, 2005

Our courage will pull us through
You're rebuilding the rotation matrix from scratch, so any kind of lock would be avoided. The same input will always give the same output.

Adbot
ADBOT LOVES YOU

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!

Fecotourist posted:

If the axes are fixed, you get gimbal lock, don't you?
Yes, though ultimately you need to decide what camera system to use. The typical pitch/yaw type camera system is the one I've described, the one Strumpy's using is a "flight simulator" style system where you can roll the camera via just pitch/yaw because the yaw plane (i.e. the "horizon") will rotate as you pitch. Or more obviously, you can yaw by rolling, pitching upward, and then rolling back to level again.

If you want to use "flight sim" style controls and still try to stabilize towards the horizon level, then apply a bias roll to tilt the camera's side vector towards the horizon plane if the user isn't providing much or any input.

stramit
Dec 9, 2004
Ask me about making games instead of gains.

OneEightHundred posted:

Yes, though ultimately you need to decide what camera system to use. The typical pitch/yaw type camera system is the one I've described, the one Strumpy's using is a "flight simulator" style system where you can roll the camera via just pitch/yaw because the yaw plane (i.e. the "horizon") will rotate as you pitch. Or more obviously, you can yaw by rolling, pitching upward, and then rolling back to level again.

If you want to use "flight sim" style controls and still try to stabilize towards the horizon level, then apply a bias roll to tilt the camera's side vector towards the horizon plane if the user isn't providing much or any input.

Yea. My controller is designed for a space game so 'horizon' is quite arbitrary. Looking at it all I'm thinking that the unwanted roll is manageable. I've played with a few other things over the past few days (GPU perlin noise for my planet shader ect it's tres awesome). I'll get back to doing game code eventually, I always get distracted with tech!

quote:

Track the total rotation on each axis separately and apply them to a base value instead of the current rotation.
Won't this have issues when you do a complete 180 roll around the forward axis? Input will come out the 'wrong' way along some axis?

Thanks for the help OneEightHundred. I really dislike camera systems and have avoided them most of my professional career.

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!

Strumpy posted:

Yea. My controller is designed for a space game so 'horizon' is quite arbitrary. Looking at it all I'm thinking that the unwanted roll is manageable. I've played with a few other things over the past few days (GPU perlin noise for my planet shader ect it's tres awesome). I'll get back to doing game code eventually, I always get distracted with tech!
Well, if you're using free controls with no DOF restrictions, then either you care which way is "up", in which case you should probably try to gradually reorient the camera to undo roll, or you don't, in which case it's not really "unwanted."

quote:

Won't this have issues when you do a complete 180 roll around the forward axis? Input will come out the 'wrong' way along some axis?
You'd cap the pitch value at straight up or down. This would be FPS-style controls.

Morpheus
Apr 18, 2008

My favourite little monsters
Okay so on a whim I want to make a top-down, realtime, action RPG in XNA. Nothing fancy at all, just have a 2D guy sprite run around, swing a sword, kill a green guy sprite who might be an orc or something I am terrible at art.

So I got the movement and everything down fine, but then I realized that I have no idea what to do for attacking and such, since everything else I've programmed involved bullets and those are easy. Like, I don't even know what to do when the attack button is pressed.

Does the player go through an 'attack' animation that includes the sword he is holding? If so, I do I declare that -this- part of the animation (the swordy part) will damage the monster?

I assume there aren't any surefire answers for this, but does anyone have a tutorial to point me towards?

drat this visual media and all its kookiness.

Morpheus fucked around with this message at 04:30 on Mar 8, 2010

haveblue
Aug 15, 2005



Toilet Rascal

Morpheus posted:

Does the player go through an 'attack' animation that includes the sword he is holding? If so, I do I declare that -this- part of the animation (the swordy part) will damage the monster?

More or less. You'd have a keyframe which you decide is the moment the attack happens, and at that moment you'd determine which, if any, mob is under attack and deliver the damage.

A lot of games fake melee attacks by firing an invisible short-range projectile, if that helps.

Morpheus
Apr 18, 2008

My favourite little monsters

haveblue posted:

More or less. You'd have a keyframe which you decide is the moment the attack happens, and at that moment you'd determine which, if any, mob is under attack and deliver the damage.

A lot of games fake melee attacks by firing an invisible short-range projectile, if that helps.

Ah, makes sense, I was thinking something like that was the case (the keyframe). So I guess each Update, if the player/enemy is in the ATTACK state, then the class would check its animation, ask if the currentFrame = frameOfAttack, and if so, do the calculations and stuff then to see if any foes are in the attack 'area', huh? Or something like that...

Excellent, surprised I didn't realize that myself.

FreakyZoid
Nov 28, 2002

Crossposting from the making games megathread, but if any of you have premium Creators Club membership, I have a game in playtest at the moment, would appreciate some feedback. Cheers,

http://forums.xna.com/forums/p/49151/295291.aspx#295291

RizieN
May 15, 2004

and it was still hot.

Da Gaspodin posted:

I should probably post this here as well:

I started making a game with Processing yesterday as an experiment to what I could get done during a single weekend.
Well, Escapism is the result, and you can play it online at http://www.cs.uta.fi/~vp79799/escapism

It's a "combo-driven" jumpy-shootemup.



The MK-ULTRA mind fighting idea is loving sick. If you pushed that idea further with a bigger project I'd pay to play that poo poo. Might come from my background as a videogamer, and my college days as an acid head...but I think Its a kick rear end idea.

(side note/cross post, if anyone needs music or illustrations contact me, zach. spradlin@ gmail. com - my brother is a ridiculous musician and we both are pretty good illustrators, while my GF is a fantastic illustrator)

Hanpan
Dec 5, 2004

Does anyone have any recommendations for 2d physics with XNA? I think someone here recommended Farseer, but it doesn't seem to get updated very often. It's a shame that there is no direct implementation of Box2D :smith:

Scaevolus
Apr 16, 2007

Hanpan posted:

Does anyone have any recommendations for 2d physics with XNA? I think someone here recommended Farseer, but it doesn't seem to get updated very often. It's a shame that there is no direct implementation of Box2D :smith:

http://code.google.com/p/box2dx/ ?

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!

Hanpan posted:

Does anyone have any recommendations for 2d physics with XNA? I think someone here recommended Farseer, but it doesn't seem to get updated very often. It's a shame that there is no direct implementation of Box2D :smith:

Yeah, farseer isn't updated often, but it is a Box2D port in progress.

Trevor Gottitall
May 9, 2009
Grimey Drawer
XNAnimation is a real pain in the rear end.

Trevor Gottitall fucked around with this message at 02:00 on Feb 6, 2017

Hanpan
Dec 5, 2004


Awesome, I'll give this a go. For basic 2D platformer physics, do you think this might be a bit overkill?

Vinterstum
Jul 30, 2003

Hanpan posted:

Awesome, I'll give this a go. For basic 2D platformer physics, do you think this might be a bit overkill?

Not really. Box2D is simple to integrate, and scales down well (cheap for simple usage with few/simple objects and few contact points). The latter is pretty much true for all physics engines.

Edit: Well, that's true for the C++ version at least, but I'll assume the same holds true for the C# version.

Vinterstum fucked around with this message at 04:02 on Mar 15, 2010

ChadyG
Aug 2, 2004
egga what?

Hanpan posted:

Awesome, I'll give this a go. For basic 2D platformer physics, do you think this might be a bit overkill?

I recently wrote a little tutorial for platformer movement using box2D on my blog. Hopefully you can get some use out of it.

sd6
Jan 14, 2008

This has all been posted before, and it will all be posted again
I have a quick 3D question.

Using OpenGL and GLUT, I've created a window with a colored sphere in the middle using the glutSolidSphere function. The function by default draws the sphere at origin, but I want to know, how do I specify that I want the sphere to be drawn at another position?

Dransparency
Jul 19, 2006

Stavros posted:

I have a quick 3D question.

Using OpenGL and GLUT, I've created a window with a colored sphere in the middle using the glutSolidSphere function. The function by default draws the sphere at origin, but I want to know, how do I specify that I want the sphere to be drawn at another position?

You will want to use a transformation, in this case a translation. Use glTranslatef or something similar. Keep in mind that this modifies whichever matrix stack you have active, so you may want to wrap your calls in calls to glPushMatrix and glPopMatrix.

sd6
Jan 14, 2008

This has all been posted before, and it will all be posted again

Dransparency posted:

You will want to use a transformation, in this case a translation. Use glTranslatef or something similar. Keep in mind that this modifies whichever matrix stack you have active, so you may want to wrap your calls in calls to glPushMatrix and glPopMatrix.

Ok I'll try this, thank you.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!
I just spent a couple hours banging out a quick diamond-square generator to build heightmaps, and I'm pleasantly surprised at how well it works. I've gone ahead and written a quick box filter to smooth out the heightmap, which is a nice touch.

I've taken care of filtering out areas of all white/all black by preventing values greater than 1 or less than 0 for the height. I'd like to eventually use these terrains for a game like Tropico. Only, everything I'm reading online about XNA suggests that just building vertex/index buffers out of these heightmaps is an inefficient use of resources. (Obviously, rendering every heightmap every frame is going to chew up resources.)

My thought was to break up each heightmap into smaller patches, and produce smaller LoDs for each one, then determine which LoD to render by the distance to the camera. Is this a decent way to do this for a hobby type game? Is there a better approach? I want to have an arbitrary world size some time down the line, so I'm trying to plan for managing loading and unloading groups of these patches from the hard drive so I can roll around all over Mars or something.

PDP-1
Oct 12, 2004

It's a beautiful day in the neighborhood.

Pfhreak posted:

My thought was to break up each heightmap into smaller patches, and produce smaller LoDs for each one, then determine which LoD to render by the distance to the camera. Is this a decent way to do this for a hobby type game? Is there a better approach? I want to have an arbitrary world size some time down the line, so I'm trying to plan for managing loading and unloading groups of these patches from the hard drive so I can roll around all over Mars or something.
Funny, I've been thinking about a similar problem. One idea I had was to divide the world map into NxN blocks where N is some power of 2. You draw the block your player is standing in plus the adjacent blocks in full resolution, then draw blocks that are further away using every other vertex, and finally blocks that are way off in the background using every 4th vertex, etc.

The only tricky part is that you have to heal the seams between low-resolution and higher-resolution blocks by drawing the low-resolution blocks first and then linearly interpolating between the low-resolution points on the edges to force the higher-resolution points on the same edge to match up.

I'd be interested to see whatever solution you end up using if you don't mind posting it in this thread when you have something working.

Paniolo
Oct 9, 2007

Heads will roll.

Pfhreak posted:

I just spent a couple hours banging out a quick diamond-square generator to build heightmaps, and I'm pleasantly surprised at how well it works. I've gone ahead and written a quick box filter to smooth out the heightmap, which is a nice touch.

I've taken care of filtering out areas of all white/all black by preventing values greater than 1 or less than 0 for the height. I'd like to eventually use these terrains for a game like Tropico. Only, everything I'm reading online about XNA suggests that just building vertex/index buffers out of these heightmaps is an inefficient use of resources. (Obviously, rendering every heightmap every frame is going to chew up resources.)

My thought was to break up each heightmap into smaller patches, and produce smaller LoDs for each one, then determine which LoD to render by the distance to the camera. Is this a decent way to do this for a hobby type game? Is there a better approach? I want to have an arbitrary world size some time down the line, so I'm trying to plan for managing loading and unloading groups of these patches from the hard drive so I can roll around all over Mars or something.

That algo's known as "geomipmapping" and is probably the most common technique for terrain in modern game engines. Wiki has an article on it.

Another option is clipmapping (paper here).

Most other terrain algos you'll find when googling (like ROAM) aren't used anymore because they aren't GPU-friendly. Both geomipmapping and clipmapping can use static geometry buffers and sample the heightmap texture directly in the vertex shader.

Keep in mind when doing terrain that an inefficient LOD algo can actually lower your framerate on modern GPUs so you may want to benchmark against a naive implementation.

Krenzo
Nov 10, 2004
Does anyone have any experience with collision detection? I'm using GJK to determine if two objects collide and then ray tracing out of the Minkowski Difference of the two shapes to get the penetration depth and normal. I now realize that I need to get the faces that are in contact because the normal can be from either shape when I only want the contact normal from one specific shape. Does anyone have an idea on the most efficient way to do that? Redo the same ray trace except on only the shape I want?

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!
Any of you devs maintain blogs about what you are learning? It's pretty interesting, as a hobbyist, to read about what actual devs are doing/learning.

Escape Goat
Jan 30, 2009

FreakyZoid posted:

Crossposting from the making games megathread, but if any of you have premium Creators Club membership, I have a game in playtest at the moment, would appreciate some feedback. Cheers,

http://forums.xna.com/forums/p/49151/295291.aspx#295291

I get a server error when I try that link. :smith:

FreakyZoid
Nov 28, 2002

You will do now - games only stay active for about a week or so when they're in playtest. I'll have a new version up in a few days I think. Cheers for looking though,

HicRic
Dec 4, 2006
To disagree with three-fourths of the British public is one of the first requisites of sanity.
Can anyone recommend good sources (websites/books) that deal with networking, with a focus on networking for games? And/or perhaps recommend a good c++ library for doing such things?

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!

HicRic posted:

Can anyone recommend good sources (websites/books) that deal with networking, with a focus on networking for games? And/or perhaps recommend a good c++ library for doing such things?

I've used Raknet in the past with great success. It abstracts most of the networking code away, which may or may not be something you are interested in. It has a lot more than simple networking though, so it may be more than you need.

Morpheus
Apr 18, 2008

My favourite little monsters
So I'm doing a top-down 2D game at the moment, and have recently started on some basic enemy AI. I've done pathfinding before, A* and whatnot, but never in a situation with a map that doesn't have a grid laid out (done pathfinding in roguelikes mostly). Would it be better to simply restrict my map to a grid (ie a chest/wall/door etc is the size of one cell), or is there a better way to do this?

ping
Aug 15, 2001

by Lowtax

Morpheus posted:

So I'm doing a top-down 2D game at the moment, and have recently started on some basic enemy AI. I've done pathfinding before, A* and whatnot, but never in a situation with a map that doesn't have a grid laid out (done pathfinding in roguelikes mostly). Would it be better to simply restrict my map to a grid (ie a chest/wall/door etc is the size of one cell), or is there a better way to do this?

You can do pathfinding in the same way as you have done before, but with a much higher level of granularity - the (x,y) co-ordinate system is a grid and either a pixel is traversable or it isn't, so you can just represent this in your A* implementation. The reason why you might not want to do this is that A* will start to get very expensive the more routes of investigation it has, and having it consider paths on a pixel-by-pixel basis gives it a lot of stuff to consider (depending on the size of your world) - so you might want to think about splitting your world up into a grid of chunks of pixels, and then maybe look into finding a nice heuristic to speed things up.

Morpheus
Apr 18, 2008

My favourite little monsters

ping posted:

You can do pathfinding in the same way as you have done before, but with a much higher level of granularity - the (x,y) co-ordinate system is a grid and either a pixel is traversable or it isn't, so you can just represent this in your A* implementation. The reason why you might not want to do this is that A* will start to get very expensive the more routes of investigation it has, and having it consider paths on a pixel-by-pixel basis gives it a lot of stuff to consider (depending on the size of your world) - so you might want to think about splitting your world up into a grid of chunks of pixels, and then maybe look into finding a nice heuristic to speed things up.

Yeah I was just thinking of splitting my world into a grid of, say, 50 pixels for each cell, and then using clearance-based pathfinding to make my way around, loading in the clearance levels when the map loads. That way I can have objects whose sizes are multiples of 50 use the grid to make their way around, and since they're limited by their range of sight (or sound), I should have a somewhat-fixed distance in which to do A* to avoid high costs. Hopefully.

Going to have to play with some heuristics though. I'll use Manhattan as a placeholder for now.

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh
Depending on how your data is organized, you could use BSP to create a graph to traverse.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!
I always though this powerpoint on L4D AI had some interesting insights. You'd have to figure out how to build your own navmesh though.

Pfhreak fucked around with this message at 22:38 on Mar 21, 2010

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh

Pfhreak posted:

You'd have to figure out how to build your own navmesh though.

That's actually exactly what BSP would help you with.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!

Avenging Dentist posted:

That's actually exactly what BSP would help you with.

Yes, yes it would. Somehow I totally missed that post.

Paniolo
Oct 9, 2007

Heads will roll.
Haven't used it myself, but Recast is a navmesh generation library that looks interesting.

Morpheus
Apr 18, 2008

My favourite little monsters
I'm not entirely sure, but aren't navmeshes best used for 3D maps, where it isn't feasible to make a 'grid' layout? Or perhaps the article I read merely said that it's preferable to other options, when using 3D.

Morpheus fucked around with this message at 00:38 on Mar 22, 2010

HicRic
Dec 4, 2006
To disagree with three-fourths of the British public is one of the first requisites of sanity.

Pfhreak posted:

I've used Raknet in the past with great success. It abstracts most of the networking code away, which may or may not be something you are interested in. It has a lot more than simple networking though, so it may be more than you need.

I'm interested in using a high level library and learning more about it at a low level too, really. Attack it from both sides and see what I pick up. I'll check out Raknet, cheers.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!

Morpheus posted:

I'm not entirely sure, but aren't navmeshes best used for 3D maps, where it isn't feasible to make a 'grid' layout? Or perhaps the article I read merely said that it's preferable to other options, when using 3D.

If you think about it, a grid is a navmash, just a really naive one. Each part of the mesh connects with 4 (or 8) neighbors. In a 1x1 pixel grid, this results in a LOT of space that doesn't need to be individual nodes. For example, let's say your game has nice big rectangular bridges, maybe 20x50 pixels. That's 100 pixels and 100 entries in your pathfinding algorithm.

If you generate just one quad that sits on top of that bridge, it drops to 100 pixels, but only 1 entry in your pathfinding algorithm. The enemy unit is free to wander around anywhere inside that quad, because we know the entire center area is free. If a unit wants to move across the bridge, the number of nodes they have to expand is two orders of magnitude fewer.

You can generate the navmesh pretty easily using BSP or a quadtree. Imagine your empty pristine world has 1 navigable quad, so all your entities are free to just cruise about. When the player drops in a structure, the bsp/quadtree adjusts whatever the smallest subtree they have is to accommodate the change. Now, all that being said, I've never actually built anything like that, so I can't point you to good how-to type resources.

Adbot
ADBOT LOVES YOU

Paniolo
Oct 9, 2007

Heads will roll.
For a 2D topdown game with irregular geometry I would use a quadtree instead of a grid. The world's still divided up into squares, but only to the extent that's needed to accurately represent the collision geometry. So you can get pixel accuracy where needed without needing to store a pixel-level grid for the entire world. It's also easy to dynamically add and remove geometry.

There's no reason to use a navmesh for a 2D game. The only reason for using one is to allow layered geometry in levels (rooms on top of other rooms, bridges, etc.) and it is significantly more complex, which is one reason most early 3D games simply didn't allow layered geometry.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply