programming

fileformat masterbation

janel is in spring break right now so i have a little bit of time to play around with things. not enough time to do anything real, but i can play around.
below is basically a variant of my old gbscript (if you've read my blog for awhile you've seen this all before BECAUSE IT IS TEH AWESOME.) i'm still not sure if i want to go this route and have an official format like this, but it is a very nice way for me to refactor/design large amounts of imaginary code in my head. the code is the 'details' anyway. haha. one nice thing about doing things this way is that you can make massive design changes in only a few minutes.

this semi-neatly handles a lot of the hacky nastiness that comes with a game engine. stuff like sharing vs instances, object definitions, and flexible configuration. it handles it by ignoring the problem and forcing it to be a content problem and not a programming problem. of course that is probably a bad idea, but whatever.

btw.. i'm not sure if i like the path separator for sub-member accessing, but it is consistent and it does work with the issue that filenames often are dotted (making dotting access a bitch). the other uglyness i'm experimenting with is the use of ~ instead of ~= (D style for append) or += overloading, hopefully it won't make you vomit.

this isn't meant to all be in a single file, the intended fullpath is above each snippet.

Code:
/robote/glypharrays/donkey.glypharray

return new gamebasis/array<Glyph>($GAMEBASIS_THIS_FILENAME)
{
   MinimumCapacity=2;
   Elements~new gamebasis/Glyph("hips")
   {
   };
   Elements~new gamebasis/Glyph("torso")
   {
   };
};


/robote/glyphnodes/donkey.glyphnode

return new gamebasis/GlyphNode($GAMEBASIS_THIS_FILENAME)
{
   LocalPosition=[[0 0 0]];
   Childs/MinimumCapacity=1;
   Childs~new gamebasis/GlyphNode("hips")
   {
      TheGlyph=[[/robots/glypharrays/donkey.glypharray/Elements/hips]];

      Childs/MinimumCapacity=1;
      Childs~new gamebasis/GlyphNode("torso")
      {
         TheGlyph=[[/robots/glypharrays/donkey.glypharray/Elements/torso]]();
      };
   };
};


/robote/animations/donkey_run.animation

return new Animation($GAMEBASIS_THIS_FILENAME)
{
   AnimationTargets/MinimumCapacity=2;
   AnimationTargets~new AnimationTargets("head")
   {
      AnimationChangels/MinimumCapacity=2;
      AnimationChannels~new AnimationChannel("LocalPosition")
      {
         TimeA=[[0.0];
         ValueA=[[0 0 0]];
         TimeB=[[1.0];
         ValueB=[[0 1 0]];
      };
      AnimationChannels~new AnimationChannel("LocalPosition/X")
      {
         TimeA=[[0.0];
         ValueA=[[0]];
         TimeB=[[1.0];
         ValueB=[[1]];
      };
   };
};


/robote/models/mrdonkey.model

return new [[/robote/glyphnodes/donkey.glyphnode]]($GAMEBASIS_THIS_FILENAME)
{
   TheModel=new robote/Donkey($GAMEBASIS_THIS_OBJECT)
   {
   };
};


//robote/textures/grass.texture

return new gamebasis/Texture()
{
   Bitmap=[[/robote/bitmaps/grass.bmp]];
};


//robote/gpucode/winforms/dx9_low/diffuse.shader

return new gamebasis/winforms/NativeShaderDX9()
{
   FXFile=[[/robote/gpucode/winforms/dx9_low/diffuse.fx]];
};


/robote/maps/fancyland.map

return new gamebasis/Map($GAMEBASIS_THIS_FILENAME)
{
   EmbeddededGlyphs/MinimumCapacity=2;
   EmbeddededGlyphs~new gamebasis/Mesh("terrain,0")
   {
      Shader=[[/robote/gpucode/$GAMEBASIS_PLATFORM/$GAMEBASIS_GPU_PROFILE/diffuse]];
      TextureChannels/MinimumCapacity=1;
      TextureChannels~[[/robote/textures/grass.texture]];
      MeshChannels/MinimumCapacity=2;
      MeshChannels~new MeshChannel4f("positions_xyzw")
      {
         Data/EnsureCapacity(3);
         Data~[[0 0 0 0]];
         Data~[[1 0 0 0]];
         Data~[[0 1 0 0]];
      };
      MeshChannels~new MeshChannel2f("texcoords_st")
      {
         Data/MinimumCapacity=3;
         Data~[[0 0]];
         Data~[[1 0]];
         Data~[[0 1]];
      };
   };
   EmbeddededGlyphs~new gamebasis/Box("box")
   {
      Size=[[1 1 1]];
   };

   GlyphNodes/MinimumCapacity=2;
   GlyphNodes~new [[/robote/models/mrdonkey.model]]("donkey_friendly")
   {
      LocalPosition=[[10 0 0]];
      TheModel/Meanness=[[0]];
   };
   GlyphNodes~new [[/robote/models/mrdonkey.model]]("donkey_mean")
   {
      LocalPosition=[[20 0 0]];
      TheModel/Meanness=[[1]];
   };

};