code-of-kai

code-of-kai

Game Programming & Databases: Lessons from SpaceTimeDB

Game Programming & Databases: Lessons from SpaceTimeDB

Hey Elixeers!

I recently came across SpaceTimeDB, a fascinating distributed database being developed by Clockwork Labs for their upcoming MMORPG, BitCraft. What caught my eye is how it tackles familiar data, scale, and concurrency challenges in a way that could offer valuable lessons for the broader software world, even outside of gaming.

SpaceTimeDB blurs the lines between database and server. It allows developers to upload application logic directly into the database via “modules,” effectively eliminating the need for separate web or game servers. Clients connect directly to the database, executing logic within it. This approach promises to streamline development and potentially simplify deployment, as the entire application could be packaged as a single binary.

Intriguingly, SpaceTimeDB prioritizes speed and low latency over batch processing or OLAP workloads, making it well-suited for real-time applications like games, chat, and collaboration tools. This emphasis on real-time performance is achieved by holding all application state in memory and using a write-ahead-log (WAL) for persistence and recovery.

Here’s where it gets interesting for the Elixir community: The creator of SpaceTimeDB draws parallels between his project and Erlang in terms of its approach to concurrency and distributed systems.

This skips directly to the Erlang comparison:

Now, I’m curious to hear your thoughts:

  • Could SpaceTimeDB’s approach to integrating application logic into the database influence how we think about database interactions in Elixir?
  • What are the potential benefits and drawbacks of this tight coupling between application and database?
  • How might Elixir’s strengths in concurrency and fault tolerance complement or contrast with the design principles of SpaceTimeDB?
  • Do you see any opportunities to apply SpaceTimeDB’s focus on real-time performance in Elixir-based applications, within and outside of the gaming domain?

Most Liked

oliveiragahenrique

oliveiragahenrique

What are the potential benefits and drawbacks of this tight coupling between application and database?

That’s a topic I’m really interested in! Since discovering Mnesia, I’ve been contemplating building a fully-fledged, modern database on the BEAM that could run directly alongside an application. It’s definitely a project I plan to tackle one day.

In my view, the biggest hurdle lies in adoption and operational complexity. The current infrastructure ecosystem is heavily geared toward stateless applications for good reason—stateful systems are significantly more challenging to manage and operate. So, as soon as you mention a stateful app, it often raises eyebrows.

That said, I think BEAM’s concurrency model has shown itself capable of handling live updates while safely managing state (Mnesia is a great example of this).

The potential benefits are compelling, especially in terms of performance—keeping data within the same memory space enables faster I/O operations. Plus, simplifying development by eliminating translation layers between database and application formats could improve both speed and ease of development.

I’ll dig into this SpaceTimeDB more in-depth when I have the time. Thanks for sharing! (:

JEG2

JEG2

Author of Designing Elixir Systems with OTP

I’ve seriously considered building a SQLite clone in Elixir. You can see me playing around with the idea on my blog:

Where Next?

Popular in Discussions Top

PragTob
Hello everyone, I know we had quite some threads (read through lots of them) about background job processing but it remains a hotly deba...
New
blackode
Elixir Upgrading is so Simple in Ubuntu and It worked for me Ubuntu 16.04 git clone https://github.com/elixir-lang/elixir.git cd elixir...
New
owaisqayum
I have a sample string sentence = "Hello, world ... 123 *** ^%&*())^% %%:>" From this string, I want to only keep the integers, ...
New
arpan
Hello everyone :wave: Today I am very excited to announce a project that I have been working on for almost 3 months now. The project is...
New
pillaiindu
I want to convert a Phoenix LiveView CRUD website to a CRUD mobile app. What do you think is the easiest way to do so?
New
ben-pr-p
In general I’ve been sticking to this community style guide GitHub - christopheradams/elixir_style_guide: A community driven style guide ...
New
chulkilee
Here are the list of HTTP client libraries/wrappers, and some thoughts on HTTP client in general. I’d like to hear from others how they w...
New
AstonJ
Can you believe the first professionally published Elixir book was published just 8 years ago? Since then I think we’ve seen more books f...
New
AstonJ
If so I (and hopefully others!) might have some tips for you :slight_smile: But first, please say which area you’re finding most challen...
New
opsb
We’re considering our architecture from a viewpoint of scaling our traffic heavily over the next 6 months. Our current deployment is runn...
New

Other popular topics Top

albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 52341 488
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

We're in Beta

About us Mission Statement