Introduction
I already have the 2D stuff implemented in my engine to where I am satisfied. The only thing missing is the part of the engine that loads objects from the 2D tile maps and places them in the level- however I will design that later to be generic and use the same format for 2D and 3D maps so to save myself the problem.
Adding entities to a 2D or 3D level is simply done by loading the associated object (sprite, model, ect), looking up the action (need to register the action), and some default entity skill values (skill values are personal entity variables). In any case, placing entities, lights, sounds, assigning textures and material (shader effects) to surfaces are all trivial matters to me. WED saves everything in a text file for you to process with plenty of information to reproduce what the level looks like and even sounds like. WED feels very similar to Valve's HAMMER and they all are typically called World Editors. It's like the big IDE of everything- you can basically create a game from it by making new levels, adding entities, and linking them with special entities who simply warp the player places.
Problem
Making the level is easy, but the hard part is the collision hull. Each block in the level can have faces that have at least 3 sides to them. The information that is important is whether or not a particular polygon intersects the level. This is really complicated. It gets even worse, not only that, but every time a polygon does intersect the level hull it becomes important to know the NORMAL vector. This allows entities to slide around if a hill is too steep (like in Mario 64).
I'm going to write a map compiler (I think you can even replace the default map compiler in WED to your own) that will detect the format (so it works with more than the .WDL format, picking out all the required or useful information) and then generate the necessary stuff. After that, it will compile the textures using the image packer I already wrote. I'm not going to sort all the level polygons using a BSP yet (I have a tutorial on that already from long ago) but I will later to greatly increase the speed. The third chunk of information I need is the collision hull. The blocks need to be converted into shapes that work well with whatever checks for collision.
Here's what the function I need to write looks like:
u32 ws_3d_hull_poly(polygon *what);
It accepts a polygon type (used for collision hulls) and checks to see if it intersects the currently loaded level. It returns 0 if not, otherwise 1. Furthermore:
vector* ws_3d_hull_normal();
Returns a vector representing the normal. It's a 3D vector of length 1 pointing in the direction the hit face was. You can find out the angle of the slope with it. It's perfect for orienting and placing bullet holes and deformation marks. There's plenty of ways to do this- but the thing is I won't be able to tell if it is a bad way unless it's a REALLY bad way.
This post has been edited by WolfCoder: 24 March 2009 - 12:35 PM

New Topic/Question
Reply





MultiQuote






|