Compare commits

...

2 commits

Author SHA1 Message Date
Peter Tillemans
b7adfd4846 added and tested the template
On my tuxedo laptop with a hosted guix on an Ubuntu derivative the
configure script found the host guile version which lead to loading
incompatible bytecode of the guix provided libraries. Updated the
README.
2024-05-18 00:06:36 +02:00
Peter Tillemans
23b75d36fd add dthompson game template 2024-05-17 23:49:31 +02:00
16 changed files with 210 additions and 19 deletions

2
.envrc
View file

@ -1,2 +0,0 @@
use guix

19
.gitignore vendored
View file

@ -1,9 +1,10 @@
# ---> Scheme *.go
*.ss~ /Makefile
*.ss#* /Makefile.in
.#*.ss /aclocal.m4
/autom4te.cache/
*.scm~ /build-aux/
*.scm#* /config.log
.#*.scm /config.status
/configure
/pre-inst-env

29
Makefile.am Normal file
View file

@ -0,0 +1,29 @@
GOBJECTS = $(SOURCES:%.scm=%.go)
nobase_mod_DATA = $(SOURCES)
nobase_go_DATA = $(GOBJECTS)
# Make sure source files are installed first, so that the mtime of
# installed compiled files is greater than that of installed source
# files. See
# <http://lists.gnu.org/archive/html/guile-devel/2010-07/msg00125.html>
# for details.
guile_install_go_files = install-nobase_goDATA
$(guile_install_go_files): install-nobase_modDATA
CLEANFILES = $(GOBJECTS)
GUILE_WARNINGS = -Wunbound-variable -Warity-mismatch -Wformat
SUFFIXES = .scm .go
.scm.go:
$(AM_V_GEN)$(top_builddir)/pre-inst-env $(GUILE_TOOLS) compile $(GUILE_WARNINGS) -o "$@" "$<"
moddir=$(prefix)/share/guile/site/$(GUILE_EFFECTIVE_VERSION)
godir=$(libdir)/guile/$(GUILE_EFFECTIVE_VERSION)/site-ccache
SOURCES = \
game/main.scm
EXTRA_DIST = \
$(SOURCES) \
assets/images/chickadee.png \
COPYING \
README.md

View file

@ -1,3 +1,63 @@
# bloatrunner # Chickadee Game Template
Small loderunner clone for the 2024 game jam This repository provides a template to use as a starting point for
making a new game using
[Chickadee](https://dthompson.us/projects/chickadee.html)! It
includes all the autotools boilerplate so you don't have to worry
about that nonsense too much.
## Using Guix
We *highly recommend* using [Guix](https://guix.gnu.org/) to manage
your development environment. Once Guix is installed, getting all of
the dependencies you need to develop is *easy*. Just run `guix shell`
from the root directory of this repository and you'll be good to go!
## Building from source
Assuming Guile and Chickadee are installed on your system, a fresh
project can be built like so:
```
./boostrap.sh
./configure
make -j$(nproc)
```
After the build system is initialized, only `make` needs to be run to
recompile the Scheme modules.
Note: On hosted guix the configure script might find the host guile version
instead of the guix provided one. This can lead to incompatible bytecode errors.
To force to use a consistent guile use
```
./configure GUILE=$(which guile)
```
to ensure the right version is configured.
## Running the game
To run the game from the source checkout, use the `pre-inst-env` wrapper script:
```
./pre-inst-env run-game
```
## REPL-driven development
After the game is launched, a Guile REPL server will be running on
port 37146. We recommend using the
[Geiser](https://geiser.nongnu.org/) Emacs extension for connecting to
it using `M-x connect-to-guile`. Once Geiser connects to the REPL,
the game can be modified while it runs!
## Bundling
If you are setup to produce redistributable bundles of Chickadee games
(see
https://dthompson.us/manuals/chickadee/Invoking-chickadee-bundle.html),
then you can use `chickadee bundle` to produce binary release bundles.
This is admittedly an area where things really do not "just work" as
they should, so do reach out for help if you need it.

BIN
assets/images/chickadee.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 755 B

View file

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View file

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View file

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 59 KiB

3
bootstrap.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
exec autoreconf -vif

4
bundle.scm Normal file
View file

@ -0,0 +1,4 @@
'((asset-directories . ("assets/images"))
(bundle-name . "chickadee-game-template-0.1.0-x86_64")
(code . "game/main.scm")
(launcher-name . "chickadee-game-template"))

18
configure.ac Normal file
View file

@ -0,0 +1,18 @@
dnl -*- Autoconf -*-
AC_INIT(chickadee-game-template, 0.1.0)
AC_CONFIG_SRCDIR(game)
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([foreign -Woverride -Wno-portability])
AM_SILENT_RULES([yes])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([pre-inst-env], [chmod +x pre-inst-env])
AC_CONFIG_FILES([scripts/run-game], [chmod +x scripts/run-game])
GUILE_PKG([3.0])
GUILE_PROGS
GUILE_MODULE_REQUIRED([chickadee])
AC_OUTPUT

38
game/main.scm Normal file
View file

@ -0,0 +1,38 @@
;;; Licensed under the Apache License, Version 2.0 (the "License");
;;; you may not use this file except in compliance with the License.
;;; You may obtain a copy of the License at
;;;
;;; http://www.apache.org/licenses/LICENSE-2.0
;;;
;;; Unless required by applicable law or agreed to in writing, software
;;; distributed under the License is distributed on an "AS IS" BASIS,
;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;;; See the License for the specific language governing permissions and
;;; limitations under the License.
(define-module (game main)
#:use-module (chickadee)
#:use-module (chickadee math vector)
#:use-module (chickadee graphics sprite)
#:use-module (chickadee graphics texture)
#:use-module (system repl coop-server)
#:export (launch-game))
(define sprite-position (vec2 256.0 176.0))
(define sprite-texture #f)
(define repl #f)
(define (load)
(set! sprite-texture (load-image "assets/images/chickadee.png"))
(set! repl (spawn-coop-repl-server)))
(define (update _dt)
(poll-coop-repl-server repl))
(define (draw _alpha)
(draw-sprite sprite-texture sprite-position))
(define (launch-game args)
(run-game #:load load
#:update update
#:draw draw))

29
guix.scm Normal file
View file

@ -0,0 +1,29 @@
(use-modules (guix packages)
((guix licenses) #:prefix license:)
(guix download)
(guix git)
(guix build-system gnu)
(guix utils)
(gnu packages)
(gnu packages autotools)
(gnu packages guile)
(gnu packages game-development)
(gnu packages pkg-config))
(package
(name "chickadee-game-template")
(version "0.1.0-git")
(source (git-checkout (url (dirname (current-filename)))))
(build-system gnu-build-system)
(arguments
'(#:make-flags '("GUILE_AUTO_COMPILE=0")))
(native-inputs
(list autoconf automake pkg-config))
(inputs
(list guile-3.0))
(propagated-inputs
(list guile-chickadee))
(synopsis "Chickadee game template")
(description "This is an example package for a Chickadee game.")
(home-page "https://dthompson.us/projects/chickadee.html")
(license license:asl2.0))

View file

@ -1,6 +0,0 @@
;; What follows is a "manifest" equivalent to the command line you gave.
;; You can store it in a file that you may then pass to any 'guix' command
;; that accepts a '--manifest' (or '-m') option.
(specifications->manifest
(list "guile-chickadee"))

10
pre-inst-env.in Normal file
View file

@ -0,0 +1,10 @@
#!/bin/sh
abs_top_srcdir="`cd "@abs_top_srcdir@" > /dev/null; pwd`"
abs_top_builddir="`cd "@abs_top_builddir@" > /dev/null; pwd`"
export GUILE_LOAD_COMPILED_PATH="$abs_top_builddir${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH"
export GUILE_LOAD_PATH="$abs_top_builddir:$abs_top_srcdir${GUILE_LOAD_PATH:+:}:$GUILE_LOAD_PATH"
export PATH="$abs_top_builddir/scripts:$PATH"
exec "$@"

7
scripts/run-game.in Normal file
View file

@ -0,0 +1,7 @@
#!@GUILE@ \
--no-auto-compile -e main -s
!#
(use-modules (game main))
(define* (main #:optional (args (command-line)))
(launch-game args))