Using Tiled Map Editor


After remaking the game, I decided to try creating some new maps for the release, notably to fully utilize the new features such as portals, fruit, and multiple grids (layers/floors).

For the (few) new maps, found in the folder assets/maps/neo included with the game, I decided to turn away from my trusty text editor and try a point-and-clicker instead.

Hello?

I thought about making a map editor, but decided it wasn’t worth the effort at that time, as I already sunk a lot of dev time into the game and just wanted to get it out there and be done. (In the future, I might make a web map editor for it using Flutter though.)

Surfing the web, I stumbled upon the (free) Tiled Map Editor. Using Piskel, I quickly made a (super) crappy tileset for it. In fact, it’s included with the game! Grab it from assets/images/ekotiles.png.

Next, I added it to Tiled Map Editor and got to drawing!

Yeah, bwoi!

Let’s check it out in action:

Tiled Map Editor

Finally, after drawing a map, I needed a way to convert it to my map file format. To do this, I exported the map as a .csv file and whipped up a Ruby script named convert_csv_to_map.rb:

# encoding: UTF-8
# frozen_string_literal: true

require 'csv'

file = ARGV[0].to_s.strip

abort 'No CSV file specified.' if file.empty? || !File.file?(file)

result = ''.dup

CSV.open(file,'rt',encoding: 'BOM|UTF-8:UTF-8') do |csv|
  csv.each do |row|
    if row.all? { |cell| cell == '-1' }
      result << "\n"
      next
    end

    # Floors:         w *
    # Walls:        # W x
    # Ghost Walls:  % +
    # Player:       ^ v > <
    # Things:       @ : $ &
    # Portals:      0 1 2 3 4 5 6 7 8 9
    # Robots:       = ! | ? Q
    row = row.map do |cell|
      case cell.strip
      when  '0' then ' '
      when  '1' then 'w'
      when  '2' then '*'

      when '10' then '#'
      when '11' then 'W'
      when '12' then 'x'

      when '20' then '%'
      when '21' then '+'

      when '30' then '^'
      when '31' then 'v'
      when '32' then '>'
      when '33' then '<'

      when '40' then '@'
      when '41' then ':'
      when '42' then '$'
      when '43' then '&'

      when '50' then '0'
      when '51' then '1'
      when '52' then '2'
      when '53' then '3'
      when '54' then '4'
      when '55' then '5'
      when '56' then '6'
      when '57' then '7'
      when '58' then '8'
      when '59' then '9'

      when '60' then '='
      when '61' then '!'
      when '62' then '|'
      when '63' then '?'
      when '64' then 'Q'

      else ' '
      end
    end

    result << row.join.rstrip << "\n"
  end
end

puts result.rstrip

And to run it:

ruby convert_csv_to_map.rb pac-man.csv

And voila! I had some new maps.

Currently, there are only 3 Neo maps, but I had planned for about 7. Why only 3? It took a while to make each map and felt a bit tedious. I just wanted to get the game out and start working on other projects haha. In a future devlog, maybe I’ll talk about those other planned maps.

Besides the 3 Neo maps, there are also 8 Classic maps that I made back in 2004. However, I changed them slightly to include portals and to be a tad easier (they were super hard), but to edit them, I just used my text editor.

If you’re interested in trying your hand at also making some (crappy) maps, check out the game here.

Namaste!

Get EkoScape

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.