Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Lettersong: esoteric programming magic

A topic by WizardGameDev created Mar 06, 2022 Views: 282 Replies: 7
Viewing posts 1 to 4
(6 edits) (+1)


Lettersong

You're a wizard.  You sing to the world, and it does what you say- if not always what you mean. 
But you've taken a bump to the head and forgotten how magic works.  Not to mention, you've lost all your  glyphs of magic!  Find them again, and figure out what the hell (a (a (_ 0))) means and why it boils you from the inside out, and get the hell off this island!


This is a simple little roguelike where magic is giving expressions to a strange and unhelpful LISP virtual machine.  Every keyword is one-letter, and is interpreted as either an element ('heat', 'entropy', 'light','time','life'...), a function applying to the world, or a function applying to different functions (metamagic!) based on the context.  

Features a basic heat simulation, so you can be burned by the backwash from a poorly-aimed spell!  The gif is what an absurdly overpowered 'add heat to the tile next to me' spell looks like. 

Lettersong


Submitted

Super cool idea for a roguelike, please develop this further 

Thanks, I'll do my best to!

(1 edit)



I've written a Long blog post about this, with some more pretty pictures that itch.io wouldn't let me upload.  Check it out!

I've not been as conscientious about writing updates on the game as I could have been, but at least I've made some progress!  

There's a lot to talk about.  Here's a changelog:  

---The world---  

- Added a simple heat simulation

- Walls slow heat spread

- Different materials ignite at different temperatures, and objects heat up the air around them as they burn

- Only you can cause forest fires!  

---Magic---  

- Cast spells with lisp-like syntax (the spells are executed by a full lisp VM!)

- Each glyph does different things depending on the context

- Glyph added: 'a'

  -  a represents 'adding', 'augmenting', and 'heat'.  

- Implemented relative tile targeting  

- Implemented augmentation metamagic  

- Implemented spell input history (up/down arrowkeys)

- The player has mana that regenerates over time; more powerful spells use more of it.  If you don't have enough, then the resulting spell is just weakened right now.

- If you want to heat a tile, the cost increases linearly with how much you want to heat it by and quadratically with the distance of the tile you want to heat up.  

---Game/Misc---  

- Added a basic goal- reach the centre of the island and light a tree on fire to become immortal  

- Added signs/inscriptions that the player can read (e.g. tutorial)  

- Added a mostly-hardcoded map (randomized tree/shrub placement with hardcoded buildings/walls)  

# Some words on magic  

I should probably explains the magic some more- so (SPOILERS):  

(a a X) means 'add heat to X', where X could resolve to be a tile, a garment, an enemy.  Right now the only valid value for X is a tile- the rest aren't implemented.  

As an example of how I want things to fit together, the symbol for 'light' (e.g. 'i') will be useful both for conjuring light with  

(a i X)
, "add light to X".  As light is linked to divination, in the same way that 'a' means 'add/augment' as a verb and 'heat' as a noun, 'i' will be 'divine' as a verb and 'light' as a noun.  

So (i .....)  will be the general form for divination spells.  These should be useful in their own right- for example, (i @) might return a list of all humanoids in an area, which could be passed to a different spell to target it:  

(a a (i @))  

That spell could be augmented:  

(a '(a a (car (i @))) 5)  

The outer spell augments the strength of the inner 'add heat to the first humanoid returned by (i @)', turning 'add heat' into 'add an excessive amount of heat'.

the symbols 1 to 8 represent cardinal directions, starting with 1 pointing east, 3 pointing north, and so on.  0 means no displacement.  So (a a 125) adds heat to a tile (1,1) from yourself.  

Currently ingame, the following spell works:  

(a '(a a 554) 4)  

Which strongly heats up the tile three paces west and one pace north of you.  Actually, even the following works:  

((lambda (val) (a '(a a val) 4)) 111)  

My lisp machine is strongly inspired by [sectorlisp](https://justine.lol/sectorlisp2/), and it's really cool to see lambdas and so on work right!  Now I just have to add in 'define' so you don't have to type out spells all the time!  

# Magical philosophy

I'm going full simulationist with this magic system.  The virtual machines that are spells are fully simulated, and to make things more interesting, I think the world should be, too.  

Rather than a 'bolt of fire' object being spawned, hitting an enemy, and doing some damage, there's a simulated heat system in the world and magic taps into that on the same level as the simulation itself.  

I hope this magic system will eventually give the player the feeling that they're interacting with the underlying mechanics of the world and encourage undertanding those mechanics, in a manner similar to how The Witness tries to get you to realise things about space, colour, light, sound, and so on.  

I want to add the sorts of unbalanced cost curves as I mentioned above to incentivise clever spellcrafting.  

Heating a tile right next to you by 100 degrees costs 10 mana; heating a tile 4 tiles away by 100 degrees costs 160 mana, which is much less efficient.  When I add the 'f' glyph, representing force, into the game, you'll be able to use it to e.g. throw monsters, accelerate rocks to hit things, or 'fan' the air.  

If you want to burn something 4 tiles away, it might be more efficient to heat the tile next to you and blow the hot air that way.

# The future of magic

If I make this into a full game, it'll have 13 elements (heat, light, life, entropy, and so on) and 26 symbols, where half of them are opposites to the other- 'e' would be the opposite of a, so that (e a 0) would absorb some heat from the environment.  

'e' represents heat as a noun just as much as 'a', so (a e 0) and (a a 0) do the same thing.  

26 symbols, each of which can act on all the others, would be a great undertaking...  but luckily, I don't have to add 25 different interactions for each symbol; 'a' boosts the power of a spells and adds the noun-values of symbols to places or things; that's general across all spells.  If I end up adding a spell for which increasing its power doesn't make much sense, then that's an interesting quirk of magic, I suppose!

7DRL has been hard, but interesting and fun so far- hoping to get something playable by saturday!  

(Though I've no idea how I'll port the game to windows in that time...)

Submitted

I'll definitely try this one out. I never got to like Lisp, but perhaps this game will be a good introduction :--). (You moan about Windows build — I hope that means that a Linux build will be available?)

I hope so!  Then again, I'm not making it as a way to advertise Lisp as a language- this'll be one of the less friendly lisp implementations around ;)
Yeah, I use Linux day-to-day and that's what I'm writing the game on, so I'll release a Linux build tomorrow, most likely!

Submitted

I build under Linux as well. I made sure to pick libraries that have cross-compiler support on Fedora. I did pick one that wasn't included and had to manually grab it but otherwise it has worked great.

Deleted post