New to PunyInform and Inform6

Have you followed the tutorial on the PunyInform home page?

There are also many PunyInform games for which the source code is available: Search for Games

I believe Garry has published the source code of all his PunyInform games.

2 Likes

There’s a good list of resources on the PunyInform GitHub page. From memory, @fredrik’s tutorials are quite good for beginners.

@otistdog has prepared an excellent list of documentation. Most of this is relevant to PunyInform, albeit with some modifications.

That’s true. The techniques you were asking about are in one or more of my games. You can download them or play them online at my itch.io site. You can find the source code, maps and solutions at my GitHub repository.

1 Like

Hello Fredrik, Hello Garry,

Thank you both for the tips and recommendations. I will look at it all over the weekend and will certainly be able to use it. And if I have any further questions, I can look for and get help here.

Thomas

1 Like

Hello Gary,

in your description you did not add:

update_moved = true;

Is it always necessary to add this, when an Object ist moved?

Thomas

1 Like

You only have to set update_moved when moving something to the player’s inventory.

If you use PunyInform’s OPTIONAL_MANUAL_SCOPE and you do something that affects the scope of one or more objects, then you are responsible for notifying the program that the scope has changed using scope_modified = true so that it will redetermine the scope of all objects. This is intended to save execution time on old 8-bit micros.

If you don’t use OPTIONAL_MANUAL_SCOPE, then PunyInform does all the scope determinations regardless.

I believe PunyInform has changed over time and it is now much more efficient at determining changes in scope, so OPTIONAL_MANUAL_SCOPE is no longer needed. At any rate, I don’t use it, so I don’t think I need scope_modified = true. (Correct me if I’m wrong @fredrik.)

It’s true that you don’t have to care about setting scope_modified when moving things around, unless you’ve defined OPTIONAL_MANUAL_SCOPE. Exception: When defining your own action routines, you have to set scope_modifed= true` when the action routine may have changed what’s in scope. This is because when an action routine is called, the library has no way of knowing it’s user defined.

While a lot of parts of PunyInform has become more efficient, and figuring out exactly what’s in scope may be a bit faster now than in the early versions, the basic principle hasn’t changed - whenever the library calls user defined code, like a before routine, or some entry point routine, it has to assume that the code may have moved things around, so the cached copy of what’s in scope becomes invalid. This doesn’t mean that scope is recalculated immediately, but the next time we need to know what’s in scope, it has to be calculated.

If you define OPTIONAL_MANUAL_SCOPE, this all changes. You promise to tell the library whenever the cached scope becomes invalid, and the library doesn’t have to assume anything.

How much of a difference it makes depends on the game. If the player rarely sees more than say five objects at a time, scope calculation is quick. If, on the other hand, the player drags around an inventory of 30 objects, and then there are 10-20 more static and scenery objects in a location, the scope calculation becomes very tedious on a typical 8-bit machine.

I find it very simple to adapt a game to start using OPTIONAL_MANUAL_SCOPE, so there’s very little reason not do so:

  • Open your source code in a text editor.
  • Search for move. Whenever you use move or remove, set scope_modified = true.
  • Then search for give. Whenever you set or clear any of the attributes open, transparent or light, set scope_modified = true.
  • That’s it. I’d be surprised if it takes you more than ten minutes.
4 Likes