Game engine for Chicken Scheme
30 March 2020
I’ve always loved Scheme for it’s elegancy and expressiveness. But always considered it to be a toy language as it did not have any practical use for me. It seemed to academical to be practical for me.
That is until I learned about Chicken Scheme. The great thing about this implementation is that it compiles Scheme to pure C. Because of this it is possible to use any C library without effort and, with a just a little effort, C++ libraries.
In my spare time I’ve been working, one-and-of, on my own game called Grimmol. It is written purely in Chicken Scheme including the 2D game engine called Coati. I released it under a MIT license and you can find it here.
Coati is a simple to use fast 2D game programming library for Chicken Scheme. Most of the things needed in order to write a 2D game are implemented. A clean Scheme-like way to handle sound is coming but in the mean time you can use SDL mixer.
To get started using Coati make sure Chicken Scheme is installed along with the following libraries:
- sdl-base
- sdl-ttf
- opengl-glew
- gl-utils
- gl-math
- soil
- matchable
Then install the needed Chicken Eggs …
chicken-install -s sdl-base sdl-ttf opengl-glew gl-utils gl-math soil matchable
… clone and install Coati …
git clone https://github.com/pluizer/coati-2d.git
cd coati-2d
chicken-install -s
… and try out some samples …
cd examples/
csi 01.scm
csi 02.scm
The tutorial to get started can be found here.
I hope that this library can give somebody a fun introduction to the wunderful world of Scheme!
- chicken scheme
- scheme
- game development
- coati
- programming
- functional
Extremely simple blogging engine
30 March 2020
I finally decided to start my own blog…
It took me a while to get started because I wanted to have a perfectly tailored blogging engine. Options like Wordpress were of the table because I wanted my blog to remain simple and static. Jekyll would be a good option but I wasn’t all that interested in learning Ruby. Also my needs are very simple. I just need a list of articles and a navigation bar to those items. The rest I will handle with .css and optionally JavaScript. So, against better advice I decided to write my own.
The end result turned out to be, very, very simplistic. As in, brutalistic simplistic here is the entire ‘engine’:
#!/bin/bash
# all articles by creation time
articles=`ls -tU articles/*.md`
# return the title an article
function title() {
head -n 1 $1 | cut -c 3-
}
# place to header of the page
cat pre.html
# place links to articles
echo "<nav><ul>"
for filename in $articles; do
title=`title $filename`
echo " <li><a href=\"#${title// /-}\">$title</a></li>"
done;
echo "</ul></nav>"
# place articles
echo "<section>"
for filename in $articles; do
title=`title $filename`
echo "<article id=\"${title// /-}\">"
markdown $filename
echo "</article>"
done;
echo "</section>"
# place the footer of the page
cat post.html
The engine sorts all markdown files in a directory called articles converts them to html and sandwiches it between a html header and footer. That is all, the rest is handled by .css. No JavaScript is needed at the moment though I might enrich the functionality of this blog in the future with it.
This is how the markdown for one of my posts looks like:
# Demo post
04 April 2018
Hello World!
Just a demo for [this](#Extremely-simple-blogging-engine) article to show you how an post looks in markdown.
* demo
* markdown
You can find the source code to this script (and my entire blog) here on github.
Demo post
30 March 2020
Hello World!
Just a demo for this article to show you how an post looks in markdown.