Tank You - Dech Demo (Java)

115Volt wrote:
At the moment our editor produces a xml-file among other things it contains vertices which form polygons.
This polygons are triangulate and the triangles are merged till a certain (configurable) max-size is reached,
what comes out are the landpieces you see in the demo.


Inkscape is a vector graphics drawing tool (http://www.inkscape.org/) which produces SVG (Scalable Vector Graphics) files. SVG is XML so it might be fairly easy to switch.

If you download Inkscape, do "save thsi file" or something on this link (http://blissfulthinking.nl/levelzero.svg), and open it in Inkscape you might get the idea. Check the different layers for geometry, graphics, entities etc. Right click an entity for example and choose Object Properties. There, in the label, you can see info about what it represents.

My method of using Inkscape is very rough, I don't configure anything or write custom scripts to make beautiful level files; they are raw and dirty SVG. The Layers and the Labels are what my parser relies on.

To get an impression of a game using it:
http://blissfulthinking.nl/gamezero
I generally like the idea of using an SVG for levels, but I think this works best when the levels are given and not to be changed by the user. But our goal is to include an editor in the end version of the game, hopefully with a random level generator, so users can make their own levels and the level is different in every match. This way we won't need to include many levels.

I've had a look at the SVG file format. At the moment one land mass looks like this for us:
Code:
<editorobject class="org.hackaddict.tankyou.editor.LandEditorObject"
      type="org.hackaddict.tankyou.plugin.level.DummyLevelType">
      <vertices>
         <vertex x="407.0" y="38.800003" />
         <vertex x="406.0" y="9.900001" />
         <vertex x="423.59998" y="8.900001" />
         <vertex x="425.4" y="13.700001" />
         <vertex x="411.09998" y="13.900001" />
         <vertex x="411.69998" y="21.3" />
         <vertex x="419.3" y="19.7" />
         [ ... ]
      </vertices>
   </editorobject>

This is really easy to parse with Java's built-in XML parsing facilities.

In SVG, when I get it right, a polygon would look like:
Code:
<path
       style="fill:#3fffef;fill-opacity:1;fill-rule:evenodd;stroke:#002fca;stroke-width:1.09727049px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline"
       d="M 740.4515,2361.9454 L 740.4515,2449.7271 L 762.39691,2449.7271 L 762.39691,2361.9454 L 740.4515,2361.9454 z"
       id="path3323" />

That means, the points are somehow coded into the d-attribute and we would have to parse that manually. Of course we could do that, but at the moment I don't see the advantage because we want to make an editor anyway.

One thing I'd want to add - because I think it's not clear enough from 115volt's post - we only save the outline of the great land masses. Cutting them into the little chunks is done algorithmically via triangulation and "reverse"-trianglulation stuff.

That would mean the SVG graphic wouldn't exactly look like the level that it's going to produce (I'm not sure if that is intended or not). I'm also not sure how object placement workt, I think those are rects in your case?

I'll definately keep that in mind in case we start a different game with predetermined levels. I wouldn't like to write editors for all games I'm going to make. Also because I like the idea of resolution-independent 2D graphics.

Michiel wrote:
To get an impression of a game using it:
http://blissfulthinking.nl/gamezero
I'll admit that I'm at work right now. I can't look at the game, but I will do when I'm home.
I also get the same error, either windowed or full screen.
Vista 32bit
2 monitors - 1280x800, 1024x768. 32bit color

Original thread: https://box2d.org/forum/viewtopic.php?t=3448