r/haskell • • 4d ago

announcement I added Live Coding to my Haskell Game Engine!

Post image

As the title says, I've just released a new version of Mischief (my free, open source, ECS-based game engine written in Haskell). It features a new library, mischief-live, which lets you hot-reload code from a targeted library. Internally, it does some hint magic to run an interpreter in the background and cache its results.

You can find two full videos in which I play around with this here and here.

Feel free to join the official discord server to be kept up to date with updates, chat with others, and support Mischief.

Check the official documentation for more information on what Mischief is and how to use it.

Also, reminder that absolutely no LLMs or other generative AI was used when making Mischief and the community and project have a strict no-AI policy :)

70 Upvotes

7 comments sorted by

8

u/cheater00 4d ago

nice! how does the hot reload work, in a few words?

5

u/TheOneExpert 3d ago

It uses hint to run an interpreter on the background, with a specific targetted library. From your main compiled code you can ask to interpret / evaluate functions from that library. At runtime you can change the code in that "live" library, and, when the main library asks for values, they will be the ones you've updated.

Values are also cached so that, if you ask multiple times for the same value / function in the live library, it will re-use the value it interpreted the first time, as long as no changes were made.

You can read more about it in the documentation for the mischief-live library.

1

u/cheater00 3d ago

thanks. is it similar in function and perf to compiled and optimized code?

3

u/TheOneExpert 3d ago

I haven't really benchmarked it and I don't think performance is that relevant. I mean, you're supposed to disable the live stuff and compile the app normally anyway when you release it.

But in the time that I've toyed with it I haven't really noticed any significant perf loss except the moment I make a change. Of course I assume in a really big simulation with thousands of entities it'll be more noticeable.

3

u/JoseD92 2d ago

great job, I will give it a try, any plans of adding a ui?

1

u/TheOneExpert 13h ago

yeah, totally, it's a pretty big priority.

2

u/kindaro 14h ago

I appreciate that you spell out your position on language models. I cannot speak for anyone else but it makes a big difference for me in particular. Please keep it this way.