GameLISP banner

GameLISP

10 devlogs
21h 23m 20s

A tiny LISP you can use to make simple games on the web!

GameLISP is Similar to libraries like Processing and P5.js, but totally on the web and with a custom programming language, framework, and VM written from scratch in pure JavaScript!

Loading README...

Pedro B.

Shipped this project!

Hours: 21.39
Cookies: 🍪 450
Multiplier: 21.04 cookies/hr

GameLISP is (mostly) done!

Was nice to learn more about stack-based virtual machines, lexers, and parsing… I’m also even more fascinated by lisps now—elegant little things, and so easy to work with, too! I’m proud of the VM the most, but the little Environment system I cooked up is sort of elegant too…

Hope people enjoy, uh, Pong, just as much as I enjoyed programming everything around it :-P

Pedro B.

Done with Pong, so I declare that I’m done with my MVP!

There’s still a lot I’d like to improve, such as adding documentation and making it, y’know, pretty, but I suck at CSS and I’d like to use the documentation generator I’m writing to document this. so those will have to wait. I think this will make a good ship, though: A fully featured programming language and game framework, with a cool game bundled in!!

Now, watch in awe as I totally own my own creation in my own creation! (that’s an awkward sentence…)

0
Pedro B.

Did mostly internal changes.

In more devloggable news, Pong is on its way to feature completeness! You can currently “win” and “lose,” though, since you control both paddles, it does not really mean anything. Also, “winning” or “losing” looks a lot like freezing the game. That’s because “winning” or “losing” freezes the game. I’ll add a text drawing function next for the score counters and the big “YOU WIN” or “YOU LOSE” end text, which will finally make this a Real Game in a Real Language.

Also, I added an example selector and a credits button, really only for the fonts used (IBM Plex Mono ftw,) though the credits button does not work yet.

0
Pedro B.

Logic is in place for Pong, and the built-in update and draw callbacks have been implemented!

Performance is very much awful, however, which is to be expected, as I had been more concerned with getting functionality in up to now. I’ll now be mostly busy with profiling and trying to get the VM to run at a reasonable speed (the hard part, since this is all done in JavaScript…)

Please, wish me luck.

(P.S: a fun thing: the callbacks are implemented as a hidden bit of code tacked on to the end of the user’s source code, as you can see in the second picture. I thought that was funny.)

Attachment
0
Pedro B.

I CAN WRITE PONG IN MY PROGRAMMING LANGUAGE + GAME FRAMEWORK NOW!

I still have to improve a lot (namely, add PICO-8/Processing/P5.js style init, update and draw functions to fix flicker) but look at this! Simple games can be written using GameLISP!!!

In the next devlog, I hope to add functions, and then, write a full version of Pong, which should help me notice missing features, bugs, etc.

(NOTE: the first video is from an earlier devlog from when my project was bugged out…)

1

Comments

Cheetah
Cheetah about 1 month ago

Cool!

Pedro B.

Improved function parsing, and started work on documentation! Docs will be generated from a Markdown file using a tiny little python script. A smarter cook would turn that into a separate project to farm cookies, but I have… scruples… and won’t…

… Hey, I just had a great idea!

Attachment
Attachment
Attachment
0
Pedro B.

Functions work now! Yay!

Attachment
0
Pedro B.

Implemented opcodes, and made the VM stack-based!

Previously, the plan was just parsing tokens and evaluating them, but:

  1. It would make the eventual implementation of functions much more annoying
  2. Re-interpreting the tokens would be much slower than running opcodes
  3. …I kinda just wanted to do opcodes
Attachment
Attachment
0
Pedro B.

The VM is better now (still can’t see it,) lots of types stuff were worked on (also intangible,) and “let” statements are in (that is, variable declaration! See below for visual proof!) This involved creating a little environment (“Env”) system.

An Env is just a Map which maps identifiers to values. The evaluator keeps a stack of these (currently arbitrarily capped to 256 Envs,) that, when we need to set or get a variable, is traversed to find it. The global Env contains stuff like types, global functions, etc., and sits on the bottom of the stack. As, for example, functions get called, Envs get pushed in, acting like local scopes, and popped out when no longer needed… it’s pretty nice.

Attachment
0
Pedro B.

Worked a bit on the frontend! Also did some backend stuff, such as some light tweaks to the evaluator and initial implementation of the VM, but you can’t see that…

…what? No, I mean, like, literally you can’t see it. It’s just code.

Attachment
0
Pedro B.

I have the basic lexer (source code to tokens converter,) as well as the basic skeleton for the expression evaluator working!

I have also written a fairly comprehensive spec, which should expedite development (normally I just freestyle things…)

Attachment
0