SAF: Minimalist "Fantasy Console" + Games

SAF: Minimalist "Fantasy Console" + Games

Postby drummyfish » 21 Oct 2021, 18:18

Hello, I've just kinda bumped one of my projects to 1.0ish version so let me share it:

SAF: Minimal abstract interface for simple games

https://codeberg.org/drummyfish/SAF

Image Image Image Image Image

Image

SAF (SmallAbstractFish) wants to provide you with a distilled joy of simple nostalgic game programming with as little friction and frustration as possible (no complicated APIs, no bloat, no legal conditions, ...), while also supporting creation of ethical games that can run even on very simple devices, games that people can easily study, share and improve without frustration or fear, games that will survive forever, games that are here for you and not any corporation's profit. SAF follows and promotes the philosophy of peace, social anarchy, free software and mainly of "less is more", which is related to technology minimalism, suckless, Unix and KISS philosophies. SAF is taking a step back to the times at which technology was still sane, so that we can step forward in a new, better direction.

It's all CC0, public domain of course! No conditions, just take it, use it, improve it, sell it, ...

Basically it's a tiny engine, a library, you can also see it as a fantasy console or as a "tiny suckless SDL". I made it because I often want to create a very simple game but am forced to make myself dependent on some huge bloated engine or a specific library (e.g. every open console has its own library which makes porting painful). Now I can simply make a game without any friction, it only depends on a single file (SAF.h) and I can immediately run the game on Linux, Windows, in browser, on Pokitto, or on my phone. It also substitutes an emulator for platforms that don't have it (many open consoles lack it). It's extremely low demanding on hardware, one of my friends even ported it to a calculator.

It is purposefully a very simple virtual device:

- 64x64 display, 256 colors, 25 FPS
- arrow buttons + A, B, C
- 4 sound effects
- 32 bytes of persistent memory for saves

That's basically it. You simply include saf.h and write a game, all basic function are available to you: shape drawing, image drawing, text drawing, sin/cos/sqrt functions etc. Main loop, CLI argument parsing and stuff like that is automatically handled, you don't care about it. Once you write the game you can simply compile it on given platform as you would compile any other program for that platform.

Now for testing I've written two small games for SAF:

- MicroTD (https://drummyfish.itch.io/microtd) (port of my Arduboy game), PLAY IN BROWSER
- Minigames (simple games for testing the engine) PLAY IN BROWSER

I'll be very glad if you write a game and share it. When there's enough games I'll probably create a website for downloading and playing them.

I also have some additional ideas like a comfy web IDE or optional extensions for things like multiplayer or music. We'll see about these in the future. You'll find more info about everything in the readme.

Thanks for your attention, tell me what you think :)
socialist anarcho-pacifist
Abolish all IP laws. Use CC0. Let's write less retarded software.
http://www.tastyfish.cz
User avatar
drummyfish
 
Posts: 448
Joined: 29 Jul 2018, 20:30
Location: Moravia

Re: SAF: Minimalist "Fantasy Console" + Games

Postby mdtrooper » 25 Nov 2021, 21:48

Woah it is awesome. I don't know your last work because normally I read the new forum. It remembers me to fantasy consoles like Pico8 (close source) and others.
And I have a Patreon in https://www.patreon.com/migueldedios.
User avatar
mdtrooper
 
Posts: 185
Joined: 26 Jul 2012, 13:24
Location: Spain

Re: SAF: Minimalist "Fantasy Console" + Games

Postby jdc » 27 Nov 2021, 15:54

Nice i was looking for something like this for my project The Box so that we can start working on the graphical part. Found similar projects people where using but not giving support or tutorials a bit hard to work width that.

Something that I found useful and at this stage din't find; only in turbo C functionality; think not working on just C. Like a library that allow to draw to absolute positioning, so that we can do things like in CSS. It is really nice to have. (Don't know if you have didn't read all the code...)

- absolute
- left top 10 px
- div 100 px
- menu

etc...
jdc
 
Posts: 150
Joined: 29 Jun 2017, 16:48

Re: SAF: Minimalist "Fantasy Console" + Games

Postby bzt » 27 Nov 2021, 20:39

jdc {l Wrote}:Something that I found useful and at this stage din't find; only in turbo C functionality; think not working on just C.
I'm not entirely sure what you mean. C language can't handle graphics itself, and Turbo C has no such functionality either. Are you referring to the BGI graphics library that was shipped along? SAF is similar to that, but much much more advanced and more featureful.

jdc {l Wrote}:Like a library that allow to draw to absolute positioning
BTW, I'm pretty sure SAF uses absolute positions, like in the hello.c example in the readme:
{l Code}: {l Select All Code}
  SAF_drawText(4,15,"HELLO!",
    SAF_frame() & 0x04 ? SAF_COLOR_RED : SAF_COLOR_BLACK,2);
Here 4 and 15 are absolute coordinates on the screen.

Cheers,
bzt
User avatar
bzt
 
Posts: 332
Joined: 23 May 2021, 21:46

Re: SAF: Minimalist "Fantasy Console" + Games

Postby deca9 » 16 May 2022, 15:11

Hi, First a big thanks for sharing!

I would like to play with the "utd" game.

(I downloaded CSFML and found how to compile it even if the readme file don't tell me how to do, ok the website explains it but I would be more happy if the readme file also tell me.)
(based on "make.sh" I have been able to compile utd after changing the -I and -L parameter with -I/tmp/CSFML-2.5.1/include/SFML -L/tmp/CSFML-2.5.1/lib because the linux distro that I use don't provide CSFML because it's rarely used.)
(I set export LD_LIBRARY_PATH=/tmp/CSFML-2.5.1/lib and then the ./utd binary does work fine.)

Does this game really uses SDL2, and (C)SFML at the same time?

Arrow keys and j, k, l keys events seem to reach the event input function, but I don't catch how to play the game.
Could someone explain me how to play this "utf" game?
deca9
 
Posts: 18
Joined: 16 May 2022, 01:22

Re: SAF: Minimalist "Fantasy Console" + Games

Postby drummyfish » 17 May 2022, 19:55

Hey,

thanks, make.sh is kind of a dirty script and it's hard-coded to compile the SDL2 version but you can easily change it: change the parameter "-DSAF_PLATFORM_SDL2=1" to "-DSAF_PLATFORM_CSFML=1" in the script. You can also try to compile for X11 (-DSAF_PLATFORM_X11=1, -lX11 etc.).

The game does NOT use both CSFML and SDL at once, it only uses one depending on which you choose. In the make.sh script I just link everything (CSFML, SDL, ncurses, X11), maybe that's why you're getting into trouble or something... yeah I shouldn't do it like this, it's pretty ugly, but worked on my machine :) Just remove the link flags of the frontends you're not using, i.e. if you want to compile the game with SDL2, remove all CSFML link commands and only leave SDL link flags. I should prolly change that script.

How to play: in the menu select a map, then build a tower somewhere. You do it by clicking somewhere and choosing the tower from the bottom menu that appears. Then you have to run the round, you do this by clicking the arrow in the bottom menu you built the tower from (you have to scroll all the way to the right). Then creeps start going, you kill them, get money, build more towers etc.

EDIT: I've edited the script, you now use it e.g. as: ./make.sh utd sdl
socialist anarcho-pacifist
Abolish all IP laws. Use CC0. Let's write less retarded software.
http://www.tastyfish.cz
User avatar
drummyfish
 
Posts: 448
Joined: 29 Jul 2018, 20:30
Location: Moravia

Re: SAF: Minimalist "Fantasy Console" + Games

Postby deca9 » 18 May 2022, 05:34

Thanks!
deca9
 
Posts: 18
Joined: 16 May 2022, 01:22

Who is online

Users browsing this forum: No registered users and 1 guest