Counterfeit Monkey on Github

Counterfeit Monkey is now on Github! I just made my biggest commit ever: 352759 lines! (Most of which I just realised is the list of Scrabble words.)

Please start reporting any bugs you find in the game at the issue tracker.

If you would be interested in helping to port the game to 6M62 and starting fixing some of the outstanding bugs, then it would be great to have your help!

Github has a wiki - would anyone think that it could be useful to use as a community-editable place for hints?

Keen. Thanks for taking this on, and Emily for permitting it.

I’d be interested in a wiki for hints and so forth. But I thought the game had good internal hints? Either way, it’s maybe good to have another layer of clues. Part of me wants to write HTML style invisiclues for it.

It’s exciting to see the source released on GitHub in any case.

Has anyone run into this problem? All of the initial appearance shorthand code (when you put a text in quotes immediately after an object definition) are broken with the following error (four times!):

Which doesn’t make much sense because it’s only one sentence…

It’s really easy to fix, just add “the initial appearance is” before the broken code, but it’s especially annoying because it only reports one object at a time.

Any ideas?

You could maybe try this, which might give extra results but it’s better than the alternative.

grep -i "\. +\" | grep -iv "^\t"

e.g. search for period, then space/spaces, then quotes, but not in a tab-indented line.

I just noticed that the errors are getting reported in reverse order. I wonder if somewhere near the top it’s trying to assign an initial appearance to a kind, setting the default, and then causing a contradiction? Still weird though.

aschultz, unfortunately lots of the problem lines start with tabs haha. That is a decent idea though - I can regex search using notepad++.

After fixing all the initial appearances, the room descriptions started having the same problem. Now it’s a plain object definition, and I don’t know how to fix it.

I wonder if it would be more tractable to chop the game into a number of extensions and port each one to 6M62 independently, constrained only by their dependencies. That structure could also help reduce git conflicts compared with everyone editing a single file.

I appreciate your effort to upgrade the dependencies. I briefly tried to help with that, but I realized you were doing all the same things as I was as I was going along! As an alternative to that, I thought I’d try the route of leaving the code as it is, compiling it using its original dependencies, and making minimal fixes.

I installed Inform 7 version 6G60, I checked out the initial commit of the repo (before the 6M62 migration attempt), and I installed all the extensions found there. (I had to fiddle with CM Automatic Drawers by Emily Short to get it to install, since it calls itself Automatic Drawers internally.)

It looks there are at least a couple of files missing:

  • Room Description Control by Emily Short (which is included by Tailored Room Description by Emily Short)
  • Assorted Text Generation by Emily Short (which is included by CM Automatic Drawers by Emily Short)

It seems like the IDE automatically installs versions of these, but the versions it gets are newer than it is, using features the compiler can’t handle.

If Emily gave you contemporary versions of these extensions, could you add them to the repo, maybe on a different branch?

It could perhaps help? Ideally that’s what I’d prefer it to end up as. (Kerkerkruip was much more manageable that way.) But to do that you’d need to know the codebase really well, and I think Emily is the only one who does at the moment, and she doesn’t have the time, which is what started all this.

I also suspect that it’s quite integrated. I’m not sure how compartmentalisable it will be.

The versions of those two extensions in the repo are the 6G60 versions already.

Btw, I suspect I won’t have time to work on this until next weekend (if I even have any then.) If anyone would like commit access to the repo, just let me know. My way of going straight for 6M62 might not be the best, so there could be other approaches to it, and you’re welcome to try anything! We can always go back to an old commit. :slight_smile:

Ah, thanks. You only added those to the repo as part of your “6M62 compatibility: initial easy changes” commit, so I couldn’t be sure.

When I install them and try to build, I get an error:

Was the [regarding …] phrase added to Inform 7 later on, in 6L02? It looks like this version of Assorted Text Generation is trying to use it. Are you sure this is the version you received from Emily?

That line isn’t in the version I uploaded to Github, you must have the one from the Public Library.

Ahh, you’re right! I copied the wrong version of the file somehow. I’ve got it building now.

I don’t know if I’m going to be able to focus much this week either. I might like to have commit rights, but for now I’ll just work with my own fork of the project until I have something to show for it.

I’ve created a branch ( … 6G60-build) which builds under 6G60.

(Added the two extensions that Dannii found, renamed “CM Automated Drawers” to “Automated Drawers”, and renamed the “Counterfeit Monkey.materials” folder to “Counterfeit Monkey Materials”.)

I did a quick profiling run. Two runs, in fact – one for just the game initialization, and one that includes some running around. … 3dfbb42f17

These runs are the 6G60 build. I annotated the generated I6 calls with what they do.

What we see: 5.7 seconds of startup time. Most of the time is spent in the “caching thread position information rule” and the “initialize hash codes rule”. No surprise there. It’s a lot of relation-testing. Also we spend a solid 1.25 seconds on the task of converting text object names to indexed text for the “initialize hash codes rule”.

I haven’t looked at the I7 code, so I don’t know if this is something which can be optimized or pre-computed. Maybe it’s cheaper in 6M62 (due to indexed text unification).

I’m more interested in the second run. 5.7 seconds for launch is annoying, but spending 10 seconds processing three moves and four LOOKs is a real drag.

There’s 2.5 seconds on “sanity-check stage rule”. This turns out to be spent entirely on “room-restriction rule for a southern room” – not because the body of that rule is expensive, but because deciding whether a room is “southern” is a map-route test! By far the simplest optimization would be to change “southern” to a boolean attribute and manually set it on rooms in that part of the map.

Beyond that, there’s general problems with LOOK being slow in a game with a lot of things. (CM has 2150 things.)

For LOOK, could you make a list per room of items in it, and have DROP and TAKE modify that list?

A room is already a list of items in that room. The slow part is the way I7 handles that list, with the Table of Locale Priorities.

Out of curiosity, will you excellent people keep releasing versions as bugs get fixed, like the infamous “Shall we pretend we didn’t do that” bug?

I think that we should revert this feature and release a new version asap. The hint thread suggests that it’s damaging an otherwise great experience for many new players. We can reintroduce it in a later release when the issue’s resolved.