Times, trials, and turbulence.
Adventures in GUI Land.
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.