Saturday, March 8, 2014

LIME Status Report (03/08/2014)

This week I finally forced myself to take a break from my regular job and focus solely on LIME for a couple of days.  The result is perhaps the most productive single week I've ever had on a project.  I need to blow off the rest of my life more often!


The LIME 4 user interface now features scroll buttons that appear when necessary, a data overlay on the editor pane, and slide-out panels for layer selection.

When all of the slide-outs are closed, the editor pane expands to offer the maximum working space.

Accomplishments
  • Finished implementing file I/O for saving maps.
  • Corrected the size of text boxes on the input dialogs.
  • Implemented the functionality behind the New Map dialog.
  • Corrected the issue with the grid lines and mouse cursor appearing in the full screen renders.
  • Changed the scrolling controls to use buttons rather than mouse-over zones.
  • Implemented the slide-outs for the viewing and editing controls.
  • Discovered and fixed a miscalculation in the game timer.
  • Discovered and fixed a scaling bug in the full map render.
  • Implemented a data display overlay for map data.
  • Added rotation and a redimensioning function to the MHPCImage class.
Known Issues
  • Functionality Issues
    • Full-screen mode quit working as soon as I started porting functionality from MHF 2 to MHF 3.  Gotta find out why.
  • Usability Issues
    • The buttons on the New Map screen's cycle controls are occasionally unresponsive.
    • The tile map view's anchor space doesn't always scale correctly when resizing the editor pane.  I've had trouble reproducing this on command, but it happens occasionally.
  • Portability Issues
    • The Android platform layer doesn't yet have the ability to rotate the captions for the slide-out tabs or dynamically resize a graphics canvas.  Currently a low priority since this tool is intended to be used on a developer's PC, but something that needs to be addressed eventually.

Next Steps
  • High Priority:
    • Implement the Open File dialog.
    • Implement the Map Info dialog.
    • Finish programming the toolbox buttons.
      • Eraser Tool
      • Tile Picker Tool
      • Tile ID Toggle
    • Finish programming the view panel buttons.
    • Finish programming the edit panel buttons.
  • Medium Priority:
    • Add "Actor Mode" to the palette window.
    • Test the tile palette with larger tile sets and different tile sizes.
  • Low Priority:
    • Implement the MHBitmapImage.rotate() method for the Android platform.
    • Following the rotate example, implement other capabilities like scaling, image filtering, color blending, and alpha composites.
    • Implement isometric modes.

Saturday, March 1, 2014

LIME Status Report (03/01/2014)

Despite being bogged down with final exams, tutoring, meetings, administrative tasks, and all of the other things that accompany the end of a session, I was still able to accomplish quite a bit in the last couple of weeks.  I created icons for the user interface, added them to components on the screen, and made some important decisions regarding the user interface.

Truth be told, I can't take all the credit.  The main reason I was able to find any time whatsoever for myself this week was because my mother was visiting and looking after my son while I did what I needed to do.  And the design decisions I made were the result of a productive meeting with Professor Steve Santello.  Naturally, I must give credit where it's due, so thanks Mom and Steve!

Here are the icons I made:

Tile Palette Mode Selector
Tiles: Show tiles in the palette pane.
Actors: Show actors in the palette pane.
Toolbox Buttons
Eraser: Erase tiles from the map.
Pick Tool: Select a tile already on the map.
Toggle Grid: Show or hide grid lines.
Toggle IDs: Show or hide tile identifiers.

Here's a picture of them in their original homes based on my brainstorm sketches.



And finally, here is a picture of them in what are likely their final resting places guided by the input of veteran game developer Steve Santello.




Accomplishments
  • Created icons for tile palette controls and toolbox buttons.
  • Added buttons for palette mode selection.
  • Added the toolbox and moved it to a more ergonomic position.
  • Worked on file I/O for saving game world metadata and tile maps.
  • Made some major design decisions regarding the scrolling problem, toolbox location, and palette mode functionality.
    • Scrolling will be accomplished by buttons.  The mouse scrolling functionality will be removed.
    • The toolbox has been relocated to the bottom left rather than the bottom right to improve workflow productivity.
    • The palette modes will be selectable independently of the layer being edited, so that any layer can conceivably contain tiles and actors both.  (Not fully committed to this idea yet.)

Known Issues
  • Functionality Issues
    • If the grid line display is turned on, the lines show up in the full render of the map.  The mouse cursor does too.  The full render should show just the contents of the map, and not user interface elements.
  • Usability Issues
    • There is no visible indication of where the view space is positioned in the world.  This may get disorienting when working on large maps.  It has been advised to add a mini-map showing the location of the view space in the context of the entire map.
    • The text boxes on the input dialogs have gotten fat.  I'd bet money that it's a side-effect of a performance optimization I made to the MHLabel class a couple of weeks ago.
  • Portability Issues
    • The Android platform layer doesn't yet have the ability to rotate the captions for the slide-out tabs.  Currently a low priority since this tool is intended to be used on a developer's PC, but something that needs to be addressed eventually.

Next Steps
  • High Priority:
    • Add new scroll controls to the editor pane.
    • Test the Save and Save As commands to make sure the exported data format is unchanged from that which is read in.
    • Add "Actor Mode" to the palette window.
    • Finish programming the toolbox buttons.
      • Eraser Tool
      • Tile Picker Tool
      • Tile ID Toggle
    • Create a slide-out panel for the layer view controls.
    • Create a slide-out panel for the layer edit controls.
    • Parameterize the slide-out panels so the position of their tabs can be specified -- top, bottom, left, or right edge of the panel.
  • Medium Priority:
    • Port the file dialog classes from the old engine into the new one.  Make appropriate updates to match the style of the new engine's user and software interfaces.
    • Test the tile palette with larger tile sets and different tile sizes.
    • Add a rotate method to the MHBitmapImage interface that takes an angle of rotation and returns a copy of the image rotated by the input angle.
  • Low Priority:
    • Correct the bugs in the full map render view mentioned above.
    • Implement the MHBitmapImage.rotate() method for the Android platform.
    • Following the rotate example, implement other capabilities like scaling, image filtering, color blending, and alpha composites.
    • Implement isometric modes.

Saturday, February 15, 2014

LIME Status Report (02/15/2014)

Don't you hate it when you find a great way to do something and then forget all about it when you need it again?  That's exactly what I did with my project status tracking.  When I was working on Team Laser Combat, I posted weekly progress reports detailing recent accomplishments, issues encountered, and other tasks on the radar for the near future.  It was a simple but incredibly effective way to keep track of where I was in the project, what my next priorities should be, and what issues needed to be addressed along the way.  I'm going to do something similar for LIME from now on.

Since this is the first post toward this effort, I suppose it would be wise to document the state of the system as it stands right now.  I've been working on it periodically as time allows for a couple of months, and I have a pretty good start on it.  I have the main screen layout done, most of the commands accessed from the menu bar are done, the tile palette is working in a basic form (though it's untested for larger tile sets), and the editor pane can have tiles placed on it and scroll around.  The fill command fills the currently selected layer with the selected tile, the clear command erases all of the tiles from the current layer, the full map view and export features are working, some of the custom dialog boxes are done, the grid toggle works, and the context-sensitive mouse cursor is working for the functions that are implemented so far.

The LIME 4 editor screen as it appears now.  The tiles used for testing are from 2002's CTG 2 project.

Recent Accomplishments
  • Added a slide-out panel class to the engine as a built-in GUI container.  LIME 4 will use these for quick access to layer toggles.
  • Started adding support for state buttons like check boxes and radio buttons.  LIME 4 will use radio buttons to indicate which layer is selected for editing and check boxes to indicate which layers are visible.
  • Documented more of the methods in the UI package.  This doesn't directly affect LIME as a product but it is important to the future of MHFramework.

Known Issues
  • Functionality Issues
    • If the grid line display is turned on, the lines show up in the full render of the map.  The mouse cursor does too.  The full render should show just the contents of the map, and not user interface elements.
  • Usability Issues
    • The editor pane scrolls when the mouse reaches the edge of the view space, so it scrolls every time the user goes to select a tile from the palette, click on the menu bar, or open the slide-out panels.
    • There is no visible indication of where the view space is positioned in the world.  This may get disorienting when working on large maps.
  • Portability Issues
    • The Android platform layer doesn't yet have the ability to rotate the captions for the slide-out tabs.  Currently a low priority since this tool is intended to be used on a developer's PC workstation, but something that needs to be addressed eventually.

Next Steps

The priority right now is to finish the features that are critical to my current project (which I am not at liberty to discuss) so that the lead game designer and I can create levels more quickly.  Therefore, I'll divide the list of steps into categories based on that priority.
  • High Priority:
    • Test the Save and Save As commands to make sure the exported data format is unchanged from that which is read in.
    • Port the file dialog classes from the old engine into the new one.  Make appropriate updates to match the style of the new engine's user and software interfaces.
    • Finish putting tabs on the slide-out panels.  Parameterize them so their position can be specified -- top, bottom, left, or right edge of the panel.
  • Medium Priority:
    • Create a slide-out panel for the layer view controls.
    • Create a slide-out panel for the layer edit controls.
    • Decide where to put the toolbox and then put it there.
    • Add a rotate method to the MHBitmapImage interface that takes an angle of rotation and returns a copy of the image rotated by the input angle.
    • Make a decision regarding what to do about the mouse scrolling issue mentioned above.
  • Low Priority:
    • Correct the bugs in the full map render view mentioned above.
    • Implement the MHBitmapImage.rotate() method for the Android platform.
    • Following the rotate example, implement other capabilities like scaling, image filtering, color blending, and alpha composites.
    • Implement isometric modes.

Thursday, January 2, 2014

LIME 4 Data File Formats

One thing that I've had to reference repeatedly in developing LIME 4 is the file format for opening and saving map data files.  I figure that if I, the creator, can't remember it, then my users probably won't either.  Therefore, even though this information is in the API documentation, I'm going to post it here too.

Just as in previous versions of LIME, the data is separated into multiple files.  However, the content and structure of the files has changed to be more flexible and force fewer assumptions upon level designers.

Both file types are tab-delimited as specified by the constant MHMapFileInfo.MAP_FILE_DELIMITER.

The file types are as follows:

File TypeExtensionDescription
Game World Metadata.LIMESummary data required to open, initialize, modify, and save game world data in a format recognized by LIME and MHFramework.  This is the file type given to MHWorldLoader.loadGameWorld() and also the type that is opened by LIME's File | Open command.
Tile Map.LTMA file containing the data for a single tile map, which may stand alone or as a layer in a layered tile map. This is the file type given to MHWorldLoader.loadTileMap() and also the type expected in the file name properties of a .LIME file.

Game World Metadata (.LIME) File Format

  • Map width (columns) : int
  • Map height (rows) : int
  • Tile width (pixels) : int
  • Tile height (pixels) : int
  • Tile set ID : String
  • Floor map file name : String
  • Floor details file name : String
  • Wall map file name : String
  • Wall details file name : String

Tile Map (.LTM) File Format

  • Number of columns : int
  • Number of rows : int
  • Tile ID grid : int[][]

Friday, September 27, 2013

Old vs. New Tile Map Systems

After some thought experiments and pen-and-paper prototypes, I'm ready to commit to the new tile map data design for MHFramework 3. I'm content that I've found a solution that satisfies the goals of functionality, usability, performance, and supportability. Plus it will allow me to maintain the qualities that I didn't want to lose from the previous versions of LIME, and in fact, will improve upon some of them.

Differences From Previous Versions

Other than having a whole new set of layers, there are quite a few differences in the new design, involving the data structures and algorithms both.

Reversed Relationships in the Data Structure

The old system consisted of a matrix of MHMapCell objects. A map cell held an array of actors such that there was zero or one actor for each layer. So, technically, the map wasn't layered, but the map cells were.

Conceptually, the new tile map consists of two coarsely-plotted pairs of layers (a pair for floors and a pair for walls), each with a sparsely populated, semi-transparent overlay layer for adding decorations and other composite effects. The benefits to this change are countless -- performance, memory efficiency, flexibility, more intuitive optimizations, and more.

So the old system was essentially a matrix of arrays while the new system is an array of matrices.

Actors Are Not Tiles

Unlike the previous iterations, actors are not actually stored in the tile grid, but the class will still keep a list of them for rendering, collision detection, and persistence purposes.

Furthermore, although actors are no longer treated as tiles, tiles can still be actors. We can still have floor switches, teleporter pads, flowing water, blinking runway lights, and so on. The difference is that now they're stored in the actor list rather than a tile grid.  To load these things from map data files, I'll be renaming MHObjectFactory to the more specific name MHActorFactory to better reflect its true purpose.

More Sophisticated Rendering Algorithm

The new rendering process will go something like this.
  1. Lay down the section of the floor layer that is visible to the camera.
  2. If a layer of floor decals is present, apply them in a separate pass.
  3. Put all visible actors and wall tiles in a list and sort them on the y values of their base anchor points.
  4. Draw every element in the sorted list.  For each wall tile encountered, check for a decal and render it if present.

New Collision Rules and Terrain Height Variations

In the old system, collision detection was straightforward.  If the wall layer in a given map cell was occupied, then it was an obstacle. Though admirably simple and adequate for rectangular tile maps, it's insufficient for representing 2.5D phenomena like projectiles flying over tables or variations in the height of terrains. Therefore, the new collision detection logic for isometric maps needed to be much more sophisticated.

First, the relevant values are either initialized or calculated.
  • Actor climb = the maximum difference in terrain height between map cells that an actor can traverse.
  • Actor altitude = the actor's height from the ground when falling, jumping, flying, etc.
  • Actor elevation = map cell height + actor's altitude.
  • Obstacle height = height of image - base tile height.
Then, for all potential obstacles, a collision occurs when:
  1. The obstacle is a wall and the actor's short-range look-ahead vector entered its map cell OR
  2. The actor's and the obstacle's collision geometries intersect AND
  3. The actor's elevation plus its climbing ability is below the obstacle's height.


Table of Tile Map Layer Properties

One of the major goals I had for this redesign was to keep the reusability of the tile grid for essentially all tile map types, be they isometric or rectangular, top-down or side-scrolling, diamond or staggered. To this end, the layer ID constants have synonyms to help keep it simple for developers using the engine.

LayerSynonymCollidableInterlaced
FLOORBACKGROUNDNoNo
FLOOR_DECALSBACKGROUND_DECALSNoNo
WALLSFOREGROUNDYesYes
WALL_DECALSFOREGROUND_DECALSNo

Sunday, September 22, 2013

The History (and Future) of MHFramework's Layered Tile Maps

The original version of the MHFramework tile map system (circa 2004) consisted of the following layers:
  • Floors
  • Items
  • Walls
  • Ceilings
The overwhelming task of creating assets for the Beltzhian Marauders world led me to redesign the map structure to cut down on the number of raw assets that need to be created (and also reduce memory consumption in the process).  The evolved version (circa 2008) contained these layers:
  • Floors
  • Floor Decals
  • Items
  • Walls
  • Wall Decals
  • Ceilings
The lessons learned through creating various games and prototypes in the meantime has made me realize that by aggregating things together and using more sophisticated rendering and collision detection algorithms, the default layers for MHF3 might look something like this:
  • Floors
  • Floor Decals
  • Walls
  • Wall Decals
  • Actors


Wednesday, August 28, 2013

Planning for Tool Upgrades

Considering that the entire engine is being rebuilt from the ground up, it should come as no surprise that the engine tools could also use a redesign.  MHF doesn't have a lot of tools, but the few that it has are useful and worthwhile. Here's the list as it stands right now.

SpriteTester 2.0:Interactive animation viewer
LIME 3.6:Layered Isometric Map Editor
Floor Tile Transformer 1.1:Parameterized command line utility that splits rectangular textures and tile sheets into sets of isometric floor tiles.
Wall Tile Transformer 1.2:Batch utility that creates and applies shadows to a matching set of isometric walls from a single source image.

The most sophisticated of these tools is LIME, so it's the lucky recipient of the first redesign. It's also the most frequently used, as evidenced by the advanced version number relative to the other utilities.

So, What'll it Be?


I'll brainstorm a wishlist of features I'd like to see in the new LIME.  For starters, I'd like to keep certain features of the current LIME.

  • Support for diamond-rendered isometric maps.
  • Controls for independently toggling the visibility of each layer.
  • File formats that can be edited in other programs, like OpenOffice or Notepad++.
  • Full-screen view mode.
  • File browser for listing, selecting, and opening map files.

I would also like to incorporate features from the very first map editor I ever made -- the one for CTG 2.

  • Support for rectangular (non-isometric) tile maps.
  • A space-efficient tile palette that shows a large portion of the tile set with minimal scrolling.
  • A single file format for saving map data.
  • Highlight around the selected tile in the palette instead of a "Selected Tile" display.
  • An option for toggling grid lines.
  • An option for viewing tile IDs or perhaps the entire data set.
  • Menu bar with pop-up/drop-down menus to minimize the complexity of the UI and maximize the working area.

I may even want to bring in some features from the SpriteTester tools.

  • Ability to play, pause, and control the frame rate of animated tiles.
  • Ability to cycle through a set of background colors.

Finally, I'd like some new features that I have never implemented in any of the previous tools.

  • Support for staggered isometric tile maps.
  • An option for rendering an entire map to an image and saving it to a file.
  • Tile images stored in either a single tile set image or a directory whose name is the tile set name.
  • Context-sensitive mouse cursors (selected tile, tool, etc.)
  • Ability to load a background image instead of just a solid color.
  • A "play" command that drops a playable character into a map and lets you move around inside.
  • Perhaps add a zoom control to the view mode.
  • A mini-map generator showing a rectangular mini-map of the collidable areas.
  • Option for showing elevations of isometric map cells.
  • Object browser for viewing and selecting assets that may be separate from the tile set.

I'll prioritize those later, and will certainly be elaborating because, of course, I want it all.  For now, let's think about how the application flow might happen and what bits and pieces might be on the screens.