Jump to content

  • Log In with Google      Sign In   
  • Create Account

Journal of Aardvajk

Edge Shimmy

Posted by , 27 May 2014 - - - - - - · 629 views

About time I updated here. Been working on edge grabbing and shimmying. Animations are a bit pants but the basic actions are working okay.

Shimmying thankfully uses the same edges I generated for the edge walking in previous entries here. I just use a closest point to line method to check whether both hands are within range of an edge, then generate an edge based on the positions of the ends and the normal. Player rotates to face the normal and then can shimmy along by just trying to move the player along the edge in the requested direction with a test to see if the new position also has two valid hand positions.

It works okay, although the behaviour is a bit odd as you move from one shape to another. Need also to work out a way to lock you properly to the end of the ledge, and to stop you entering shimmy mode if there isn't room to move, but the basic idea is there.

Nice thing about this more cartoony style of jumping is I'm freed from making complicated "climbing up" animations. Actually jumping up or away from a grab position is literally just a case of switching into the jump state, so that is quite clean and looks good I think.

I'm using CamStudio for the videos by the way, since there was some recent discussion about screen capture. Very easy to use and acceptable results without any frame rate loss while recording.

Support functions in a model editor

Posted by , 18 May 2014 - - - - - - · 842 views

Attached Image

Adding a rather nifty set of functionality to Charm, the model editor, this morning. Generating shapes based on support functions rather than explicit geometry.

For those not familiar, a support function is a function that, given a shape and a normal, returns the point on the shape that is farthest in the direction of the normal. For a sphere, for example, this is just pos + (normal * radius) and so on.

Nice thing about support functions is they can be combined to make new, more complex shapes. If you add the result of one support function to another, you get a shape based on "sweeping" the second shape around the surface of the first. The rounded cube in the image above is based on a support function for a cube, with the support function for a smaller sphere added to the result.

The other useful operation is to take the result of two support functions, then return whichever result is farthest along the normal. This produces a sort of convex "shrink-wrap" result. If you had a disc and a point, for example, both offset vertically away from each other, the result would be a cone. You could then add the sphere support to this result, to get a rounded cone, and so on.

This is all well studied and documented, and indeed forms the heart of the GJK distance algorithm but something I can now do in Charm is provide a generic support function to a method and it produces the resulting shape as a convex hull.

Its quite simple to implement. I just initially sweep around a unit sphere with whatever granularity and get a list of the points, then stitch the faces together as if I was creating a sphere. Then I just do the equivalent of the "weld" method that most 3D software supports, merging all the equivalent vertices together and updating the face indices. Then I just do a final sweep and remove any degenerate triangles.

So what I hope to do is build some kind of interactive interface where you can choose from a basic set of primitive supports (cube, sphere, point, disk etc) but then use the UI to express different combinations - add, maximal, etc. Then it should be possible to create a hull of almost any convex imaginable with a few simple clicks and setups in the editor.

Not seen this in other modellers although I'm not very experienced with them. I have a minor issue to sort out as well as the shape above isn't quite symmetric and you can see the top face has one too many triangles so need to figure out what is happening there, but generally speaking, a great result for about an hour and a half's work Posted Image

Here's a very hi-resolution version of the rounded cube, using a very high normal count.

Attached Image

Thanks for reading.

New Level Editor

Posted by , 15 May 2014 - - - - - - · 814 views

Attached Image

Got the new level editor working to the point that it can create maps for the game now. Its a lot more flexible than the last one and more easily supports non-polyhedral shapes, such as the cones here. Should be much easier to extend this project as the requirements change, and of course a lot of the code was lifted from the last one so no great dramas.

Attached Image

The new level in an action shot showing a shadow on a curved surface.

Next up, importing arbitrary meshes into the editor, click-to-place on surfaces and export to the game. So christmas trees with cone collision shapes in other words.

Christmas Trees (apparently)

Posted by , 08 May 2014 - - - - - - · 863 views

Attached Image

Seems to be Christmas in my game world at least, if not in the real world.

Been working vaguely on adding props to the level i.e. meshes that are not just shapes created in the level editor. All the infrastructure is in place in the game, but have realised that the editor is woefully inadequately designed.

So its that usual quandry - do I devote a huge amount of time to improving the level editor (starting from scratch in this case) and hope I am still interested in the game by the time I'm finished, or do I continue to balls-out hack the editor and end up losing interest in the game because the editor is so hard to use?

I'm a bit scared by the amount of work involved in content creation for a 3D game anyway to be honest so I badly need it to be as easy as possible to put levels together. Not sure what the best course of action is here.

Be nice to be able to use someone else's editor but I just don't think there is anything that fits the mark really.

We shall see what we decide in the next few hours.

Edge Clipping

Posted by , 06 May 2014 - - - - - - · 800 views

Well, that was all a bit hardcore. Decided that the only way I could get edge walking working the way I wanted was to preprocess the edges to turn this:

Attached Image

Into this:

Attached Image

I was going just add the edges manually in the editor, but I thought this would get awkward so wanted to have a way to have it sorted automatically and now we have. Its run in the game as a preprocessing step although I might move it out at some point.

The idea is that each shape maintains a list of edges, with start, end and normal for use in the edge walking system. The preprocess starts by setting the edges around the top of each shape so you get the first image.

The challenge then is to convert these edges so that where two edges are coincident, they get clipped out. My algorithm runs through each edge, uses the physics broadphase to get all the shapes that are potentially colliding then compares each edge on that shape to the current edge. Getting a t >= 0 <= 1 value, it then generates a clip-list for the segment, with each item in the list representing a range of the segment that is coincident with another edge.

Then it is a simple (ha ha ha) process of inverting the range, and generating a new edge list for the sections of the original segment that are not covered by the clip list.

So now, you can walk up to any edges but not walk off them, a la Tomb Raider 1. Phew.

May 2014 »


Recent Entries

Recent Comments

Recent Entries

Recent Comments