Jump to content

  • Log In with Google      Sign In   
  • Create Account


Telanor

Member Since 01 Sep 2011
Offline Last Active Jul 10 2014 11:29 PM
-----

Topics I've Started

Pathfinding for large units

17 June 2014 - 07:52 PM

I'm not entirely sure if this is the right section for this, but here's my problem: I have a 3D voxel world, similar to minecraft, and I'm using A* to do pathfinding for the NPCs. Since the world is laid out in a grid of blocks, I use that same grid for the pathfinding nodes. When the AI follows the path, for units wider than a single grid unit, it gets stuck a lot of times.

The first issue it has is when it comes to a ledge that it needs to drop down from, as shown in my crappy drawing:
Attached File  diagram.png   11.72KB   2 downloads

The AI gets to the node above the ledge, but can't fall down to the next 3 nodes without moving forwards more.

The other issue is things like doorways, where its physically impossible for the unit to go through due to the size. It would need the pathfinder to path around and find another, larger, opening.

I've tried a bit to make the A* pathfinding work for larger units but the code quickly became a mess and each node check started to require checking a good 15 or so surrounding nodes. Is this the right way to go about it or is there a better solution? Keep in mind its a dynamic world, so precomputed solutions won't work.

Client loading entities

12 June 2014 - 12:58 PM

Suppose you have a large, seamless transition world that's not all kept loaded in memory at the same time. When a player enters a previously unloaded region, the server loads it up and then can easily send out the data to any players nearby upon completion. But how do you deal with players that move into that area after it's already loaded up. They need to have the data sent to them saying what to load and where. And you don't want to waste network bandwidth by constantly sending everyone "create X entity" messages when they already have those entities loaded. So what's the solution to this?

Packet combining

23 May 2014 - 09:05 PM

How do games usually handle having a bunch of different packets to send out in a single tick?

Suppose you have:
- 5 entities that have moved
- 3 entities that have started playing a new animation
- 6 new particle systems created (or rather 6 events that will create particle systems and sounds, etc)
- 2 new effects (as in the poison, heal, etc) applied to an entity (which is more than just a particle system, its also an icon to display on the UI)

Would any of those packets be combined into one to reduce overhead? If so, how? Do you combine all of the same type? Combine everything? Combine as many as you can until a certain size limit? What would the size limit be?

Suppose only some of those packets need to be sent to player A and some to player B (with some being sent to both). How does that affect the combining?

By the way, I'm using the lidgren networking library, in case that's important.

Issue combining matrix components

23 April 2014 - 07:59 PM

Previously I was multiplying 2 matrices together to do my bone transformations, but now I've broken the matrices down into scale, rotation, translation components. My goal is to work with the component parts so I can perform proper lerping and then combine the final result into a matrix to send off to the GPU. I'm having a problem combining things in this form though.

This is what I did previously: C = A * B. Where those are all matrices. That worked fine. Now what I'm doing is:
 
C.rotation = A.rotation * B.rotation;
C.translation = A.translation + B.translation;
C.scale = A.scale * B.scale;

Rotation is a quaternion, translation and scale are vector3s. When I combine these 3 components of C into a matrix again: Matrix.Scaling(Scale) * Matrix.RotationQuaternion(Rotation) * Matrix.Translation(Translation) the result is wrong, and my model looks like a collapsed blob.

I'm not sure if this matters, but the original info coming from the model file is a matrix, so I have to decompose the matrix into the 3 component parts on load, which I then store and use for these calculations.

Anyone know what I'm doing wrong here?

Rotate a quaternion

05 April 2014 - 05:48 PM

For some reason I can't quite work out how to rotate a quaternion left and right 15 degrees along its up axis. This is what I tried:
 
Quaternion orientation = ...; //The quaternion we're rotating
var offset = MathUtil.DegreesToRadians(15);
var up = Vector3.Transform(Vector3.Up, orientation); //Get the up axis
var rotationA = Quaternion.RotationAxis(up, offset); //Create a rotation around that axis
var rotationB = Quaternion.RotationAxis(up, -offset);

var rotatedA = Vector3.Transform(Vector3.ForwardRH, rotationA * orientation); //Combine the rotations and get the resulting forward vector
var rotatedB = Vector3.Transform(Vector3.ForwardRH, rotationB * orientation);
Didn't matter which order I multiplied the quaternions in, they both seemed to give me weird directions.

PARTNERS