Going up in the world

Recently I have been focussing on how to put together `higher level` objects made from multiple curves and straight lines. An `object` in this sense is, for example, a solid filled irregular shape which might require a few or even many curves, straight lines, corners etc to complete it. The idea is to be able to build such objects with commands that `add a curve`, `add a point`, etc. When the shape is finally closed then it is ready for rendering. I’ve got most of the code done to make this happen.

The flow of object construction sort of goes like:

a) Create a bunch of control points which either will define curves or individual polygon vertices
b) Join then all together sequentially in a bunch of arrays ready for conversion to vertices
c) Pass the arrays to a system of `generators` which take the control data and turn it into vertices/triangles
d) Pass the vertex data to OpenGL for rendering.

Eventually this might be optimized, like a single function call that creates objects and tessellates and renders them with texturing and gradients all in one step. It could optimize the speed.

Another thing I’m working towards is filled gradients and texturing. I haven’t written any code on the gradients yet but I have some stuff for textures that is partially done. The idea with gradients is that you either are generating them in realtime as a triangle mesh with vertex colors, or you are doing that at some point and saving it to a texture ready for later texturing. Somewhere along the line there should be gradient and texture warping ie where you can drag around `vertices` within the gradient mesh to shape it how you want it. Of course there’ll be the usual standard gradients – linear, radial, spherical etc. I still have to think about how to translate a realtime gradient mesh into the vertex colors of a bezier shape – it will require some interpolation.

As far as texturing is concerned, it’s going to work much the same as the gradients – either applying a single texture across a shape, or making it out of a mesh, or even my `SuperTexture` which is a collage of multiple textures. Getting that to map to the vertices of a bezier shape is also going to be tricky, especially to deal with how the bezier moves and deforms, and especially if I do anything in 3D. Being able to manipulate vertices of a mesh which don’t map to vertices of a vector shape is the hard part. The first step is just to get a single texture mapped to a curved shape, which should be straightforward.

Gradually I’m working toward a simple editor where I can add tools to manipulate and generate shapes, apply textures, edit gradients and add other effects, so that I can actually start to use it toward a game. I am still aiming for a small game to be released this Christmas, but I am not sure there is time – only about 3 months to go!

2 Responses to “Going up in the world”


  1. 1 Martin Willcocks March 14, 2010 at 8:41 pm

    Interesting indeed. One of my two board games that I am trying to implement has a 3D version – not like the old 3D chess – I mean that it is a strategy game played on a polyhedral “world”, not one that uses characters etc. but uses player pieces on a complex 3D polyhedron. There may be different types of spaces that have characteristics like bogs – miss two turns before you can get off them, or similar. Or instant “hops” teleporting a piece from one location to another distant from the first. But first, I need a 3D engine that can show the polyhedron at different vies in 3D space, rotate it, and allow players to move their pieces according to the game rules. I have run a Blitz Basic prototype that draws the polyhedron and displays it as a perspective view in a 2D window, and then rotates it through 360 degrees. This involves 180 faces and draws 270 lines between points in 3D space, projects then into a 2D viewport, etc. for a realistic presentation. Next though is a more difficult problem – how to fill each polygon with an appropriate color, shading, etc., and how to place objects with realistic shadows. Clearly a 2D program is very limited in this respect. A 3D engine would be much better, so Blitz 3D looks like a candidate, but so far as I know it doesn’t have a counterpart for Mac OS X and Linux, like BlitzMax and MaxGUI. What are your thoughts on something like this?


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s




Welcome

Enjoy the fun and excitement of computer games, but even moreso, the creative expression of developing your own. And the graphics are cool too. :-)

What was that?

Categorically speaking...

Game Development Graphics Uncategorized

What just happened?

  • 4,788 hits

Follow

Get every new post delivered to your Inbox.