Gauntlets of Recursion (+3)

Times, trials, and turbulence.

Adventures in GUI Land.

*GUI Groan*

BattleForge is moving along steadily, despite my dislike for writing GUI systems. With the development that was done today, the most tedious parts of the editor are (arguably) at a close. Thank goodness. 🙂

The Modes of the Trade

I decided early on that I would continue the trend of my last editor for Skirmish, and break the editor into several modes. Originally Map Settings and Ambient Settings were to be modes, but that felt a little excessive. Depending on what mode the user is in, the user’s actions and abilities to manipulate the environment are limited based on that mode. For example, inside of Tile Mode, the user has no risk of accidentally modifying props above certain tiles they are trying to edit. The modes are as follows:

Tile Mode: Tiles are the main building block of the game. These are square 32×32 images that can be stacked on each 32×32 grid location on the map. Each tile defines its own collision parameters versus the world, projectiles, and other objects. Tiles are placed/erased by means of selecting rectangular regions of the map to apply a tile to.

Prop Mode: Props are the objects in the world that are influenced in some manner by the physics engine. Dynamic props are directly simulated, and static props who can be damaged and (in most cases) destroyed. Props can be placed at an arbitrary X/Y coordinate, as well as an elevation from the ground.

Decal Mode: Decals are no more than static images that can be placed arbitrarily around the world. They have no physics or collision detection, and exist soley for decorative purposes.

Patch Mode: Patches are a new concept that hasn’t been discussed here yet, although you can see an example of a ‘ground patch’ here. A ‘patch’ is an arbitrary convex polygon with a specified texture and a ‘fade distance’. In the aforementioned image, the texture is grass, and the fade distance is how far from the polygon the texture will go before fading entirely back into the map’s ground texture. Right now only ‘ground patches’ exist, but this is planned to be expanded into allowing things like bodies of water, or toxic waste spills that can damage players.

Light Mode: Lighting is still a tentative subject. It hasn’t been decided whether the lighting in Skirmish will be static or dynamic, but per-tile lighting will be implemented in some form. This mode will allow for the placement of different types of lights, with varying styles (point light, spot-light, omni-light…) and colours, as well as the manipulation of existing lights.


Above you can see the icon-buttons for the five modes in action, as well as the recently implemented ImagePalette and Scrollbar GUI components. Both were (naturally :)) a pain to implement. However, with these done, the main “boring parts” are over. At this point it’s really just a matter of coding in tile placement/erasing, and then reusing the ImagePalette for the Prop and Decal modes and implementing them as well.

Onward ho!

9 responses to “Adventures in GUI Land.

  1. Jussi Lepistö December 29, 2007 at 5:12 am

    Nice progress! Though remember that while a good icon is worth a thousand words, a single word is worth a thousand bad icons (re: mode icons).

    You must have dynamic lighting with shadows, because it will make shooting in a dark room awesome. 😉

  2. Draff December 29, 2007 at 11:39 am

    Makes me want to shoot chess pieces. 😀 Birchon!

  3. Stephen December 30, 2007 at 12:45 pm

    @Jussi: Ouch, are my icons really THAT bad? 🙂 I’m open to suggestions to other things the icons could depict to make it clearer what each mode is.

  4. Manaxter December 30, 2007 at 5:53 pm

    I simply can’t wait!

  5. EasilyConfused December 30, 2007 at 7:01 pm

    All looking damn good.

    I’m reading all this with interest at the moment, as I’m verging on starting a new editor for Orb.

    Out of curiosity, your patches (which sound like a very interesting idea, BTW), are convex polygons – how are you ensuring that the user plots out a convex shape?

    I have a system on my current editor that constrains the polygon to convex via pages of horrible vector math, but I’m not happy with it and would be interested in other solutions.

  6. Stephen December 31, 2007 at 12:00 am

    @Manaxter: Thanks! I’m also looking for suggestions on the interface as well. I’m no UI professional, so please also let me know where I can improve, too. 🙂

    @EasilyConfused: I’m doing the modes in sequential order, so I haven’t even gotten to the point where the user can plot out a ground patch just yet. Anyways, the “solution” I’m planning on using is simply letting it be user-moderated. If the player wants to draw a messed up/broken ground patch, then why stop them? I don’t see something like drawing a convex polygon as such a mental work-out that I need to programmatically constrain it.

    I am, however, interested in the math behind such a problem of deciding convexity. I’ll put it on my to-do list and see if I can figure out a neat solution. 🙂

  7. EasilyConfused December 31, 2007 at 4:17 am

    I’d agree that a good solution would be to let it be on the user’s own head, but I have the issue that because I’m using SAT to do my point-in-polygon tests, the user could plot a non-convex polygon that was then impossible to reselect to delete.

    Actually, I’ve been looking over my constraints code, and it is not really as bad as I remembered, so I’m going to stick with that.

    Still be very interested in any other ideas you or others have had on the subject.

  8. The Visible Man December 31, 2007 at 7:43 pm

    I like the mode idea, should help keep things organized. The layout is good, too. Although, you might want to distance yourself from gradients, since they clash a bit with the rest of the art.

    Also, I’ve got to agree with Lepistö, you should reconsider the mode images. Prop and Decal are specifically misleading. Maybe a box for props, and paintbrush or spray can for decals? Or you could just switch them to text.

    If you plan on having a lot of different terrains (which I hope you do, gives the game more diversity) you consider implementing a way to quickly switch between often used tiles. For example, maybe holding control and clicking on an already placed tile will switch you to that type. It would make building maps much faster 🙂

    Keep up the awesome work, and Happy New Year! 😀

  9. Stephen December 31, 2007 at 9:09 pm

    Lots of solid points and good ideas, TVM. I like your ideas for the different mode icons, and I will definitely implement a hotkey for quick-selecting a tile from the map. Thanks!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: