Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Best way to do... this...

Name: Anonymous 2010-08-21 0:04

So this is kinda hard to explain, but let me try my best.
I am making this 3D game engine, and I need an easy way to make 3D object in a text editor (don't ask). So, I decided to create CSS/XML style way to view the object that gets parsed by the engine that fit my needs. Here is an example ("#" means comment, "..." = etc):

object_name {
    draw {
         body_part1 {
              physics = true or false; # whether or not physics affect this limb, if it does, there must be a:
              connect (at_x, at_y, at_z, body_part, joint_type);
              # Methods to draw the body part.
              # For example:
              sphere (x, y, z, colour);
              ...
        };
        ...
    };
    animation="death"{ # could be many things, not just death
          frame=1{
              movex (body_part, x);
              ...
          };
         ...
    };
};

What should I change/add?

Name: Anonymous 2010-08-21 0:24

You should make this into JSON instead of some weird ass custom format, that way any JSON parsing tool can manipulate it.

Name: Anonymous 2010-08-21 0:29

>>2
I tend to think that this format is a bit easier to understand than JSON. If you can rewrite this in JSON and have it be just as easy to understand, then I'll do it, but otherwise I see no point.

Name: Anonymous 2010-08-21 1:46

>>1
Make a 3D object in a text editor?  Hm.

First, you'll want to define all the vertices and their order.  That means groups of three double of float values, as many times as the geometry will have vertices.  You may do this indexed or straightforward; either way, most 3D applications use polygons composed of triangles so just assume that every nine values compose three vertices that forms a triangle (do I really need to be explaining this?).  You will also need to list basic coloration values and/or texturing.  For colors, I recommend defining each vertex individually; use anchor points between image and geometry to place texture, and you can look-up texturing algorithms on your own.  There's more you'll need to decide or generate as you need it but the crucial thing is that you create a consistent format for the computer to read in the file, process the vertices and how they connect, and then render the visible surfaces.

You can do this reading in bulk as the program starts or in special loading events, or you can do it dynamically.  I would recommend studying Dwarf Fortress documentation regarding how the game generates creatures from an assortment of body parts, body sizes, and other variables.  This is, of course, unless you want to make the body a single geometry unit - you're going to have to include control points and the values that manipulate those control points like hell all over the geometry.

Controlled animation, as opposed to just free fall from gravity, is going to be a tricky part.  Assuming you also want to program animations via text editor, you may instead want to program generic movement algorithms and plug limbs and their joints into it.  Instead of moving points, you may want to control joints: give them a general range of movement for a certain action, correspond to how long the action takes or how long the user keeps the action going, and integrate the change in those specific joints using a quaternion.  Allow actions to have different phases, for example, walking might have "step lifting" for when the leading foot is moving forward and "step dropping" when the leading foot is being planted firmly on the ground.

Name: Anonymous 2010-08-21 12:25

>>1
I really don't see a point in creating your own format for 3D objects. Creating a model "by hand" will be extremely infeasible for all but the simplest of models. You'd be better off using an established format and an existing editor. And I'm pretty sure that the DirectX format is basically a text file, too.

Name: Anonymous 2010-08-21 12:52

>>1
.VRML is already text format.
.OBJ is already text format.
Even Microsoft's .X is a text format.

People have been doing this sort of thing for a while now.

Name: Anonymous 2010-08-21 13:34

CSS/XML
Do you really have to ask what's wrong with this?

Name: Anonymous 2010-08-21 14:07

sexp

Name: ​​​​​​​​​​ 2010-10-21 13:44

Name: Anonymous 2010-12-24 22:41


Don't change these.
Name: Email:
Entire Thread Thread List