This is a transcript of the video above, an interview with Keone Somers about building Elegon, his solo MMORPG, lightly edited for readability. Each timestamp jumps to that moment in the video. You can wishlist Elegon on Steam and follow its devlogs on YouTube.

Keone · 0:00
I think a lot of you might look at this and you might think, "Oh God, how's he doing that? How's he doing this system or that system?" And you might look at it and you might be like, "Oh. I can read that. That's pretty straightforward."

Kris · 0:12
Recently I caught up with Keone Somers, who's been building an MMO, just this colossal online game. He's been building it for about a year, and I still find this astonishing: he's built it solo. One developer. Even in the age of AI, that is astonishing, if you've never thought about how large a project a massively multiplayer online game is. Consider this: most of them have an entire virtual economy and accounting system as one sub-component of the whole project. So I just thought I'd get him in and ask him to show me his favourite parts. How do you build something like that fast? What are your highlights? What was easy, what was hard? And I hugely enjoyed the tour.

His tip about feedback systems I've started incorporating into everything I build. There's a lot to learn here, so for our very first Spacetime build interview, let's take a look at the game Elegon.

Kris · 1:10
Keone Somers, thank you for joining me.

Keone · 1:12
Thank you, thanks for having me. I'm very, very honoured to be invited on the show.

Kris · 1:17
You are our inaugural, is that the right word? Yeah, inaugural guest on this. We're gonna do a deep dive into what you've been building. You've been building Elegon for a few years now.

Keone · 1:29
Yeah, so I've been working on my little project, my MMORPG, for just over a year now. It's a game I've been making with the Godot engine, and SpacetimeDB for the back end.

Kris · 1:47
Cool. I'm not a game developer myself. I've scratched out small things, but I've never done anything ambitious, so I'm excited for you to give me a tour behind the scenes. We start with the game, though. Take me through the basics of Elegon and then we'll dive under the covers.

Keone · 2:03
Yeah, so I've got the game up here, and I guess I'll just run through it, just so people have an idea of what I've been building, and then I suppose we can show some of the code afterwards. So I guess it's just a typical MMO experience here. You can create your character and build them exactly how you want. I'll just quickly create a character here, and then...

Kris · 2:33
I like the Halloween theming. I assume that's deliberate.

Keone · 2:36
Yes, yes. I've got a friend, he thinks, he insists that it's a waste of time, but it was a very important feature to me. We've got to have a Halloween event, yeah. So here we go, we've got our new character. I can enter the world, and this is going to be connecting to the Elegon EU server. So I'm hosting two servers, two separate Spacetime servers, one in the US, one in the EU.

Kris · 3:07
Is that just for speed of light reasons? Latency? Yeah, for the...

Keone · 3:11
Essentially, yes. Ideally I'd love to have everyone on one server, and that might be something I look into in the future, figuring out a way that I can make that work nicely. But for the most part it's speed of light reasons.

Kris · 3:27
Yeah, it seems like every game can't solve that speed of light problem. I don't see it being solved anytime soon, so you probably will remain with multiple servers, that'd be my guess.

Keone · 3:40
So the world has actually undergone quite a big upgrade recently. I actually put out a video yesterday, and the world of Elegon has effectively doubled in size recently, so there are some optimisations to be made in terms of loading times and things like that. But there you go, we've got our first load into the game. And you can see we're loading in; anyone that's seen the devlogs, this is probably very familiar. And there we go, we're in the world of Elegon. Immediately we just have control of our character, and it's pretty responsive. There's no delay on the client side; everything happens immediately.

Kris · 4:24
The thing that gets me, and this is the reason I've never been a game developer, because it terrifies me I think, is I look at every bone on the ground, every stitch on that tent, every leaf on the... Everything you look at is a decision. And there's just so much work that goes into this. How on earth do you do this solo?

Keone · 4:46
I just really enjoy working on this project, to be honest. I always say I'm not really a game developer, I just really like working on this project. I like working on building an MMORPG. It's funny, I'm just looking over here, I'm spying on someone. I can see someone in the world, and I think they've just gone out of my view. There they are. But this is a nice example of SpacetimeDB. We've got another player here being synchronised. I can see them running around playing the game, and it all looks very smooth on the client side, because we're doing that nice client-side interpolation to make movement look smooth.

Obviously on the server there are different tick rates for different activities that happen throughout the game. But on the client side I've tried to make it look as smooth as possible and as instantaneous as possible. So other than that, we've got our NPC here; we can accept different quests. The first quest here is very simple, it's just: interact with this object here, get your weapons. I think the camera got a little bit stuck there, and then we can come over here. Another thing that's interesting: we've got range checks. So if I'm too far away, I'm not going to be able to interact with this NPC, and that's something that's enforced on the client side, but also on the server as well.

So I do range checks as well.

Kris · 6:24
And then the thing, I just... The scope of these things flabbergasts me, because you've got a map and you've got physics, and then you've got the quest thing, which must end up looking like a whole workflow engine, right? You can begin quest Y if you've completed quest X, and then that opens quest Z and Omega and...

Keone · 6:49
Yes, yeah.

Kris · 6:51
And we got an economy in there.

Keone · 6:54
Economy, yeah. I think sometimes I forget just the scale of everything, because I've been building it over so many months. But yeah, no, it's been incredible. And one thing I should probably do that I haven't done is look at some of the old footage that I recorded for this game, because it's come such a long way so quickly. If I use my filthy cheats at the moment, I can move around a little bit quicker, and I can just show... I'm just... Yeah. Yeah, this is all just play-testing magic. But yeah, I'm just super happy with the way that it's turned out. I'm not an artist by any means. I haven't done this in the past.

I'm coming from a more typical engineering background, of building .NET C# applications. So this was definitely something new for me. But yeah, I've just loved working on it.

Kris · 8:04
Yeah, how much of this is your work? I don't think you have a team, but do you have collaborators?

Keone · 8:11
I don't. I've had lots of great people reach out with lots of various different things that they could contribute and work on, and I've always been quite hesitant on that. I would say there are two kind of secrets I have to how I'm able to build and iterate so quickly. The first one is I have a feedback platform for this project, and you can see here I've got this button where people can give feedback whilst they're playing. So for me, one of the most valuable things is getting feedback, and that's why I host this play test 24/7 for anyone to hop in and play.

And I get feedback and I try and iterate on it as quickly as possible, and that's what, in my opinion, keeps making the game better and better. Now, some of the feedback is not things I implement, because it's not quite aligned with what I'm trying to build, but most of it is usually pretty good. And a lot of the time, I find that a lot of the people that come on and try the play test really surprise me with the level of detail and everything that they give with their feedback, and it is super helpful. So that's pleasantly surprising.

Honestly, it's a bit of a superpower having that, because I think a lot of people want to contribute, they want to help, they want to give their opinion. And I think being able to make it an easy way for people to be able to do that has just been really, really great. And then obviously the other thing has been AI. Can't really get away from it these days. Yeah, if it's used

Kris · 10:09
tastefully, it's not a bad thing.

Keone · 10:11
Exactly. You don't really just want to use AI as a black box, and not really look at it, and then look at the output and say, "Great, that's done." I think used tastefully, like you say, it's a very powerful tool, and it's really accelerated what I've been able to build in the time scale that I've had. So this project started just over a year ago, and it's crazy to think how quickly things move, because when I started this project, I would say I was doing 90 percent of the code written myself, and then I would have an LLM help me. I don't even think I was using an agent, really. And now it's at the point where every single day, yes, I am still writing code, but I have agents and I am using various different tools to build and iterate on things quickly. And in my opinion, it is...

Kris · 11:15
It is insane. AI or not, it's insane to think you could do this much solo.

Keone · 11:20
Yeah, I wouldn't have thought that this would be possible a few years ago as a solo developer. I think realistically it's probably not. It would have taken me years and years, so yeah.

Kris · 11:35
I mean, it takes years, and it took years and years for large teams to do something like this.

Keone · 11:42
Yeah, and MMOs have always been kind of notorious. They're quite a hard market to crack, and I think a lot of people have had the idea of, "Oh, I'd love to build a large-scale game like that." And I've had a few people message me like, "Oh, I have this idea for this multiplayer thing," and funnily enough I do kind of point people and say, "Maybe give Spacetime a try." And it's not always an MMO, but sometimes it's even just any multiplayer or networking. It really seems to be a bit of a blocker for people, and I see a lot of people have ideas of things that they want to build.

And the multiplayer can be a bit of a blocker.

Kris · 12:29
Yeah, it's hard. And it's funny how many things in the end are multiplayer systems. Sorry, I was thinking this the other day: even an accounting system is multiplayer. It's not a game, but it's a multiplayer experience, right? Everybody needs to see the accounting across the organisation in different ways. Yeah, and then that's... I'm going to drown if I think about this in too much depth. But I think it's hard. I've seen companies try and fail to build accounting systems, and that's one sub-component in an MMO.

Keone · 13:05
Yeah, that's one of the things, isn't it? An MMO is a very broad game, though. It's kind of like games within a game. Even just when I think about adding the fishing system or the gathering systems or crafting or the economy. Yeah, it's a lot.

Kris · 13:28
Okay, should we peer under the hood? Show me how it's... Give me enough of an idea that I might be stupid enough to take on a similar project like this one day.

Keone · 13:38
Yes, I'm gonna let everyone in on the secrets. And honestly, I think a lot of this code that I'm going to show you today... I've got my notes next to me, so if I'm looking down, that's what I'm looking at. I think a lot of you might look at this and you might think, "Oh God, how's he doing that? How's he doing this system or that system?" And you might look at it and you might be like, "Oh. I can read that. That's pretty straightforward." And I'm not the best developer in the world.

Far from it. But the fact that I'm able to focus on building the systems in the way that I want them, and focusing on the behaviour more so than worrying about drowning in serialisation or things like that, has just been brilliant. So I guess I'll just jump straight into it, then.

Kris · 14:34
Yeah, let's get stuck in.

Keone · 14:36
Okay, so we're here on my work computer, and we're on the Elegon client right now. So this is the Godot client, and it's running C#. We've got C# over here, which is kind of the obvious pick for me, just because, coming from a background of being a C# developer, this has been good for me. And Spacetime has supported C# for a long time, so it's been great. And more recently, I suppose it's not really that recent now, it was quite a while ago, but Spacetime has really great support for Godot. So if you're interested in using Spacetime in your project...

Obviously you can use it in Unreal Engine or Unity, and a lot of people do like those. But for everyone like me that was like, "Oh, can you use this in Godot?" I've had a couple of people ask me about that as well. Honestly, it's really easy to set up. I set this up originally when it was just using the C# bindings, and this was before the official Godot support, but even with that it was very seamless. But the first thing I wanted to show was this here, which is me setting up a connection.

So this is a single client here setting up their connection with one of the servers, and it's really doing so much with not a lot of code. So here you can see that we've got our OnConnect, which Spacetime gives us, and then we're basically saying, when we connect, do these things. And when we have an error, do this; when we disconnect, do this. And here we've also got our authentication token as well, and that's another thing that I've really enjoyed about SpacetimeDB: the fact that I can bring whatever OIDC token that I want, and Spacetime works with that, has been brilliant.

So if you've got your own authentication system or authorisation system, you can bring that, and Spacetime is kind of plug and play. So there's not really any lock-in there.

Kris · 17:00
Nice. So what do you use as your identity provider? What do people log in with?

Keone · 17:04
Originally I was using SpacetimeAuth, and that was brilliant. And then, what did I do? More recently I've kind of gone down this self-hosting rabbit hole. So I've been trying to self-host as many things as possible. It's mostly just me nerding out, trying different things out. So right now I have a different provider, my own provider, which is, I guess, Elegon Auth, and that's a Rust server that I'm hosting over on Railway. And that plugs in; it lets players log in with their Steam account or their Discord.

And I can add more providers in the future. And then my Elegon Auth basically talks with my servers, and Spacetime authenticates the connections that way.

Kris · 18:07
Right, just via OIDC, just the standard protocol.

Keone · 18:10
Exactly, so it's very clean. But if you're thinking about doing this, I would recommend, honestly, the easiest and probably best way to go is SpacetimeAuth. It's very straightforward, especially if you're already considering hosting your project on Maincloud. It just works very nicely. Other than that, there's a million other providers that you can use, and they all have lots and lots of different login options. So there's no shortage of options when it comes to authentication, if that's something that you need in your game. Yeah. Okay. But yeah. So one of the things that's been added recently that I actually do really appreciate (a lot of people might think this is a small thing).

But I really like this automatic reconnect. This was actually something that I used to have to do myself, and it worked, but it wasn't great. If a player lost connection to the server, it would be a little bit clunky. I would have to show a reconnecting message. All of their subscriptions, everything, would be torn down, and if they did manage to reconnect, I would have to build that all back up again. With the latest update, we now have automatic reconnect built in, and you can just enable it as a flag. And then you basically say, "On automatic reconnect, do this," and then you can do whatever you need to do on the client. But it's really nice because it preserves basically everything about the connection. So any subscriptions that they were subscribed to, anything like that, it preserves, and it catches them up when they reconnect, so there's nothing lost.

Kris · 19:57
Yeah, it's faster and a lot easier for you as a coder, right?

Keone · 20:02
Yeah, it's just another thing that I don't have to worry about. And yeah, I really appreciate it.

Kris · 20:09
I know the person in our team who did most of the work on that, and he'll be very pleased to hear you say that.

Keone · 20:15
Yeah, honestly, sometimes I get excited about the smallest things, and it's not even a small thing. Anyone that's built, not an MMO, a multiplayer game, this is something that you have to consider. It's the same with other little things like this, like the SpacetimeDB update manager. This was something that was added, and it was just really satisfying to drop this in. This keeps the connection running on the client side. Previously you'd have to be stepping through ticks on the client manually, and you'd have to find the solution for that yourself.

But this is just a single line here. It just keeps the connection alive on the client side, and it's just another thing. I think a lot of this as well probably comes out of the fact that Clockwork, not only do they make SpacetimeDB, but they also make BitCraft. So I'm sure a lot of this comes out of your own wants and desires as well.

Kris · 21:23
Tell me what that is actually, because I don't know. I haven't seen that part; there are parts of the system I don't know. So what's it managing?

Keone · 21:30
Yeah, so this is just basically keeping the connection alive. Normally you'd have to call FrameTick over and over again, and it's basically this busy work that you do on the client. That allows the Spacetime client to talk to the server every tick. What this line does is handle that for you; it just keeps the connection running smoothly. So it's mostly a quality of life change, but really appreciated.

Kris · 22:06
Nice.

Keone · 22:09
But yeah, that's okay.

Kris · 22:10
Okay, so what's next? Yeah, we've established the connection. What do we do to start?

Keone · 22:16
Right, we are connected. And right now I've just been showing the client.

Keone · 22:23
But I think the next thing that I want to talk about is another big thing for a lot of people, which is the subscriptions, and just how helpful they are, how much of a headache they remove. So if I come over to the server and go to... let's go to the entity table, right? Let's go here. And here you can see, I guess this is a good example, we've got EnemySnapshot. This is a struct I'm declaring that is effectively a table that I'm storing in my Spacetime module. And what I do here is I'm basically describing this once. I just describe all the fields that I want, how I want it to look.

And that's kind of that. Typically, if you were building a more traditional server, this wouldn't be the only time that you'd have to describe this. Every time you want to send a packet, or you want to work with it on the client side, or make any modifications on the server, you'd have to be creating different interfaces for this, and lots of various different pieces of code to interact with this one table. So that gets busy quite quickly.

Kris · 23:51
You define your struct once and you get the table definition, the type definition, the serialization protocol.

Keone · 23:57
Exactly, yeah, exactly. I define this once, I run spacetime generate, and it does the work for me, which is brilliant.

Kris · 24:07
And I think it's probably worth flagging: we've switched to Rust here for the back end. But when you call spacetime generate on that Rust definition, you get the C# client-side version as well.

Keone · 24:19
So it handles that for me. And I have other parts of the Elegon project that are running on the TypeScript SDK, for example. So when I'm generating the bindings, it's really no extra effort for me to have TypeScript bindings, Rust bindings, whatever I need. It will just generate it for me, and it's just another thing that I don't have to maintain.

Kris · 24:48
Yeah, undone is the best work of all.

Keone · 24:51
Yeah. And I put a few notes here just to remind myself. Right now the project has 198 tables on the server. Having to maintain that would just be near impossible without this subscription-based system, in my view anyway. Before I started using Spacetime, I was looking at a more traditional .NET solution using ENet and Postgres, and it just gets very, very laborious very quickly. So I can't emphasise enough: just being able to describe this once and have it work throughout the project is brilliant.

Kris · 25:44
Yeah. Coincidentally enough, I spoke to a friend of mine earlier in the week who's just started a new job, and I think about half of his job at the moment is just managing several hundred tables and their different definitions as they go through the organisation. You cannot underestimate how much work that is.

Keone · 26:03
Yeah. And this example that I'm giving here as well, this isn't even one of the base tables. This is a slice, a snapshot of data coming from another table as well. Interesting, because a lot of the time you're not going to want to send the full package of data. A lot of the time the table contains fields that you don't always need to be sending to the client. So just being able to subscribe to what you need, and then having that sent to the clients, is just really nice, really easy.

Kris · 26:42
Right, so is this stored as a table, or is it a view on another table?

Keone · 26:47
I do use views, but this is actually stored as a table. So yeah.

Kris · 26:56
This is like snapshotting it periodically.

Keone · 26:59
Yeah, so this one's a little bit interesting. This isn't the typical setup; this is mostly just coming out of me trying to optimise things and do as little work as possible. But yes, this is me taking a snapshot of a subset of data that I access quite frequently, that I can just let clients subscribe to in this way. More typically this wouldn't really be needed. You can just define your table and have clients subscribe that way. But it's great being able to have the flexibility to set it up like this, or however you need it.

Kris · 27:43
Yeah, totally.

Keone · 27:44
Totally. But yeah, I think that's kind of that. I just wanted to give subscriptions a mention, because I know, for most people that have been aware of Spacetime, that's one of the big things they're aware of. But I thought I would mention it.

Keone · 28:00
Now, the next thing that I actually want to talk about is something that's not the most complicated system in Elegon, or any MMO for that matter. But it's just something that I find so satisfying, and I really love the way it's set up. So I'm going to be talking about how I handle chat in Elegon. Okay. Yeah, so in Elegon we have a global chat, and the chat window is in the bottom left, and anyone can type in the global chat. Then we've also got channels like whisper, party and things like that. So this is... let me get over to the code example I wanted to show you. Here we are, send_message. So here we've got our reducer, which is very straightforward.

You can send your message: "I want my message to be this," which is just a string. And then, optionally, I can say I want to send this to a recipient. Now, this basically says if we have a recipient, we're going to treat this as a whisper, because this is directly going to another player. Makes sense. Yeah, but I suppose this is the first time I'm showing you one of the reducers. So on most of the reducers in Elegon, I start them with a few checks. This first one is just making sure that you have a valid account, so that you're able to do this mutation. Any mutation on the server, on the database, I really run this check.

And then I just get your character, and all of this I can derive from the context coming through on the call. So when the client calls my server, they send a little package with them saying who they are and everything like that, so that I can verify everyone that is calling this.

Kris · 29:59
And these are just helper functions around the usual ctx.sender.

Keone · 30:02
Yeah, exactly. Yeah, exactly. And then here I have validate_message. This is a very basic function that just checks a few things to make sure that the message is not going to be problematic. And then I added this one quite recently: I've got a bit of a rate limit check here. So these are basically just security and performance checks that I run early on most reducers.

Kris · 30:32
Is that actually looking up when you last sent a message in the

Keone · 30:36
in the database log? Yeah, I have a table where I manage user action rates, I suppose. If you're doing too many things too quickly, then you get paused. I haven't really had it be a problem, but I think it is something that any social online game like this would need. And it's not just for chat interactions as well; any other gameplay action is probably good to be rate limited. So yeah, the fact that we can do that.

Kris · 31:19
It's just the same mechanism as everything: just stick it in a table and query it when you need to know.

Keone · 31:24
Yeah, that's it. And with proper indexing, things like that, it's pretty trivial to do. So now, as I said before, if we have a recipient, we treat it as a whisper. And then, yeah. But the reason that I really wanted to show this function, or this reducer, was because right now this all looks pretty standard, right? It looks like, okay, great, it's sending this and sending some... The most basic is sending an open chat message; that's just sending it to everyone in the game. And here all that this is doing is inserting a row in the messages table.

And to me this is so satisfying, because the messages table isn't a standard table. It's a special event table, and these are... I shouldn't say recent, because this wasn't recent. To me it feels recent.

Kris · 32:26
It's with version 2, right?

Keone · 32:28
Yeah, event tables. I don't know why I find them so satisfying, but when they were added, I just really enjoyed going through and refactoring everything to use them. But event tables are brilliant, because they're just like regular tables, and when they get a new row in them, they fire off the event to anyone that's subscribed to that table. So if someone sends a message, anyone that's subscribed to that table will get that message, and then that message is removed. There's nothing being stored. So it's just super clean. It's a really clean way of doing a system like this, and it's something that I just really enjoyed doing.

Yeah. Nowhere in the database are messages stored. They are completely ephemeral, and I just love how clean this is.

Kris · 33:27
It's one of those things where, if you've set up your own broadcast-to-all-interested-parties system in the past, then you'll appreciate how good these are. And if you've only ever used event tables, you wonder what the fuss is about, because you just insert it and the job's done, right?

Keone · 33:44
Yeah, exactly. I remember before this I did have a system where I had a similar thing set up, and I wrote it myself, but it was just not clean, and it was a lot. It wasn't as satisfying as this implementation. It was kind of a case of, "Okay, everyone subscribed to this table, I'm going to create this row. Okay, we all got the row, and then I'm going to manually delete it," and all of this. So just being able to mark a table as an event table and say, "I'm not interested in storing this data, I just want to broadcast it," yeah, it's just so nice.

Kris · 34:23
Fire-and-forget broadcast messaging. Sweet.

Keone · 34:26
Yeah, exactly. And I suppose I can come over to the tables. We've got MessageEvent, so this is the table that we were just referencing in the previous reducer. And you can see here we just simply mark it as an event table, and it's so simple; there's really not a lot to it. So it really takes a lot of the headache away from me.

Kris · 34:52
Yeah. Define the table, insert into it, you've got a broadcast system. That is nice. You can forget how easy it is.

Keone · 35:00
Yeah. And as we said before, if you need it on whatever client, C#, TypeScript, whatever, you just run that spacetime generate and you have a broadcast system wherever you need it. So yeah.

Kris · 35:17
Nice. Okay, so what's next? That's messaging done.

Keone · 35:20
I suppose... I've got so many things on my list here that I wanted to talk about. Let's change it up a little bit. I want to go to my browser.

Keone · 35:30
I just want to talk about self-hosting quickly. I mentioned it briefly earlier, but this is just another really nice thing that Spacetime lets you do, for people that are interested in this. This is my Railway account. There's a few things here that aren't quite... they're not directly relevant to Elegon. But I wanted to show this because it's a really good example of, if you're hesitant of using Spacetime and you're thinking, "But I don't want to be locked into using this proprietary software. I don't want to have to use Maincloud. I don't want to do this or that."

There are options. Clockwork host an image of SpacetimeDB on Docker, and you can just self-host that image wherever you want. I'm using Railway. And here you can see I've got my game servers, and I've got one for US and one for EU. And I basically have them set up pointing at that Docker image. I don't have to maintain it; the team over at Clockwork maintain that. I just have it so when those images update, my servers update. And yeah, it's really easy. And here we've got the auth server that I spoke about earlier as well, my Rust auth server that communicates with the game servers as well.

Really, it doesn't really matter what sort of architecture you want to go with, what sort of setup. It's pretty flexible. And before this I was using Spacetime through Maincloud, and using it through Maincloud is great as well. It gives you a lot of tools that can be very helpful and very time-saving. The actual Maincloud dashboard is really nice. You can just view all of your reducers or your logs or your tables; everything that you would need to manage your database is there out of the box, and it's free. So the fact that you can just get up and running with that in five minutes is brilliant. But then also having in the back of your mind, being able to know that I can stay on this as long as I want because it will scale up, but...

I'm not locked in. And for a lot of people, they might never self-host, and there's not really a requirement to. But it's one of those things where, if it wasn't an option, it would probably be a problem. But the fact that it's an option, it just takes that stress away. So yeah, just knowing you're not locked into anything.

Kris · 38:15
Yeah, and it's interesting to see you do it, and also interesting to see you do your own geolocation. Because I think a future is coming where you can get Maincloud in the US and the EU and maybe more.

Keone · 38:30
Yeah, you've got that flexibility when you

Kris · 38:32
need it. That's cool.

Keone · 38:34
There's been a lot of instances where there's been things of, "I wish this was like this or this," and very shortly after, usually those things come. I'm always implementing something and then it's like, "Oh, okay, that's been added now as a core thing." And then I'll sit down with my coffee and I'll refactor it and pull out all of the things that I've done and just put a single line, and it's lovely. So yeah, I think it's the exciting thing about Spacetime as well. It's relatively new, I suppose.

And it's very active as well. I'm the sort of person where I love reading all of the changelog updates every single time they come out, and I subscribe to them on Discord. I have all of my notifications and everything, so there's always updates coming out.

Kris · 39:29
Yeah, we're cracking through new features.

Keone · 39:31
Yeah, so if you're into that and you want the latest things, there's no shortage of that at all. So yeah, that's kind of been my experience with self-hosting. Funnily enough, right now I'm self-hosting, but I have been toying with the idea of going back to Maincloud, just because I know that there's a lot of good things coming that way as well. But it's just so nice to have that option.

Keone · 39:59
Next up, I actually want to talk about timers, and I'm not going to talk about them in the way that most people think I am. Okay, so... tell me, tell me. Yeah, so when most people think about timers, and timers in Spacetime... timers are essentially just another table. Just like the events table, where you mark the table as an events table, you can mark a table as a scheduled table. And you can set rows in those tables, and those rows kind of equal events. So what a lot of people do, and myself included, is I have several timers set up for different tick rates.

So I have a fast tick rate timer set up on my server for things like combat and active enemy movement and things like that. I've also got a slower tick rate for different things. And you can start and stop those, and I think a lot of people already know about that basic timer functionality. But another thing that has been very satisfying to me, in the same way that the events table has been satisfying... if I go to... yeah, so I've got it here, market tables. So here, the market is where players can post items that they want to sell to other players.

And by default those items are going to be on the market for seven days, and then they will come off the market and they'll go back into the player's inventory, or if they sold, then they go to the buyer's mailbox. So one thing that's really nice about this is when I have a situation where there's something that needs to expire, whether it's a market listing here, or it could be even something as simple as a spell cooldown or something like that. There's a lot of time in there in Elegon where I'll have a spell that has an hour cooldown or something like that.

Yeah, that's not something that I'm going to be wanting to check constantly. Is it ready? Is it ready yet? Do I need to expire this market listing? I'm not constantly checking that. So when I create a listing, I create it with the expiry time, and that's created in the scheduled table. So what happens is the scheduled table that handles market listings... I don't have to do any extra work, basically. What it does is it says, "Okay, when we've hit this scheduled_at, I'm going to run this," and that's it. I don't have to do anything. It's not constantly checking. I don't have to write any weird loops or any code like that. It's just, "Okay, at this time I'm going to run this."

Kris · 43:14
Yeah, having the system handle that kind of future-dated work for you is really convenient.

Keone · 43:20
Yeah, and for me with Elegon, there's so many examples where I'm using this, and it's just such an elegant solution to this problem. I'm really happy that I haven't had to write a custom implementation for this.

Kris · 43:41
Yeah, yeah, because the thing I like about it is, again, how do you set up this timing mechanism? You just insert into a table. It's not like you've got to set up a cron job, or speak some scheduling language, or write a file into the system that looks up which jobs need to be scheduled an hour hence. Because I've seen systems where future-dated things have several different mechanisms to manage them.

Keone · 44:10
Yeah, yeah.

Kris · 44:11
This is just insert into a table.

Keone · 44:12
Yeah, it literally is. We have it here. This line here is more of just me being paranoid, but the second line here, you can do it in a single line. It's just inserting into a table, and it's going to expire at this time and do this thing. So these are kind of one-shot scheduled rows, where they just expire, they'll run the thing, they'll delete themselves and go away, and it's so easy. So yeah, I just wanted to talk about that. That's kind of my implementation of how I'm using timers as alerts. As I say, I do use timers in the more traditional sense as well, where you can just kind of have that game logic running on timers. But this was something that I just wanted to talk about, because I find it super satisfying.

Kris · 45:00
Yeah, yeah, yeah, yeah. Again, that's the thing where you wouldn't expect there to be one mechanism covering stuff that happens several times a second and stuff that happens in an hour, in a week, and...

Keone · 45:12
Yeah, yeah. It almost reminds me of cron jobs or something. It's just a nice way of describing this logic. But yeah, and then I think...

Kris · 45:27
Next time I get... out of curiosity, I've got to ask, do they get large? Presumably you have several timers set in the future for many different events per user.

Keone · 45:37
Yeah, yeah. At the moment it hasn't really, because we're just in the playtest phase. But even with a lot of future timers, it's completely negligible, the amount of space needed to store these. They're extremely light rows in the database. You can see here it's effectively just a couple of fields. And it's a very small footprint on the server. Also, any timers I have around spell expiries and things like that, those pretty much go away instantly. Like I say, there are a few timers where maybe you put a buff on someone and it lasts an hour.

But yeah, in a live environment you'd expect to see the timers tables several times bigger in terms of row count than the actual characters tables. But because the rows are so light, it's not really an issue. But yeah.

Keone · 46:53
Yeah, I think next up I want to talk about something I actually stole from you guys. Lawyers are listening. A lot of people might already know this, but Clockwork very kindly open-sourced their BitCraft server on GitHub. So if you're ever wondering, "Well, I wonder how I should set this up? Do I do this or that?"... One thing that's been great for me is I can hop in there and I can just see, "Oh, I wonder how they handled this or did this." And sometimes I go into that repo and I see things where I'm like, "Oh, actually, I didn't think of that. That's quite nice, I'll do that." So one of the things that's quite nice about Spacetime is you can make quite deep changes to the server without having to restart anything, and without clients having to disconnect. So one of the things that I saw that was being done in this repository was there's a lot of system locks.

With BitCraft, and also with Elegon, I have certain users, obviously myself, set as administrators. And administrators can kind of do different actions that a regular player can't. So earlier you saw me flying around.

Kris · 48:24
Yeah.

Keone · 48:26
One thing that's really nice is I actually have a couple of tools here on my computer. This one here is Elegon Toolbox, which gives me a bunch of administration tools around the server. And what I've been able to implement is basically a set of system locks that I can enable and disable whenever I want, during runtime. So, for example, if there's a problem with trading or something like that, I can just disable the trading system, with a system message going out to players saying, "Okay, we're just pausing the system for now." I can work on whatever needs to be fixed, or whatever I need to look at, and then I can re-enable that, and players haven't had to disconnect. There's been no...

And it's just been such a clean, really nice quality-of-life thing I've been able to put in. Because traditionally, if there was a problem, the whole server would be shut down and there would be downtime and maintenance. But with this, I have these checks in place. So if I go over to... where do we have it? I've got safety tables. Yes, okay, here. So I've got my table here, where I have got a field for what feature it is that I'm disabling or enabling, and then I've got the reason, which goes out to players, and then a few other auditing fields as well.

And then, right, so we've got that. And then if I come over to... yeah, I think we've got it in systems. What have we got here? Kill switches. Right, so these are the systems I can currently enable and disable whilst the server is running. This is really nice, being able to just have that control. It takes a lot of stress off. Obviously in my case these are the systems I'm enabling and disabling, but if you have your own game, I'm sure... any online game, it's just nice to be able to set these flags during runtime without having to have any restarts.

And yeah, it's just very nice. So I thought that this would be...

Kris · 50:56
Right, so have I got this right? You've got basically a table saying which features are disabled. When you try to use the feature, it just looks up a row in the database with that disabled flag and sends some denial.

Keone · 51:14
Yeah, so when you call a... let's see if I can show you an example. Right, so complete_trade is a function that's being called by a reducer. This is actually a little bit further down than I would like it to be, but just outside of complete_trade I basically do a check, and I say, "Okay, is this feature actually enabled before you can do this action?" And it's similar to those other checks I showed you earlier, where I check the context and things like that. So it's a single-line check that I do on a lot of reducers, I guess the reducers to do with the features that I showed you earlier.

And yeah, if you try and call the reducer, which then subsequently calls this function, that's just going to fail, because the server is blocking it, and that's got nothing to do with the client.

Kris · 52:15
So you've got kind of runtime feature flags defined by a very small table, which will be in memory, so it'll be super fast. Yeah, yeah. So you get dynamic switching of features.

Keone · 52:25
Yeah, and this is a practical example of how being able to change data on the fly can actually just be really helpful, and it can turn things that would otherwise be really tedious downtime into pretty quick fixes. And this is just one practical example of changing things at runtime. There's so many things where I can change not only data at runtime, but I can change logic. I could literally update a reducer at runtime. I can update a reducer and then publish my server again without any clients disconnecting, and that logic has changed. So, for example, if I found a trade bug or duplication issue or something, I can pause those systems, apply the fix and publish the fix, and then resume the system without most players even realising. So yeah.

Kris · 53:26
Really, in the future you'll have the same system in reverse: "We've got a new feature that we just want to give access to for a few users at a time." Yeah, right, so enabling of things rather than disabling. And the same mechanism: when someone gets enabled for it, they would get a broadcast message saying, "You've now got access to this feature."

Keone · 53:51
Yeah, and take, for example, my Halloween event. Yeah, it's not always Halloween. I'm going to have to disable that at some point, unfortunately, but that doesn't mean I have to restart the server. And there's so many things like that, where maybe you're not making an MMO, maybe you are, but there's so many online games where, wouldn't it be cool if you can just have these spontaneous events happen and things like that, or features that can be enabled at certain times and then disabled? There's so many possibilities.

Kris · 54:30
Yeah, but you can deploy the code for those new features without having to restart, without having to reconnect. So you can just set it all up in place and then enable it dynamically. Exactly, that's nice.

Keone · 54:43
Yeah. But yeah, I think that was that. I've got one more little bit that I want to share, and then I think that's going to be the tour of the server.

Keone · 55:01
So the last thing that I want to talk about... I've spoken about subscriptions. The last thing that I want to talk about is just how I use views. I'm not sure how many people are using views. I imagine most people use them, but to me I just find them really invaluable. I use views for so many different things in the game. I wonder if I... okay, so I did make a note of that. Currently I've got 46 views. So 46 views to my 198 tables. So I do use views quite a bit, and I guess the example I'll show today is, if we have a look, we've got current chunk here, right?

Kris · 55:48
Because in an MMO you must have a very healthy mix of data that's publicly available to everyone and needs to be, and then more private stuff where just a certain user sees their own view of the world.

Keone · 56:03
Yeah, exactly. A lot of it is just dependent on how your game works and how you want your game to behave. Subscriptions are brilliant because they're just super efficient, super lightweight, and anyone can just subscribe to a table directly, and for a lot of things that's ideal. But for this example here, this is a view that I've created where I'm basically only showing you... and this one's just for enemies, but I've got different views for different things going on in the current chunk. This is just showing you what's going on in the area of the map where your character is actually standing, because you don't need to know about...

You know, enemies moving on the other side of the world, or, I don't know, some ore node being mined in another zone. And in fact, I don't want you to know about those things. If I didn't have these views set up in this way, people could just create tools where they could create a map, and they could host it and they could see where every single spawn is currently in the world, and "is this boss alive, is he dead?" And maybe in some games people would like that, but for mine...

I wanted to kind of protect that, so I've got views set up in a way where the client is only receiving information that is relevant to where that character is in the world.

Kris · 57:37
It's funny, you look at that, you know, when you're ordering an Uber and you get to see all the cars that are roughly in your area. Yes, Uber must have the same code as this, and I bet it's not, what, 10 lines.

Keone · 57:52
Yeah, I'm sure that code isn't as nice as mine. But again, this is kind of the theme a lot of the time. You think something's going to be a whole system, and I'm going to show you three or four files, and a lot of the time it is just very simple implementations like this. A lot of people, myself included... I'm not a huge fan of the way Rust looks, for example, right? Okay, and my service staying after that one... my server here is written in Rust.

But even with everything being written in Rust, and I'm coming from a C# background, it just feels very readable and very approachable, even to me. And like I said, I'm not some sort of prodigy developer. But to me this is very manageable and it makes a lot of sense.

Kris · 58:58
Yeah. I like the way you can create views: you can create them with a kind of query-like language, or SQL, and you can also just create them with code, and having that flexibility too is useful.

Keone · 59:10
Yeah, exactly. You can do more traditional SQL queries coming from the client, or you can do it in code. I think for the most part I just use the kind of code expressions coming from the client, because they cover pretty much everything that I need. But it's nice to know that you can do SQL queries as well on any of this. But this has been invaluable for me. The world of Elegon is enormous and it's split up into lots of chunks, and this has just been brilliant, being able to scope out...

I guess subsections, and provide them as these nice views that are sometimes specific to a specific character as well, and that will come through in the context, and sometimes a view might be shared. So you have that option as well. Views are just another thing that's completely invaluable to me, and I think that's pretty much everything I wanted to talk about today. In terms of nice... yeah, what I'm using.

Kris · 1:00:26
So take me back to the view of the game.

Keone · 1:00:32
Let's go back into the game, shall we? Everyone seeing my Steam library.

Kris · 1:00:40
We were talking before we started recording this about what you're playing at the moment, but we'll save that for another recording. Yes. But I was looking at this and thinking, right, your back end is mostly Rust. Yeah, your front end is C# in Godot, as you said, but presumably you've got all the data and all the views and all the reducers available, and all the code generation set up for TypeScript. So if you wanted to do something like, the Elegon website has a fixed camera view into the running world, that becomes feasible as well, right?

Keone · 1:01:17
Yeah, that's exactly... and those are the sort of ideas that I have played around with myself. Let's come out of this mode. There's ideas I've played around with myself where, just because it's so easy to generate bindings wherever I need them, I've got some ideas where there could be a sort of armory system on the website. So right now in game we have the... where is it? So many things here. Is it the archive? Oh. OK. Right now we've got... OK, that took a little sec. So right now we've got the in-game armory, I suppose you could say, and we've got everyone's characters and all of this.

There's nothing stopping me from displaying this on the website. I can just tap into this and I could have an armory view of this on the website. Same with the map as well. Right now we haven't really discovered much, but there's nothing to stop me from displaying the map on the website and having an overlay of things like points of interest and things like that that are stored on the server.

Kris · 1:02:43
All the same code and data, just a slightly different renderer.

Keone · 1:02:46
Yeah, exactly. Or there's so many possibilities of what you could do. I could have alerts and things for, "Oh, this world boss is up," and I could send that to the website, to Discord, wherever. There's so many possibilities.

Kris · 1:03:05
Yeah, I want my achievements in game up on a publicly viewable website.

Keone · 1:03:11
Yeah, that would be fun. For me, coming from other games such as Warcraft, there's something nice about having an armory where, even when I'm not in... I remember when I was younger, I used to play a lot of Warcraft, and I used to have my characters, I used to have the armory things bookmarked in Chrome and everything. So I'd have that and I can click on the way to say, "Oh, you know, I've got this many achievements out of this thing." It's satisfying. It's like filling up your raid progress and all of that, and it's kind of a page where it's showing off.

"This is this character's achievements," and you can show that off without having to go into game. So being able to do that is undoubtedly something that's going to come in the future for Elegon.

Kris · 1:04:02
Cool. Cool.

Kris · 1:04:04
So tell me about the state of the game, to wrap up with. You're currently in early access, right?

Keone · 1:04:11
Yeah, right now we're in a Steam playtest. And I'm looking at getting the game into more of a traditional early access. I actually haven't announced this on my YouTube channel, I've announced this to a smaller amount of people, but mid to early 2027 is when I'm aiming to get this into an early access position on Steam. So it will come out of playtesting, it will be in early access, there won't be any more character wipes at that point. So that's several months away, but that's crazy to think that I've been working on this game for a year and I'm already thinking about early access.

If you would have asked me as a solo

Kris · 1:04:54
developer 18 months ago...

Keone · 1:04:57
Yeah, I would have thought it'd be ludicrous. So yeah, it's brilliant.

Kris · 1:05:05
Nice. Well, I wish you the best of luck with it, and I will have to see you in game and watch it develop.

Keone · 1:05:14
Yeah, I love it. I love seeing everyone online, I love seeing people enjoying exploring it and providing feedback. I've been really enjoying developing this, so I can tell... I'm just happy. I'm happy to be able to talk about how I'm using Spacetime as well, because I'm not some sort of game developer of twenty years' experience or anything like that, but I am able to build this world that I wanted to build, and create systems in the way that I want them to behave, and it's enjoyable doing that. So, being able to talk about how I've gone about doing that, and my understanding of these systems...

Hopefully it helps anyone that is considering building a project like this, or maybe even just a smaller-scale multiplayer game, or maybe not even a game at all. Maybe you just want to build something with networking. Hopefully this inspires some people out there.

Kris · 1:06:19
I think it will. It's great to see you getting lost in building the game rather than getting lost in building the infrastructure.

Keone · 1:06:27
That's cool.

Kris · 1:06:28
Yeah, I hope it has a very bright future.

Kris · 1:06:32
Thanks so much for taking the time, because this is really interesting.

Keone · 1:06:35
Yeah, of course. Thank you for listening to me ramble.

Kris · 1:06:39
Pleasure. We'll have to bring you back once you're into early access. We'll have to do a live playthrough or something.

Keone · 1:06:46
Yeah, do a little comparison, see where we're at.

Kris · 1:06:52
For now, I'll leave you running it. Thanks very much.

Keone · 1:06:54
Thank you.

Kris · 1:06:56
Huge thanks to Keone there for taking the time to take us through it. I don't know how much this comes across on camera, but he is such a nice guy to talk to. I hope you got that vibe, because I really do, and it was a real treat for me, because I want to spend my time building things that help developers build things, and it's just a joy to see what Spacetime has helped him put together. If you want to try Elegon, you will be able to soon, so head to Steam and add it to your wishlist, and then subscribe to Keone's devlogs on YouTube. All the links are down there in the description.

If you enjoyed this video, give it a like and subscribe, because we've got more coming. And if you're thinking about building your own multiplayer game, or anything else, head to SpacetimeDB.com and get building. I'll see you next time.