Skip to main content
Commonmark migration
Source Link

I'm defining a custom/simple file format for loading textures in my game. I narrowed my choice of file formats to two options:

I chose Lua, because my game is already using Lua, I wouldn't need to add protobufs to the build. Eventually, I'll use the engine to build a network game, at which point I'll add protobufs it's just that I don't need it yet and have other pressing needs in the engine.

However, I'm kinda stuck. Most (all?) of my support tools I write in python. I can't find a small clean Lua module for python. That means my python tools end up parsing the Lua syntax by hand. It's not too onerous as file format uses a very small subset of Lua, but still annoying.

So now I'm second guessing myself, Should I have picked protobuf instead?.
Then I promptly third guessed myself, Am I just afflicted with wanderlust and should stick with a solution that already kinda works?.

So which would you pick (or already did)?
And more importantly why?


My thoughts. ###Lua

Lua

texture
{
   width=8;  --#256
   height=7; --#128
   format=GL_RGB;
   pixels= [=[
<binary-data-here>]=];
}
  • + "plain" text format
    Technically only the meta data is plain text but base64 encoding just for the sake of plain text is silly.
  • + parsing is trivial as the engine already supports Lua.
  • -/+ easy (not trivial) to generate, and can be easily verified with luac.
  • - python tools have difficulty parsing

###protobuf

protobuf

message Texture {
   required uint32 width = 1;
   required uint32 height = 2;
   enum Format {
      GL_RGB = 0;
      GL_RGBA = 1;
      ...
      GL_LUMINANCE_ALPHA = N;
   };
   required Format format = 3;
   required bytes pixels = 4;
}
  • + protobufs are well tested and optimized
  • + they will be needed eventually to do network communication
  • - networking isn't part of the engine yet (and wont be for some time, the next few games don't need it).
  • + trivial to parse
  • + trivial to generate
  • - complex binary format, impossible to edit, or verify by inspection.

I'm defining a custom/simple file format for loading textures in my game. I narrowed my choice of file formats to two options:

I chose Lua, because my game is already using Lua, I wouldn't need to add protobufs to the build. Eventually, I'll use the engine to build a network game, at which point I'll add protobufs it's just that I don't need it yet and have other pressing needs in the engine.

However, I'm kinda stuck. Most (all?) of my support tools I write in python. I can't find a small clean Lua module for python. That means my python tools end up parsing the Lua syntax by hand. It's not too onerous as file format uses a very small subset of Lua, but still annoying.

So now I'm second guessing myself, Should I have picked protobuf instead?.
Then I promptly third guessed myself, Am I just afflicted with wanderlust and should stick with a solution that already kinda works?.

So which would you pick (or already did)?
And more importantly why?


My thoughts. ###Lua

texture
{
   width=8;  --#256
   height=7; --#128
   format=GL_RGB;
   pixels= [=[
<binary-data-here>]=];
}
  • + "plain" text format
    Technically only the meta data is plain text but base64 encoding just for the sake of plain text is silly.
  • + parsing is trivial as the engine already supports Lua.
  • -/+ easy (not trivial) to generate, and can be easily verified with luac.
  • - python tools have difficulty parsing

###protobuf

message Texture {
   required uint32 width = 1;
   required uint32 height = 2;
   enum Format {
      GL_RGB = 0;
      GL_RGBA = 1;
      ...
      GL_LUMINANCE_ALPHA = N;
   };
   required Format format = 3;
   required bytes pixels = 4;
}
  • + protobufs are well tested and optimized
  • + they will be needed eventually to do network communication
  • - networking isn't part of the engine yet (and wont be for some time, the next few games don't need it).
  • + trivial to parse
  • + trivial to generate
  • - complex binary format, impossible to edit, or verify by inspection.

I'm defining a custom/simple file format for loading textures in my game. I narrowed my choice of file formats to two options:

I chose Lua, because my game is already using Lua, I wouldn't need to add protobufs to the build. Eventually, I'll use the engine to build a network game, at which point I'll add protobufs it's just that I don't need it yet and have other pressing needs in the engine.

However, I'm kinda stuck. Most (all?) of my support tools I write in python. I can't find a small clean Lua module for python. That means my python tools end up parsing the Lua syntax by hand. It's not too onerous as file format uses a very small subset of Lua, but still annoying.

So now I'm second guessing myself, Should I have picked protobuf instead?.
Then I promptly third guessed myself, Am I just afflicted with wanderlust and should stick with a solution that already kinda works?.

So which would you pick (or already did)?
And more importantly why?


My thoughts.

Lua

texture
{
   width=8;  --#256
   height=7; --#128
   format=GL_RGB;
   pixels= [=[
<binary-data-here>]=];
}
  • + "plain" text format
    Technically only the meta data is plain text but base64 encoding just for the sake of plain text is silly.
  • + parsing is trivial as the engine already supports Lua.
  • -/+ easy (not trivial) to generate, and can be easily verified with luac.
  • - python tools have difficulty parsing

protobuf

message Texture {
   required uint32 width = 1;
   required uint32 height = 2;
   enum Format {
      GL_RGB = 0;
      GL_RGBA = 1;
      ...
      GL_LUMINANCE_ALPHA = N;
   };
   required Format format = 3;
   required bytes pixels = 4;
}
  • + protobufs are well tested and optimized
  • + they will be needed eventually to do network communication
  • - networking isn't part of the engine yet (and wont be for some time, the next few games don't need it).
  • + trivial to parse
  • + trivial to generate
  • - complex binary format, impossible to edit, or verify by inspection.
cleaned up english
Source Link
deft_code
  • 7.6k
  • 5
  • 39
  • 55

I'm defining a custom/simple file format for loading textures in my game. I narrowed my choice of file formats to two options:

I chose Lua, because my game is already using Lua, I wouldn't need to add protobufs to the build. Eventually, I'll use the engine to build a network game, at which point I'll add protobufs it's just that I don't need it yet and have other pressing needs in the engine.

However, I'm kinda stuck. Most (all?) of my support tools I write in python. I can't find a small clean Lua module for python. That means my python tools end up parsing the Lua syntax by hand. It's not too onerous as file format uses a very small subset of Lua, but still annoying.

So now I'm second guessing myself, Should I have picked protobuf instead?.
Then I promptly third guessed myself, Am I just afflicted with wanderlust and should stick with a solution that already kinda works?.

So which would you pick (or already did)?
And more importantly why?


My thoughts. ###Lua

texture
{
   width=8;  --#256
   height=7; --#128
   format=GL_RGB;
   pixels= [=[
<binary-data-here>]=];
}
  • + "plain" text format
    Technically only the meta data is plain text but base64 encoding just for the sake of plain text is silly.
  • + parsing is trivial as the engine already supports Lua.
  • -/+ easy (not trivial) to generate, and can be easily verified with luac.
  • - python tools have difficulty parsing

###protobuf

message Texture {
   required uint32 width = 1;
   required uint32 height = 2;
   enum Format {
      GL_RGB = 0;
      GL_RGBA = 1;
      ...
      GL_LUMINANCE_ALPHA = N;
   };
   required Format format = 3;
   required bytes pixels = 4;
}
  • + protobufs are well tested and optimized
  • + they will be needed eventually to do network communication
  • - networking isn't part of the engine yet (and wont be for some time, the next few games don't need it).
  • + trivial to parse
  • + trivial to generate
  • - complex binary format, impossible to edit, or verify by inspection.

I'm defining a custom/simple file format for loading textures in my game. I narrowed my choice of file formats to two options:

I chose Lua, because my game is already using Lua, I wouldn't need to add protobufs to the build. Eventually, I'll use the engine to build a network game, at which point I'll add protobufs it's just that I don't need it yet and have other pressing needs in the engine.

However, I'm kinda stuck. Most (all?) of my support tools I write in python. I can't find a small clean Lua module for python. That means my python tools end up parsing the Lua syntax by hand. It's not too onerous as file format uses a very small subset of Lua, but still annoying.

So now I'm second guessing myself, Should I have picked protobuf instead?.
Then I promptly third guessed myself, Am I just afflicted with wanderlust and should stick with a solution that already kinda works?.

So which would pick (or already did)?
And more importantly why?


My thoughts. ###Lua

texture
{
   width=8;  --#256
   height=7; --#128
   format=GL_RGB;
   pixels= [=[
<binary-data-here>]=];
}
  • + "plain" text format
    Technically only the meta data is plain text but base64 encoding just for the sake of plain text is silly.
  • + parsing is trivial as the engine already supports Lua.
  • -/+ easy (not trivial) to generate, and can be easily verified with luac.
  • - python tools have difficulty parsing

###protobuf

message Texture {
   required uint32 width = 1;
   required uint32 height = 2;
   enum Format {
      GL_RGB = 0;
      GL_RGBA = 1;
      ...
      GL_LUMINANCE_ALPHA = N;
   };
   required Format format = 3;
   required bytes pixels = 4;
}
  • + protobufs are well tested and optimized
  • + they will be needed eventually to do network communication
  • - networking isn't part of the engine yet (and wont be for some time, the next few games don't need it).
  • + trivial to parse
  • + trivial to generate
  • - complex binary format, impossible to edit, or verify by inspection.

I'm defining a custom/simple file format for loading textures in my game. I narrowed my choice of file formats to two options:

I chose Lua, because my game is already using Lua, I wouldn't need to add protobufs to the build. Eventually, I'll use the engine to build a network game, at which point I'll add protobufs it's just that I don't need it yet and have other pressing needs in the engine.

However, I'm kinda stuck. Most (all?) of my support tools I write in python. I can't find a small clean Lua module for python. That means my python tools end up parsing the Lua syntax by hand. It's not too onerous as file format uses a very small subset of Lua, but still annoying.

So now I'm second guessing myself, Should I have picked protobuf instead?.
Then I promptly third guessed myself, Am I just afflicted with wanderlust and should stick with a solution that already kinda works?.

So which would you pick (or already did)?
And more importantly why?


My thoughts. ###Lua

texture
{
   width=8;  --#256
   height=7; --#128
   format=GL_RGB;
   pixels= [=[
<binary-data-here>]=];
}
  • + "plain" text format
    Technically only the meta data is plain text but base64 encoding just for the sake of plain text is silly.
  • + parsing is trivial as the engine already supports Lua.
  • -/+ easy (not trivial) to generate, and can be easily verified with luac.
  • - python tools have difficulty parsing

###protobuf

message Texture {
   required uint32 width = 1;
   required uint32 height = 2;
   enum Format {
      GL_RGB = 0;
      GL_RGBA = 1;
      ...
      GL_LUMINANCE_ALPHA = N;
   };
   required Format format = 3;
   required bytes pixels = 4;
}
  • + protobufs are well tested and optimized
  • + they will be needed eventually to do network communication
  • - networking isn't part of the engine yet (and wont be for some time, the next few games don't need it).
  • + trivial to parse
  • + trivial to generate
  • - complex binary format, impossible to edit, or verify by inspection.
added 721 characters in body
Source Link
deft_code
  • 7.6k
  • 5
  • 39
  • 55

I'm defining a custom/simple file format for loading textures in my game. I narrowed my choice of file formats to two options:

I chose Lua, because my game is already using Lua, I wouldn't need to add protobufs to the build. Eventually, I'll use the engine to build a network game, at which point I'll add protobufs it's just that I don't need it yet and have other pressing needs in the engine.

However, I'm kinda stuck. Most (all?) of my support tools I write in python. I can't find a small clean Lua module for python. That means my python tools end up parsing the Lua syntax by hand. It's not too onerous as file format uses a very small subset of Lua, but still annoying.

So now I'm second guessing myself, Should I have picked protobuf instead?.
Then I promptly third guessed myself, Am I just afflicted with wanderlust and should stick with a solution that already kinda works?.

So which would pick (or already did)?
And more importantly why?


Examples
My thoughts. ###Lua

texture
{
   width=256;width=8;  --#256
   height=128;height=7; --#128
   format=GL_RGB;
   pixels= [=[
<binary-data-here>]=];
}
  • + "plain" text format
    Technically only the meta data is plain text but base64 encoding just for the sake of plain text is silly.
  • + parsing is trivial as the engine already supports Lua.
  • -/+ easy (not trivial) to generate, and can be easily verified with luac.
  • - python tools have difficulty parsing

###protobuf

message Texture {
   required uint32 width = 1;
   required uint32 height = 2;
   enum Format {
      GL_RGB = 0;
      GL_RGBA = 1;
      ...
      GL_LUMINANCE_ALPHA = N;
   };
   required Format format = 3;
   required bytes pixels = 4;
}
  • + protobufs are well tested and optimized
  • + they will be needed eventually to do network communication
  • - networking isn't part of the engine yet (and wont be for some time, the next few games don't need it).
  • + trivial to parse
  • + trivial to generate
  • - complex binary format, impossible to edit, or verify by inspection.

I'm defining a custom/simple file format for loading textures in my game. I narrowed my choice of file formats to two options:

I chose Lua, because my game is already using Lua, I wouldn't need to add protobufs to the build. Eventually, I'll use the engine to build a network game, at which point I'll add protobufs it's just that I don't need it yet and have other pressing needs in the engine.

However, I'm kinda stuck. Most (all?) of my support tools I write in python. I can't find a small clean Lua module for python. That means my python tools end up parsing the Lua syntax by hand. It's not too onerous as file format uses a very small subset of Lua, but still annoying.

So now I'm second guessing myself, Should I have picked protobuf instead?.
Then I promptly third guessed myself, Am I just afflicted with wanderlust and should stick with a solution that already kinda works?.

So which would pick (or already did)?
And more importantly why?


Examples
###Lua

texture
{
   width=256;
   height=128;
   format=GL_RGB;
   pixels= [=[
<binary-data-here>]=];
}

###protobuf

message Texture {
   required uint32 width = 1;
   required uint32 height = 2;
   enum Format {
      GL_RGB = 0;
      GL_RGBA = 1;
      ...
      GL_LUMINANCE_ALPHA = N;
   };
   required Format format = 3;
   required bytes pixels = 4;
}

I'm defining a custom/simple file format for loading textures in my game. I narrowed my choice of file formats to two options:

I chose Lua, because my game is already using Lua, I wouldn't need to add protobufs to the build. Eventually, I'll use the engine to build a network game, at which point I'll add protobufs it's just that I don't need it yet and have other pressing needs in the engine.

However, I'm kinda stuck. Most (all?) of my support tools I write in python. I can't find a small clean Lua module for python. That means my python tools end up parsing the Lua syntax by hand. It's not too onerous as file format uses a very small subset of Lua, but still annoying.

So now I'm second guessing myself, Should I have picked protobuf instead?.
Then I promptly third guessed myself, Am I just afflicted with wanderlust and should stick with a solution that already kinda works?.

So which would pick (or already did)?
And more importantly why?


My thoughts. ###Lua

texture
{
   width=8;  --#256
   height=7; --#128
   format=GL_RGB;
   pixels= [=[
<binary-data-here>]=];
}
  • + "plain" text format
    Technically only the meta data is plain text but base64 encoding just for the sake of plain text is silly.
  • + parsing is trivial as the engine already supports Lua.
  • -/+ easy (not trivial) to generate, and can be easily verified with luac.
  • - python tools have difficulty parsing

###protobuf

message Texture {
   required uint32 width = 1;
   required uint32 height = 2;
   enum Format {
      GL_RGB = 0;
      GL_RGBA = 1;
      ...
      GL_LUMINANCE_ALPHA = N;
   };
   required Format format = 3;
   required bytes pixels = 4;
}
  • + protobufs are well tested and optimized
  • + they will be needed eventually to do network communication
  • - networking isn't part of the engine yet (and wont be for some time, the next few games don't need it).
  • + trivial to parse
  • + trivial to generate
  • - complex binary format, impossible to edit, or verify by inspection.
added 493 characters in body
Source Link
deft_code
  • 7.6k
  • 5
  • 39
  • 55
Loading
Source Link
deft_code
  • 7.6k
  • 5
  • 39
  • 55
Loading