Posted August 24, 2025 by screwtape
#map editor #common lisp #common lisp interface manager #McCLIM #GUI
EDIT: See the sequel / revision demo https://screwlisp.small-web.org/lispgames/trying-nicclim/
Here’s an example useage of my common lisp interface manager NicCLIM “map editor” made using McCLIM. I figure this version needed to come-out-properly before my next and next next versions. Especially with some of the spot fixes I made writing this example, I think this release is already very powerful.
Underlying record:
(NICCLIM::COM-CREATE-RECT M/FLOOR-EG 5 5 (FLOOR))
(NICCLIM::COM-CHANGE-MAP M/FLOOR-EG)
There are a bunch of hotkey actions interspersed with typing-symbol-names. The reason that I chose moving-around, picking things up, putting them down (with a bunch of keyboard accelerators) instead of focusing on clicking and painting with a mouse is that we will use output recording later.
It is meant to end up like the fantasia broomstick, not like a really-easy-to-use regular broomstick.
Later we will make daemons based on keyboard macro recording (next version, I promise). Moving around and inserting, deleting or replacing cursor values from cells is a fundamental fine-detail interactive map tool.
Underlying record:
(denoting hotkey presses).
...
(NICCLIM::COM-J)
(NICCLIM::COM-L)
(NICCLIM::SET-CUR1 STOVE)
(NICCLIM::PUSH-CUR1)
(NICCLIM::COM-H)
(NICCLIM::COM-H)
(NICCLIM::SWAP)
(NICCLIM::PUSH-CUR1)
(NICCLIM::COM-K)
(NICCLIM::SET-CUR1 TAB)
(NICCLIM::SET-CUR1 TABLE)
(NICCLIM::PUSH-CUR1)
(NICCLIM::VEC-MOV 0 -2)
(NICCLIM::JUMP 0 3)
(NICCLIM::SET-CUR1 BASIN)
(NICCLIM::PUSH-CUR1)
(NICCLIM::COM-J)
(NICCLIM::SET-CUR1 BENCH)
...
Putting a rectangle into another rectangle turned out to be a key behaviour, along with making and extracting rectangles and catenation.
To copy-the-house-to-the-right, we don’t need the left grass, so let’s extract that part of the m/grassy-house-eg. Extract-Rect is a fundamental map tool.
⬅ At this point, I made a lot of spot-improvements to this version of NicCLIM so you will notice the screenshot got different.
To make a pair of houses with only one line of grass, catenating the clipped house to the grassy house. Catenation is a fundamental map tool.
Not every problem is a rectangle problem. New rows and cells can be explicitly inserted and deleted, as seen happening here. In practice, I set the cursor and mashed the hotkey (C-M-n to add each ROAD cell to my new row). Later I’ll just delete the NIL cell. Adding and removing rows and cells is a fundamental map tool.
There’s an obvious anisotropy: That the left-right operation works on a single cell, and the up-down operation works on entire rows by their nature. I guess horizontal-cat makes up for part of the difference; maybe add a transpose operator in the future.
Especially with the spot improvements of burning less screen space, and adding the @ cursor and (x y) to the cell displays, I am very happy with our NicCLIM map editor, in particular:
The only really big problem is that the after-change redraw redraws the entire grid, and jumps to the top left of the entire grid. It should just redraw the current viewport: And in fact just redraw changed rows/cells in the viewport. Having to scroll back to the cursor after each change is a huge problem (for bigger maps), and this is also a large performance problem on old and lowpower computers like mine. The way to do this isn’t a mystery, I just didn’t write CLIM’s viewport stuff yet.
Future developments and the different people involved in trying NicCLIM map editor really warrant their own articles. I will do a companion article over on https://screwlisp.small-web.org for more of a good-old-fashioned-ai lisp view on NicCLIM and indie gamedev as the future of 70s-80s AI when I can.
See you on the Mastodon to talk about it as always. I see there’s an existing indie map editor publisher active on the Mastodon. Hopefully we can find some exciting complementary synergies.