entity component system object creation

Started by
16 comments, last by frob 8 years, 7 months ago

Learning Lua isn't all that difficult if you have proficiency in other languages. To be honest, however, going this route is somewhat more difficult than simply using XML. It significantly adds to the complexity of your framework, so if you don't really have a genuine need for it and are a relative beginner, you might be better off starting with simple XML/JSON/YAML instead.

I read your article, great job you really know your stuff, ill definitely put learning Lua on my todo list, as i think itll help me later on down the line, as for this project however, i think Lua would probably end up being overkill, thanks for the suggestion though!

Advertisement

Learning Lua isn't all that difficult if you have proficiency in other languages. To be honest, however, going this route is somewhat more difficult than simply using XML. It significantly adds to the complexity of your framework, so if you don't really have a genuine need for it and are a relative beginner, you might be better off starting with simple XML/JSON/YAML instead.

I read your article, great job you really know your stuff, ill definitely put learning Lua on my todo list, as i think itll help me later on down the line, as for this project however, i think Lua would probably end up being overkill, thanks for the suggestion though!

A system that reduces the amount of rebuilding that you have to do is never a bad thing :)

Isn't this a one person effort? Rebuilding is fast compared to putting time into implementing a scripting system you only want to use for loading some data.

IMHO just use CSV files with column headings, exported from a spreadsheet application where you type it in. They are easy to read into your game and don't contain cruft these XML-like formats have.

Isn't this a one person effort? Rebuilding is fast compared to putting time into implementing a scripting system you only want to use for loading some data.

IMHO just use CSV files with column headings, exported from a spreadsheet application where you type it in. They are easy to read into your game and don't contain cruft these XML-like formats have.

I would highly recommend using json instead, as it is extremely flexible in that it can handle arrays, structs, and dictionaries and is quick and easy to use. You'll find tons of parsers out there for it, and it's not nearly as verbose or clumsy as XML.

My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

XML is totally viable awful. I'm using it myself if you ever see me using it, break one of my legs.

FTFY. YAML is so much more prettier than XML that it isn't even funny anymore. Its also measurably prettier than JSON.

Look at this:


entity: 
  character:
    positioning: normal
    z_offset: 0
  position: { x: 0.0, y: 0.0 }
  sprite:
    texture: null
    blending: normal
    tone: {r: 0, g: 0, b: 0, a: 0}
    frame: 0.0
    angle: 0.0

Versus this:


<Entity>
    <Character>
        <Positioning>Normal</Positioning>
        <ZOffset>0</ZOffset>
    </Character>
    <Position>
        <Position>
            <X>0.0</X>
            <Y>0.0</Y>
        </Position>
    </Position>
    <Sprite>
        <Texture>NULL</Texture>
        <Blending>Normal</Blending>
        <Tone>
            <R>0.0</R>
            <G>0.0</G>
            <B>0.0</B>
            <A>1.0</A>
        </Tone>
        <Frame>0</Frame>
        <Angle>0.0</Angle>
    </Sprite>
</Entity>

JUST LOOK AT IT!

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

My journals: dustArtemis ECS framework and Making a Terrain Generator


Its also measurably prettier than JSON.

Did you make up some measurement when you made that statement? YAML's much better than XML, but I don't know what measurement you could possibly use to judge YAML is prettier than JSON.

I'd say it's 6 one, half dozen another and up to the preferences of the user.

My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

XML is totally viable awful. [background=#fafbfc]I'm using it myself [/background]

[background=#fafbfc]if you ever see me using it, break one of my legs.[/background]
FTFY. YAML is so much more prettier than XML that it isn't even funny anymore. Its also measurably prettier than JSON.

Look at this:




entity: 
  character:
    positioning: normal
    z_offset: 0
  position: { x: 0.0, y: 0.0 }
  sprite:
    texture: null
    blending: normal
    tone: {r: 0, g: 0, b: 0, a: 0}
    frame: 0.0
    angle: 0.0

Versus this:



<Entity>
    <Character>
        <Positioning>Normal</Positioning>
        <ZOffset>0</ZOffset>
    </Character>
    <Position>
        <Position>
            <X>0.0</X>
            <Y>0.0</Y>
        </Position>
    </Position>
    <Sprite>
        <Texture>NULL</Texture>
        <Blending>Normal</Blending>
        <Tone>
            <R>0.0</R>
            <G>0.0</G>
            <B>0.0</B>
            <A>1.0</A>
        </Tone>
        <Frame>0</Frame>
        <Angle>0.0</Angle>
    </Sprite>
</Entity>

JUST LOOK AT IT!

I'm blinded by it's beauty

... I think we can end the beauty contest.

Use whatever serialization system you want. Use XML, JSON, YAML, Java's Serializable format, some binary format you make up, a direct memory map format, or anything else you choose.

The key point is that it should generally be kept in data files rather than hard-coded values.

This topic is closed to new replies.

Advertisement