×

Emacs + SDL: unblocking the unblockable by vkazanov in emacs

[–]vkazanov[S] 1 point2 points  (0 children)

Well, this might a step towards something like this but a lot more would have to be added.

Emacs + SDL: unblocking the unblockable by vkazanov in emacs

[–]vkazanov[S] 0 points1 point  (0 children)

I know about nothing about vulkan and gpu programming in general but... Ideally, how do you see this working?

Emacs + SDL: unblocking the unblockable by vkazanov in emacs

[–]vkazanov[S] 3 points4 points  (0 children)

Btw, i just dropped a description of an overall approach in emacs-devel

Emacs + SDL: unblocking the unblockable by vkazanov in emacs

[–]vkazanov[S] 3 points4 points  (0 children)

If this lands on master, many, MANY interesting opportunities arise. Emacs as a widget? Coroutines? Emacs lisp game engine integrations?

But it is a long way. Even the main command loop is a beast! There will still be many blocking primitives in thr lamguage itself remaining

Emacs + SDL: unblocking the unblockable by vkazanov in emacs

[–]vkazanov[S] 0 points1 point  (0 children)

Well my idea is more like being both an engine and an editor. think Godot but around emacs.

But there a VERY long way to go. Being non-blocking is kind of the first step, and will probably be the most universally useful one.

There's no special discussion, just me posting demo videos and talking to emacs maintainers about changes to the C core

Emacs + SDL: unblocking the unblockable by vkazanov in emacs

[–]vkazanov[S] 1 point2 points  (0 children)

Well my idea is more like being both an engine and an editor. think Godot but around emacs.

But there a VERY long way to go. Being non-blocking is kind of the first step, and will probably be the most universally useful one.

Emacs + SDL: unblocking the unblockable by vkazanov in emacs

[–]vkazanov[S] 3 points4 points  (0 children)

Eli seems to be interested in this, i'll be publishing both patches and reasoning behind the whole thing.

For now I ran out of time and steam and need some time to recover after the recent sprint.

Emacs + SDL: unblocking the unblockable by vkazanov in emacs

[–]vkazanov[S] 2 points3 points  (0 children)

Yeah, I always kind of wanted something like this: an editor/game hybrid. Played with Godot but that walking castle is just too interface-y for me.

So the official reason for working on this is "make serious things possible" but the truest one is "live code a Brogue-like in Emacs".

Emacs + SDL: unblocking the unblockable by vkazanov in emacs

[–]vkazanov[S] 8 points9 points  (0 children)

Yes, was happy to hear from Eli!

Let's see if it makes through a more careful review.

It was suprisingly easy to get this working after maybe 3-4 attempts over the years to do it without changing how input handling works in Emacs.

This version kind of became almost obvious after I managed to switch serial key reading code to a state machine called key_reader.

Anyways, it'll take some time to iron out all the bugs, polish, etc.

Emacs + SDL: unblocking the unblockable by vkazanov in emacs

[–]vkazanov[S] 3 points4 points  (0 children)

Right now it's in a very dirty state after me trying out things.

What do you think is the most intereting thing here? the non-blocking loop or the SDL on top of it?

Emacs + SDL: unblocking the unblockable by vkazanov in emacs

[–]vkazanov[S] 9 points10 points  (0 children)

Yes, true. My excitement beats my grammar! Didn't really think it was possible at all.

Anybody interested in writing SDL games in Emacs Lisp? by vkazanov in emacs

[–]vkazanov[S] 1 point2 points  (0 children)

While it definitely helps to make an SDL3-based Emacs, this doesn't really help with making something that works as a game.

This biggest challenge I saw in code is a blocking read_char call that waits for user interactions. Making this non-blocking is a huge challenge, SDL or not.

I really wonder if Emacs can get a less opinionated backend system, one that would make it possible to just provide provide a set of callbacks that the backend would then be able to run - and make Emacs run.

Anybody interested in writing SDL games in Emacs Lisp? by vkazanov in emacs

[–]vkazanov[S] 1 point2 points  (0 children)

Honestly speaking, you are right. There many great languages perfectly suitable for game writing. I know the story GOOL really well.

But here are 2 counter-arguments:

  1. Emacs Lisp is probably the most popular Lisp these days in terms of installations.
  2. What fun is there in making little games the same way everybody do it?

Anybody interested in writing SDL games in Emacs Lisp? by vkazanov in emacs

[–]vkazanov[S] 1 point2 points  (0 children)

My current understanding might be a bit shallow but these seem to be doing work as part of the current display engine while SDL likes to take over the target window.

Do you have experience with these things?

My vision so far was to let people write relatively complete SDL games, complete with window takeover but that might change

Anybody interested in writing SDL games in Emacs Lisp? by vkazanov in emacs

[–]vkazanov[S] 2 points3 points  (0 children)

By welcome you mean emacs devs? The thing is that this is not longer emacs. It's not an editor backend, more like SDL loop calling lisp code

Then again who knows :-)

Anybody interested in writing SDL games in Emacs Lisp? by vkazanov in emacs

[–]vkazanov[S] 1 point2 points  (0 children)

Yes, a terminal is something that would have to be implemented but the main difference is how the main repl loop would have to work.

In fact, in my prototype it is a different loop, avoiding main one co.pletelt

An actually playable SimCity clone in Emacs Lisp by vkazanov in emacs

[–]vkazanov[S] 1 point2 points  (0 children)

Let me know if you have any problems or ideas for improvements. The game is a bit barebones now, I am thinking about features/fixes/improvements for the next major version.

An actually playable SimCity clone in Emacs Lisp by vkazanov in emacs

[–]vkazanov[S] 2 points3 points  (0 children)

Yes, all the things that are suddenly within reach for a dedicated dev...

But, as I found out after some time working on Elcity (and a few years as in big gamedev), the bulk of work is actually getting all the little pieces to work together.

And this is something that is very hard to explain even to people, much less to LLMs that see things in tokens.

An actually playable SimCity clone in Emacs Lisp by vkazanov in emacs

[–]vkazanov[S] 4 points5 points  (0 children)

I found it hard to generate a coherent tileset.

Say, "16 variants of powerlines" and then "8 intersections of powerlines with roads"...

Ended up asking for inspirations and then just doing things myself pixel by pixel.

An actually playable SimCity clone in Emacs Lisp by vkazanov in emacs

[–]vkazanov[S] 3 points4 points  (0 children)

Hah, it really does look like the place!

PS It's just a default map I made to test water. There's no proper map generation in this version of the game.

An actually playable SimCity clone in Emacs Lisp by vkazanov in emacs

[–]vkazanov[S] 8 points9 points  (0 children)

The tile is tiles/tile-0000.xpm

You can edit it by hand, Emacs can visualise the format directly. For various historical reasons XPM is the best way to display images as glyphs.

But in reality I have a little pipeline that translates a png spritesheet drawn in https://pix2d.com/ into these XPMs.

I do something I call "distillation" of the project for this release to make it a bit more presentable and easy to run, all the dev support tooling is in a different repo.

If you feel interested in playing with tiles, let me know. I can share the script and the base spritesheet.