screwlisp proposes kittens

Devlog 0 Actual game lispgamejam using my NicCLIM! Making, composing and peeking at symbolic maps

Reuseable bits (an eev ToC):

;; make a map
# «.§»	(to "§")
;; take peek at a map
# «.†»	(to "†")
;; put map inside another map in a new map
# «.‥»	(to "‡")

Intro

In the past, I have focused on producing some kind of technical demonstration when lispgamejams have rolled around. Contrarywise this autumnal lispgames lispgamejam, My intent is to sub-jam one cogent and rich game in the first day, and then idle the next ten days picking at additional technological niceties.

STILL WIP: Furthermore, I will toot code this entire gamejam as an exploration for branching and multifaceted fediverse programming game authorship. Tootcoding (codetooting? I forgot) is my mastodon tag for threads of evaluable mastodon toots.

Hopefully the fediversal mix-and-match programming game creation might allow people to spin off additional lispgamejam submissions of their own.

If you were following before, my NicCLIM lets me instantaneously make s-expression files interpreted as GUI maps of graphical or textual tiles, including macro and lisp defined game source. Let us make a couple forthwith. NicCLIM has functionality for macroing doors which will let us walk off the edge of one map, and onto the edge of an adjacent map (I think; well it is Turing complete several ways).

Initial setup toot

Of course I am using embeddable common lisp, McCLIM common lisp interface manager 2 spec implementation (via my own NicCLIM “map editor”, Eduardo’s eev, slime and emacs. I basically always do this. I am just copying from whatever article with NicCLIM is easy to eww to recently.

‱ (setq inferior-lisp-program "ecl")
‱ (setq eepitch-buffer-name "*slime-repl ECL*")
‱ (slime)
(ql:Quickload :McCLIM)
(compile-file "~/Downloads/nicclim.lisp" :load t)
(in-package :nic)

oh, I see. I set up a ~/GAME/ directory and switch to it as well.

(string '~/game)
(ensure-directories-exist *)
(uiop:chdir (string '~/game/))
(uiop:chdir (string '~/game/)) ;; Twice, for some reason.

Forest map

(rect-file 'tree.map 12 8 '(tree))
(enclose-map 'tree.map)

I chose the map-layout option from the layouts menu.

AT THIS POINT, SEVERAL DAYS OF INACTIVITY SUDDENLY PASS

But I was reinvigorated by Kepeken on the Mastodon.

NicCLIM Almost Does Everything Already

Remembering that NicCLIM is basically just this bog standard common lisp interface manager 2 table example https://www.lispworks.com/documentation/lwu41/climuser/GUID_281.HTM#HEADING281-0 and some spreadsheet-like behaviours.

However I am commited to using general purpose NicCLIM snippets I hope other people will then fork from this jam for other, better conceived jam submissions that in some sense I contributed to.

I guess I want these behaviours which are trivial to implement:

  1. Make a map, as above
  2. Fill in subrectangles of a map with another map
  3. Pop up some pictures and dialog using CLIM’s accepting-values
  4. Use a door in the map to enter another map

I am particularly going to use the lisp REPL’s * ** *** / // /// to curry [] values into my expressions in order to reuse them. Well, that is the supposition.

Making a map more generically

I will say (to "§") meaning to run this apply line here. (This is an eev thing). In eev you would press M-e to follow these between each other.

«§» (to “.§”)

Mastodon toot: https://gamerplus.org/@screwlisp/115476875141207449

;; 1. 'name-for-map (file) should be a symbol ; consider 'tree.map which will be `~/GAME/TREE.MAP`
;; 2. '(width height) of this map
;; 3. '(cell contents)
(apply 'rect-file *** (append ** (list *)))

Grass clearing

'grass-clearing.map
'(12 8)
'(grass)
;; (to "§")

Peek at that.

'grass-clearing.map

Let’s say (to “†”)

«†» (to “.†”)

Mastodon toot: https://gamerplus.org/@screwlisp/115476882368216801

(enclose-map *)

Rocky underground

just while we are here.

'solid-rock.map
'(12 8)
'(solid rock)
;; (to "§")

We can see the default contents can have multiple items; there might be some graphical convention for SOLID such that it can be attached to rock to denote impassable rock, in contrast to simply an interesting rock sitting on the ground one could stand on.

'solid-rock.map
;; (to "†")

Rock cavern

'rock-cavern.map
'(12 8)
'(rock cavern)
;; (to "§")

Put map into other map

Argh, for some reason the signature for clobber-rect is (outside-sym inside-sym new-sym y1 y2 x1 x2) please expect this to be changed in the future.

The evolution of clobber-rect so far has been that its first three arguements are (outside-file inside-file new-file) in symbols (so it is not clobbering
) and its last four arguements are (y-start y-stop x-start x-stop) - and it always starts in the top left of the inside-sym file (symbol). There is a separate extract-rect function you would use to pull a subrectangle out of another map. This is just how it ended up working so far.

Let’s say (to “‡”)

«‥» (to “.‡”)

Mastodon toot: https://gamerplus.org/@screwlisp/115476901608166443

(append ** *)
(apply 'clobber-rect *)

So for example

'(solid-rock.map rock-cavern.map mountain-cave.map)
'(1 3 2 4) ; argh y1 y2 x1 x2
(to "‡")

take a peek

'mountain-cave.map
;; (to "†")

Actually, I think we should stop here to maintain the article’s purity of essence.

Edit: Recapitulation

So for making these zones; forest, grass, rock, a mountain with a cave

The game programming as such continuously and in one place was:

;; Make map:
'grass-clearing.map
'(12 8)
'(grass)
;; (to "§")

;;peek:
'grass-clearing.map
;; (to «†»)

'solid-rock.map
'(12 8)
'(solid rock)
;; (to "§")

'solid-rock.map
;; (to "†")

'rock-cavern.map
'(12 8)
'(rock cavern)
;; (to "§")

'(solid-rock.map rock-cavern.map mountain-cave.map)
'(1 3 2 4) ; argh y1 y2 x1 x2
;; (to "‡")

'mountain-cave.map
;; (to "†")

done in the lisp repl. (after running the eev anchor lines, I continued in this code block).

Conclusions

Basically I have achieved informally replacing functions with gotos. I guess Dijkstra is rolling in his grave (halloween themed
!).

I desired this because I want myself (and you) to see we are explicitly reusing a heading we can just flick back to (however you are browsing it - eww in emacs with eev works for me), rather than call-an-opaque-function. In my theory adding a named function for interactive code reuse seems to increase the programming burden. Maybe my memory is not as good as Dijkstra’s.

Repeating my goals

  1. Make a map, as above ✓
  2. Fill in subrectangles of a map with another map ✓
  3. Pop up some pictures and dialog using CLIM’s accepting-values
  4. Use a door in the map to enter another map

We knocked out the first two; it occurred to me we should see that map symbols having a :bitmap property will render images in a hopefully-transparent-background stack so I have appended that goal. If I make these images hexagons, hopefully I stop getting these helpful messages saying “hey, I don’t think your columns are aligning properly”.

We made a cave in a mountain. I guess we could put that grass in the forest for a forest clearing as well.

So we have multiple, complex (in that the contents are not homogeneous) zones.

Then dialog/game events and moving between zones, and all the rest of the jam will be attempting to write a game story.

Actually, all the rectangle functions which I am using here from-the-repl are “available inside the map” as well, but I guess that REPLs are warm and familiar and NicCLIM is a dangerously nouveau basically spreadsheeting program.

Fin.

Join me on the Mastodon thread for this article; I guess I will begin my tootcoding adventure there.

screwlisp proposes kittens