andybalaam / rabbit-escape

Android and PC game inspired by Lemmings and Pingus
http://artificialworlds.net/rabbit-escape
GNU General Public License v2.0
76 stars 46 forks source link

Level names in menu items #205

Open colonelfazackerley opened 8 years ago

colonelfazackerley commented 8 years ago

I was looking at implementing this item from TODO.md. Options, with my favourite first;

  1. expand ls.txt to hold the level name (from the :name key in the file) as well as the filename. A makefile target will then fill this in.
  2. When the menu is made up in java open each file to read from :name.
andybalaam commented 8 years ago

I much prefer 1, except that I am considering making ls.txt manually-written, so that level files can be just named after the level.

Do you think your innovation of naming levels 02_Level_name.rel is good enough? I'd prefer to avoid loads of renames when we're re-ordering levels, but maybe I should put up with it.

colonelfazackerley commented 8 years ago

I am not a big fan of having to set something twice. eg '01_Bob.rel' has to contain ':name=Bob' too.

We could abolish ':name=' altogether and just use the filename.

I like names in filenames. Swapping order is easier:

git mv 01_Bob.rel 04_Bob.rel
git mv 04_Susan.rel 01_Susan.rel

compared to

git mv Level_01.rel tmp.rel
git mv Level_04.rel Level_01.rel
git mv tmp.rel Level_04.rel

If we do just use filenames, we could have '-' in the name changing to a space. Perhaps use a double '--' if we want a hyphen in a filename.

handcrafting ls.txt sounds unnecessarily onerous.

andybalaam commented 8 years ago

handcrafting ls.txt sounds unnecessarily onerous.

Yes. I thought it would be good for assembling level sets from a general pool of levels, but I think it just makes life more difficult.

andybalaam commented 8 years ago

I like names in filenames

Definitely.

andybalaam commented 8 years ago

I am not a big fan of having to set something twice. eg '01_Bob.rel' has to contain ':name=Bob' too.

What if we wrote a test that checks the 2 are consistent?

andybalaam commented 8 years ago

We could abolish ':name=' altogether and just use the filename.

I feel like that is going to cause us pain. Filenames have different constraints on different platforms, and we may want exciting names containing emojis or something the young people use.

andybalaam commented 8 years ago

So, in conclusion, if ls.txt is going to stay, we can automatically add the name into it during make.

andybalaam commented 8 years ago
$ cd rabbit-escape/rabbit-escape-engine/src/rabbitescape/levels/easy
$ egrep '^:name=' *.rel | sed 's/^\([^:]*\)::name=\(.*\)/\1 \2/'
level_01.rel Digging practice
level_02.rel Bashing practice
level_03.rel Build your way out
level_04.rel Block before you drop
level_05.rel Get down
level_06.rel Come together
level_07.rel Get in the burrow
level_08.rel Dig quick
level_09.rel Climbing practice
level_10.rel Cliff face
level_11.rel You wait here
level_12.rel Across the void
level_13.rel Give us a leg up
level_14.rel Three strikes
level_15.rel Keep it simple
level_16.rel The Lone Bridger
level_17.rel Go on without us
level_18.rel Face the right way
level_19.rel Saw tooth
level_20.rel To the top
andybalaam commented 8 years ago

I'm pretty sure you can do it with just sed (not egrep).

andybalaam commented 8 years ago

If we do this (and my anti-Ant manglings) we'd need to add a (developer) dependency on sed, but I think we are considering developer dependencies a free-for-all if they are apt-get installable on Ubuntu/Debian.

colonelfazackerley commented 8 years ago

So, we expand ls.txt to contain filename and level name. I agree this is OK as long as we test they are the same (or similar if there are funny chars in the level name).

We are quite far down the path of having to use linux for dev, so I think it's not much of a step to require sed, egrep, etc.

getting sed/egrep for win through mingw isnt too troublesome compared to make.

andybalaam commented 8 years ago

Good to know.

andybalaam commented 8 years ago

I just noticed you propose above to enforce file names to be similar to level names. That sounds sensible - I propose allowing (but not enforcing for dev levels?) a leading number, and requiring the rest of the file name to be the canonical name as defined by ByNameConfigBasedLevelsCompleted.canonicalName.

colonelfazackerley commented 8 years ago

Sounds good.

That method name is rather long.

colonelfazackerley commented 8 years ago

Sorry, class name.

andybalaam commented 8 years ago

Actually the method name is rather long and the class name is unforgiveable.

andybalaam commented 8 years ago

As soon as we've got #258 sorted let's give it a simpler name.