Thinking of games as databases
ajmmertens.medium.com
ajmmertens.medium.com
When you open a container in the game, and it doesn't have a specified set of contents, the contents get loaded by picking randomly from a category linked to in the database. If, in one of the db tools, you follow the link from the container you can see what objects could load in it and by what likelihood. You can then follow those links through the db over to the object itself, which is also made up of db entries.
From the scripting system you can access the db for some amount of functionality. Their db doesn't contain the models or textures or strings. But it does contain the location of every tree in the game. If you wanted a mod with a dozen golden crates to go find, you would use the db system for the logic.
However it is not 100% documented what kind of optimization this "query engine" has implemented, there are some vibes that sometimes it could be faster than a full scan.
A serialized data format is here if you are interested https://en.uesp.net/wiki/Skyrim_Mod:Mod_File_Format
In case anyone’s interested, this is the source for it: https://github.com/SanderMertens/flecs/tree/master/src/addon...
Any system that could be queried needs to be built and maintained. Creating game entities that have models of feeling or have opinions about the groups of people they belong to has to be modeled and built. Unfortunately game dev is very informationally and financially sparse so creating these systems is a huge undertaking.
I heard a joke once about OOP: if you want to create a form that accepts payment information you must first create the universe. The joke speaks to a danger of overdoing your conceptual modeling. The real trick of a true craftsperson is to create a model that is excellent at solving the problem on hand.
What I’m saying is we’re a long way away from game entities behaving like west world hosts and embracing the ECS paradigm isn’t the answer. Just like how switching from OOP to functional doesn’t actually solve creating a profitable business.
Most single player games are not "true games". They are puzzles. This is also how players perceive them.
As defined by Chris Crawford a game requires competition. Multiple agents who play, which creates the possibility of win and loss.
In most single player games, the game agents are not equal competitors who can win. They are only obstacles and challenges for the player. Even if the game is built with difficulty in mind.
So the mistake of thinking of actually intelligent game agents is like thinking why doesn't the Rubik cube ever win. It's not why someone plays it.
Notable exceptions are where software is used to substitute a player in a multiplayer game, where they do usually maintain the game structure and compete.
Nintendo single player games are often considered the gold standard of games in different genres. Mario, Zelda, Pokemon are all household names.
I do think your points were interesting, so thanks for sharing!
Someone playing Zelda doesn't go into it ever expecting Ganondor to try to win. The player either solves the game, or they stop playing. But they can't lose, which is why I called it a puzzle.
In comparison to something like Chess AI where the computer agent is actually trying to win and make you lose.
So you'd find players asking whether it's single or multiplayer and competitive or casual and so on and they're really trying to place the game in that categorization. Is this game just a series of challenges for me, or are there opponent agents trying to win.
This is definitely news to me, I have not ever met someone who feels this way who plays videogames.
https://www.cs.cornell.edu/~wmwhite/papers/2007-SIGMOD-Games...
If the title was a bit more accurate to its content, it would avoid a lot of disagreements here.
"Building games with AI agents? Use a graph database." -- or something like that.
https://github.com/samsquire/ideas#71-gaming-interfaces-for-...
Even the mouse is a database https://queue.acm.org/detail.cfm?id=2169076
I want a graphical representation of the spatial properties in a database
The reason I went down this path - I was thinking about streaming gaming and how we could potentially keep 1 representation of everything in memory and service hundreds or thousands of players with the same data set. Think tables like Scenes, Entities, Viewports, etc. Big picture, I felt like you might be able to pull off something at scale with a bunch of read replicas over a big boy SQL database.
Indie Devs should be thinking of games as products to complete first and foremost. Don't get bogged down in articles like this, or what's the best tech. Just ship it.
Large studios should keep this in mind as well.
Lately, the trend seems to be: live service is 100% at release, core game play and narrative are wanting.
In my experience and based on convos with friends at other studios, good producers (product owners) are hard to come by.
Of course devs would pin the blame on ops/production, but I think it's a really interesting problem that has plagued studios of all shapes and sizes.
"Make games that are fun to make." Sometimes that means "thinking of games as databases."
100s of games released every day across Steam and the App Store. Who cares? I guess they shipped, but then what?
> Don't get bogged down in articles like this, or what's the best tech.
Jonathan Blow is excited about Jai. That makes him wake up every day and commit. Secularly Jai will not make the game better. But intellectual stimulation helps you ship.
So your advice is a negative sign in front of the right answer: it's pithy and simple, but it's 200% wrong. It's so far off the mark and so steeped into the exact kind of hustlebro culture that is responsible for the 100:1 ratio of bad games to good.
> ...maybe good for very big companies
Big companies struggle to innovate. They worry way too much about shipping, deadlines, whatever. So they wind up with the least risky and conservative game design. They are interested in deep tech because, if you're making the 100th CS:GO clone, it makes the work intellectually stimulating enough to make you wake up every day and grind 65h/wk for Riot's garbage pay, not just because it makes some kind of secular sense.
Yes, it's a good one. Since he started working on Jai he hardly shipped any game. Thanks for providing examples that supports the parent comment.
why do you perceive this as a problem?
Braid: 2008
The Witness: 2016
Braid Anniversary Edition (Jai): late 2023
Untitled Sokoban Game (Jai): TBA
also, Jai, even in its incomplete state, is a fantastic product.
> why do you perceive this as a problem?
It's probably not a problem for him. It's not a problem for you either, if your studio can afford spending 7 years on a tool that doesn't generate cash flow.
Again I have nothing against Blow. But it's a very good example about how much time it takes to make your own tool chain, even for someone who's smart and experienced. For most of us, we'd better utilize boring techs to ship lowkey fun games.
That's an opinion. Maybe if you looked closer, you'd see: if it weren't intellectually interesting, he wouldn't ship any games, as opposed to a bunch of really cool and fun ones.
I can only speak personally. As a game designer, I have never regretted "not" "shipping." Spending the time on design instead, I feel my opinions are far more valued by my design and directing customers, who have bigger budgets and thus will have automatically greater success marketing, polishing, "shipping," etc. anyway.
If you think you need to ship in order to find out if something is fun... well, there's your problem. What do you think game design is, an A/B test?
In contrast, my former colleagues who emphasized shipping, in the last decade, they have spent 100-10,000x the budgets on putting kind of dull stuff into the App Store. And it was only marginally more stuff.
Anyway, I wouldn't ever ask them for an opinion about game design, or whether a prototype is going to be fun, but I would ask Jonathan Blow, so there's that.
So it's extremely common polite etiquette in the indie game developer to remind people that the end goal is a fun product that you can sell. Many many people lose a ton of money during indie game dev, and it's always a tragedy.
If you want to use a no code tool like playmaker over coding, then do it. As long as you ship the code. Just keep shipping out your game.
Seriously.
Compile a bunch of prepared statements at load time to take the parsing and execution planning out of it, keep it all in memory... On the surface it seems like it would work.
And of course, saving the entire game state would be as simple as just flushing the DB to disk.
Moving to SQLite makes theoretical sense, but you lose the benefit of cache coherence as a result.
Though you probably do gain other benefits.
Also, I'm not sure I understand how cache coherence would be relevant in the context of what the article is discussing, querying across all game entities to answer complex questions.
Wouldn't cache coherence matter more in the case of single object access?
With any kind of database - even in-memory SQLite - there is a query interface between you and the data. In ECS you access data directly, which is at least an order of magnitude faster.
I’ve set up the tech for many games over the decades where we had designers write tiny snippets of code in the cells of Excel spreadsheets. First in a custom assembly-like language (for an N64 game) then in SmallC, actual C++ and mostly in Lua.
The general theme was to use the grids to define state machines. Rows are states. Columns represent events. Cells define what to do at the intersection of an event in a certain state.
Later games also used Lua code cells as active spreadsheets in the game. The Lua statements would calculate results when queried. The charts didn’t just know about raw numbers and strings. They also could load and manipulate assets in the game. So, a designer could describe which UI asset to put next to the health bar based on the player’s current health stat without bothering a programmer or artist.
In the last case, we shipped two very different 3D mobile games using the same executable but different assets. Live hot-reloading of the Lua charts, the UI XML and all the other assets meant that we didn’t even need to bother making an editor for our custom engine. A good text editor window next to the game window was productive enough.
Naturally, my own games also use user-editable data files. Sometimes very similar spreadsheets, borrowing the structure from you. Paying it forward.
Thanks for Diablo II.
Specifically, at least in my experience, foregrounding database thinking when making game rules tends to make it easier for designers to add more rules and rule variations, or a lot more "content" generally, that tends to be more shallow and less novel in terms of surprising interactivity.
Now, that can be a desired kind of game design! If you look at something like, say, Gran Tourismo, where the pleasure is in having hundreds of real cars modelled, that can be really enjoyable to a certain kind of player. And of course most static level data is just a giant collection of non-interactive data variations as well. There are certainly other examples.
But if you sit down with, say, the original NES Legend of Zelda, with a paper notebook in your lap, and every time you encounter a new enemy, you write down the enemy's name, what is interesting about them, and what you might have to do to implement them, what you're going to notice is that the lion's share of enemies have custom behavior and interactivity that will need to be special cased, and that that is all the meaningful work of implementing that enemy.
Now, obviously, you COULD still use something like a database as the central repository for distinguishing the identities of all of the monsters and their properties. But in practice, the property of "it gets on top of you and eats your magic shield" is only used by the Like-Likes, the property of "it grabs you and drags you back to the dungeon start" is only used by the wall hand guys, and on and on and on, and _aesthetically_ the game benefits from the fact that each interesting enemy property is only used by each unique enemy (or so I would very, very strongly argue).
I've sat down and performed that "notebook in the lap" exercise with a bunch of games in the past, with Half-Life, Castlevania:Symphony of the Night, and Mario 64 being particularly fruitful (the same exercise works for items and weapons in a game, and interactive objects in game levels as well). One of the big traits that makes SOTN the game that it is is that a fair number of the weapons and items in the game have all sorts of strange, surprising, extremely special case game code, like the Shield Rod.
My personal experience from working on game dev teams as a game programmer/designer is that, as game programmers are drawn more into database thinking as the lens for expressing game design, the kinds of sparkly, jagged, surprising rules I just gestured at start feeling more and more like violations of the architecture of the system, gumming it up and making it ugly, instead of the actual wonderful desired point of the entire enterprise of game making.
And so instead you get games where much of the variations between items or weapons or enemies are things like statistic percentage variations - this weapon has +20% critical hit chance compared to that weapon, this enemy absorbs that kind of damage, this weapon has that attack speed, this enemy has that running speed, this enemy can or can't throw grenades, and so on.
I feel like I encounter this kind of design a lot in more recent games made by large teams. And it makes sense. Often management needs tighter control over game rule possibilities because they have large teams and novel surprising custom game rules are legitimately unpredictable and hard for teams to control or reason about - especially in the context of long-lived games that are going to be maintained by lots of random people coming and going over a long time frame. Having weapons/items/enemies that vary only by properties make it easier to add or remove them to hit deadlines without breaking the critical path of the game, they're much easier to apply analytics to for balancing, and they're much easier to use as DLC without affecting games in potentially show stopping ways, too.
But there are absolutely aesthetic ramifications to this approach. At any given moment, when a player is playing a game and deciding, without consciously recognizing it, whether they're going to continue sticking with a game or whether they're bored, the question of what new kinds of new stuff they might still encounter if they keep playing is definitely a factor. And what kinds of rules a game designer can and does vary heavily affects that.
One day it clicked that this revolutionary idea sure looks a lot like a series of queries/views ("Systems") on a bunch of database tables ("Components") foreign-keyed to a single object ID ("Entities").
Some people can overcomplicate anything...