Hello everyone. This is Arvi Teikari and I'll be talking to you about the game Baba Is You and specifically the rule system and the rule parsing system of Baba Is You. This is the kind of a virtual talk as part of the GDC talks. Uh if you hear some kind of white noise on the background in some situations, I'm unfortunately recording on a computer that apparently just randomly starts doing something really heavy on the background. I have no idea what it is and the fans are very loud, so uh I don't think I can do much about that. I hope it won't be too distracting. Also, if my eyes uh kind of linger somewhere else and I'm looking at the camera in some situations, don't worry. I'm just looking at the slides. I need them as a kind of a reminder. So, uh I'll take a
sip of my tea and let's get started. All right. So, if you haven't played Baba Is You or don't know at all what I'm talking about or what the topic is about, then don't worry. I will start the uh presentation with some introductions. I will explain who I am and what is Baba Is You. After that, I will go to the actual topic, the rule system of Baba Is You and the rule parsing system of Baba Is You. I will tell what it is, how it works, what kind of phases it has gone through, and finally I will explain some obstacle and problems with the system, uh kind of complications that I'm faced with the system right now and earlier in development. And finally, I'll just uh kind of gather my thoughts with some conclusions. Uh let's get started. Part one, introduction. So, who am I? As mentioned, I'm Arvi Teikari,
uh also known as Hempuli on the internet. Hempuli. Uh I'm a game developer from Helsinki, Finland. Uh and I started making games as a hobby in primary school. I had already been interested in making uh video games in kindergarten because my cousin had a Super Nintendo and my brother also played a lot of video games. And uh Super Mario World on Super Nintendo is probably the kind of biggest singular thing I can remember from my childhood as being kind of an inspiration to start making games. So, in primary school, a schoolmate asked me if I wanted to make games and showed the the program GameMaker to me. And we started making games together. But the problem with GameMaker was that it has its own scripting language, the GML. And uh since I was a primary schooler, I had a pretty low attention span and I didn't understand English very well. So, the having to learn the scripting language turned out to be kind of a
uh big roadblock. I just didn't have the patience to really get into it. And also, it was very slow to learn it because I didn't understand the I kind of had to learn by trial and error. So, eventually, I've another schoolmate showed this program called The Games Factory to me made by Clickteam, which was actually pretty popular in Finland during that time in like 2002 or 2003. A lot of a lot of kids using it. And it was cool in that it didn't require any scripting at all. It has a had a purely visual interface uh with its own kind of visual coding called like conditions or event system. And uh because everything was on a list, even though everything was still in English, it was way easier for me to start learning it because they were the kind of trial and error approach was much much more doable in there and also I was kind of slowly learning English on the side as well. And uh I stuck with the Games Factory and
eventually moved to its sequel or successor called Multimedia Fusion. Uh Multimedia Fusion turned into Multimedia Fusion 2 and right now it's Clickteam Fusion 2.5 and 2.5 plus. Although I stopped following the progress at Multimedia Fusion 2 because I was so used to that program and I've been using Multimedia Fusion 2 ever since. Uh but and uh basically all of my games that I've put online have been made made in Multimedia Fusion 2 including Baba Is You. Uh also in 2010 I participated in a physical game jam for the first time. Uh I had already participated in the Ludum Dare online jam and liked it quite a lot and because I didn't really have that many friends or any friends that that were interested in game development except on a like very surface level. It was still a very kind of nerdy thing in my mind at that point. It sounded super cool to be able to go somewhere else and meet other game developers that I know over the internet. So I went to Shuv the to No
More Sweden. Uh don't worry about the name. It's not like a anti-Sweden game jam. It's organized in Sweden. The name is more of a pun. And uh I had a super nice time. I got hooked in the game jam experience and later went to Nordic Game Jam in Copenhagen and both those two kind of became my staples. And they became very important part of my hobby because they involve a very nice sense of social interaction and prototyping and working fast and not really worrying about bugs. All of those were big plusses for me. And this game development hobby eventually turned into a commercial job. Uh I made a company Hempuli in 2015 and released my first commercial title in 2015 as well uh called Environmental Station Alpha and then later in 2019 I released Baba Is You. I also worked on the game Noita in the Nolla Games team although with different tools to some extent. I'll check my time at this point. Okay,
looks fine. Well then, so for Baba Is You it's a block pushing puzzle game following in the footsteps of Sokoban which might not have been the first block pushing puzzle game but kind of sets the genre in stone. The idea is that it's a grid pa- grid based usually top down not always top down game where you have some kind of blocks you can push around and uh you control some kind of a character that is locked into the grid. And uh in the very classic Sokoban style game you have boxes and you have slots for the boxes and the idea is that you have to push those boxes to fill every slot. And when every slot is filled with a box you win the level. Uh and in the past couple of years this genre has kind of seen a I don't know like renaissance or something. The There have been a lot of games in the genre that take this basic concept and twist it in really interesting ways. I've been super into
this kind of uh I generally really enjoy this concept of taking a simple idea and then just kind of taking it into different directions and seeing what happens. Uh especially Stephen Lavelle with their uh puzzle script and other games have been a very intriguing kind of approach into this block pushing system. And uh in Baba Is You the gimmick the twist to this block pushing system is that there are usually three-word rules that govern how the game works that dictate what happens in the game. And the neat thing is that the words that make up these three-word rules are also pushable blocks in the game world. So, not not only are there like rocks and other things you can push around, there are also words. And because they're pushable, you can rearrange the words and make new rules. So, you can change the rules of the game as you play it.
And that is kind of the the very core of Baba Is You's gameplay and the thing that makes it interesting. Uh I created Baba Is You originally in Nordic Game Jam in Copenhagen in 2017, uh which is why why I mentioned the game jams in in the first place. The game at Nordic Game Jam has usually a very loose theme. You don't really have to follow it that carefully. But the theme that time was not there. And uh I for some reason concentrated very heavily on the not part of the theme. I kind of started thinking of how in logic you can have some concepts and X, and you can reverse its meaning by saying not X. So, you can kind of change the meaning of things with not. And uh this mental logic concept combined with these block-pushing games I had played over the years and some other puzzle games, uh such as games as Stephen's Sausage Roll, Snake Bird, A
Good Snowman Is Hard to Build, Braid, and Corrupt. And uh I kind of pondered up on those puzzle games. I had wanted to make a puzzle game for a long time, but had always had some problems with the implementation implementation and ideas. And eventually this these concepts in my mind kind of amalgamated into this uh idea where there's a top-down block-pushing game where there's a pool of lava, and the lava is obviously hot. And there are blocks of ice, and the ice, of course, melts in the lava. So, if the ice comes in contact with the lava, the ice melts. But, as you can see here, where is my cursor? There's my cursor. Uh in this mental concept, you could state ice is not melt to make the ice not care about the lava. This sounded kind of a dubious idea at first. It sounded like something that would run into implementation problems or wouldn't be very interesting to play with. But, the nice thing about game
jams is that it's very easy to just go and try out something and see if it works. Make a prototype and throw it away if it doesn't. So, I decided to prototype Baba Is You. And over the game jam, the idea kind of progressed. For example, whereas originally I had had this concept of lava being hot by default and ice being meltable by default, I decided that it that it's actually in more interesting if lava and ice are nothing by default, but instead you have to state lava is hot and ice is melt separately. So, that like nothing in the game world has meaning unless there are rules applied to them. I think that's a pretty cool concept and I went with that. And uh Baba Is You ended up winning the game jam. It was voted the best game of the jam that year. And uh because of that and because of encouragement and uh persuasion from other game developers, I decided eventually to uh make a full game out of it.
And uh I worked on Baba Is You for almost exactly 2 years from 2017 to 2019. And over that time, it also won some other awards and was in some events. The most notable award was probably the IGF Independent Games Festival Excellence in Design and Best Student Game Awards in 2019. And in March 2019 uh sorry, 2018 uh was the Independent Games Festival, as you can see here. Uh I said it wrong. So, in March 2019, the game was released and it's been fairly successful, so that's also cool. Yay. Anyway, I'll check the time. Here we go. Let's move on to the actual No, I'm forgetting something. Yeah, so because I've only explained Baba is You concept only by words, kind of in theory, so far. I have some pictures to kind of indicate how the game works. Uh so that it it's
easier to grasp what the game is about in case my explanation was too fast or too difficult. Not Not too difficult. Too confusing. Too bad. Anyway, so here we have two pictures indicating the basic gameplay of Baba is You. So, here we have the creature Baba. As you probably guessed, the name Baba is You in itself is already a rule. It means that this creature, Baba, is You, the player. So, you control Baba. And here, let's assume that Baba is You, the rule is somewhere out of out of way. Here we have wall is stop and flag is win. And we have this wall of wall and then the flag here. And Baba needs to reach the wall needs to reach the flag because in Baba is You, you win a level not by
pushing blocks into marked spots, but instead by having something that is You touch something that is win. So, if Baba If Baba is You and flag is win and Baba touches flag, then the level is won. And I'll have to take some tea. Sorry. And here, Baba cannot reach the flag because wall is stop. Baba cannot move through the wall. Because wall is stop. Wall is solid. But what Baba can do is or the player can do is break the rule, the wall is stop rule, to misalign the words so that wall is no longer stop. And as you can see here, Baba can walk from here there and uh move through the wall and reach the flag. That is kind of a very basic way the game game can function, how the puzzles can function. As an other another example, here let's assume that Baba, the creature, is somewhere
not seen but like existing. There's the rule wall is stop again, flag is win again. Now Baba is you, the rule is also visible. There's again the kind of square of wall that Baba cannot move through. You could solve the situation in the same way as before. You could break the wall is stop rule. But if we for example assume that the wall is stop rule is somehow located so that you cannot change it. Then what you can do is say wall is you. You could replace the stop with you, but you can also do this. Wall is stop, wall is you. And make the wall the player character. In this situation, Baba would no longer be you and Baba would be nothing anymore. And instead the wall would become the player. And then the the this cartoon or comic series doesn't really indicate movement very well. But here the wall would move to the right a couple of times and reach the flag because they would now be the player
character. And since when something that is you touches something that is win, you beat the level, the level would be won in this situation. So yeah, that's the basic functionality of the game. There's a lot of complications later, but that's the basic gist of it. Anyway, uh yeah, let's move on to the actual topic. So, the rule system of the game. So, there are all these rules, but um but the game needs to somehow translate those rules that exist in the game world into some kind of a format that it can understand on a code level in the game logic level. And uh because I hadn't seen any other game do anything like this, I felt that I needed a pretty novel solution for this. Also, because I was making the first version of the game during the game jam, the first version had to be very simplistic and quick. So, I just made up something. It was a very crude solution, but it worked. I was pretty happy with it. So,
uh I had to figure out some quick dirty solution fast. Um And uh since after I decided to make a full game out of Baba Is You, uh the rule system evolved a lot over the 2 years of development. Uh there were several rewrites and uh rebalances and re-whatevers over the over that time. But, the basic structure of the rules stayed the same. So, uh while in game, the game kind of has a list of rules which it kind of uh What is the word? consults to find rules to check how what rules there are. And there are three components that make up every rule, that are at the basis of every rule. So, the these three basic
components are uh firstly, the object, which is a Baba, rock, wall, flag. Uh it could also be called subject, but I I kind of like object because I call the things that actually exist in the game world objects as well. An object basically indicates which thing, which object does this rule apply to? What is the target of this rule? Then there are verbs, for example, is that uh act as kind of connectors between this first type and the third type of words in the rules. And they kind of modulate the interaction between the first and the last words. They kind of indicate how the third word affects the object.
And uh depending on the verb uh they can do different things. Finally, the third type quality which is basically you, uh for example, or move or push or win which is effectively the kind of effect that is applied to the object. Uh in some situations, some verbs might also accept other objects as their as a kind of connecting thing. So, you could say Baba is you, flag is win, rock is push, wall is stop, and so on. So, you could connect object into a quality. But you could also say Baba is wall or Baba is flag to create a kind of a transformation effect. And in this in that case, it would be the verb connecting two objects. So, there's some some kind of flexibility there. But still, those three parts of the rule are
all are always there in some form. But there can be additional components, as you will see uh in just a moment. So, uh as I as I alluded to during the gameplay, the game logic basically works is built around the game asking different kind of questions from this list of rules. So, it will go through the list of rules in different ways and check like uh which objects does this rule apply to? Uh what rules what rules does this object specifically have? Or uh does If I have this rule, does this specific rule apply to this specific instance of this specific object? That kind of stuff. Or what what kind of qualities are connected to a verb? Or what kind of objects are connected to a verb? How does the how what kind of things is the verb
modulating? And then the rule system tells that, "Hey, okay, I have I have this rule. Do what you want." And then the game logic tries to interpret those rules uh as it best uh as well as it can. And uh I will next be explaining the kind of uh structure of the of the rule forming process, the rule parsing process. And uh the most of the rule parsing logic is implemented in the Lua scripting language. And I'm pretty sure that a lot of people who watch this talk already know what Lua scripting is and know what tables are. But, I'm going to explain tables quickly to just kind of just in case someone doesn't know what Lua tables are or wants to get like refresher or something. So, Lua tables are basically databases of key-value pairs. So, there's some
kind of a key, which is if you think of like a shelf with boxes, the key is kind of the notes on the box that it's kind of ID, it's identifier. It can be a number or a string, so you could have a shelf of boxes where the boxes have names or numbers, and then you can find a certain box using the its name or number. That is the key. And then every key is connected to a value, and the value can be quite a few things. Basically, these are the boxes in this metaphor. So, the box or the value can be a number or a text string. It can even be a Lua function. It can be another table, a subtable, so to say. So, there's a lot of flexibility in this system. Uh and that is that makes it really powerful, but also kind of uh susceptible to certain kinds of bugs and errors, and I think some people are
not huge fans of Lua in general or the Lua tables because they are so arbitrary, but I personally really like it how the Lua table can in in a single structure do many different data structures from other languages. Uh table can be an array, it can be a list, it can be other more complex types of databases just in the same same thing. And I've even drawn this small MS Paint diagram to explain the idea of a table. So, here's this box is table, and later on when I explain things, if I if I have these kinds of boxes, these are the tables. And within the table, we can have, for example here, with a key one or slot one, we can have the string A. Or in slot two of well, value two, we can have the string hello. Or with the key hello, we can instead
have the number three. Or we could have the string "hello" be the key and the value be also "hello". Everything works or whatever works. Here here's also the key "foo" has the value function and the function can then be defined. Uh or the key "bar" has a subtable which in turn contains other key-value pairs. That's the basic structure. It's neat in my opinion. So, how it actually works? How does the rule forming the rule parsing part work? Uh the initial problem is of course that we have a level with a lot of words. And the words can be in all kinds of configurations. There might be there might be kind of jumbles of words as a huge mess. There could be a single words word somewhere. There could be just whatever. And uh some of these words might form valid
sentences that can make make rules. You can already see here vertically "Baba is you" or "Rock is push". But then there's stuff like "is grass you" which is just nonsense. Or there's just water which is doesn't do anything. Or "wall is" which is almost a working sentence but doesn't work. S- And the solution to the problem of how to handle how to make these objects that are words into sentences that the game logic can use lies in having doing multiple passes throughout the level and throughout the these uh potential sentences. And I will now go through all these passes in a kind of a slightly abstract way. So, the first pass means that these uh the uh kind of the rule logic tries to find all words that could be the first word
of a sentence. Uh, and because for some game design and some simplicity reasons, all rules are either from left to right, I think this is your left to right, or top to bottom, and they have to be in a straight line. They cannot do L shapes or curves or whatever. Uh, basically, when checking which words could be the first word of a sentence, the game only has to check uh, is this Sorry. Uh, is there something above or to the left of a word? If there's nothing to the left or above a word, it can be assumed that it might be the first word of a sentence. And the game then adds all these potential first words into a list, goes through them, and checks how many other words they are linked to. In other words, how many words are below them or to the right from them. Yeah,
that's right for you. Uh, and in this situation, the game only cares about just finding words. It doesn't care about what those words are. And because, as mentioned earlier, the basic rule structure structure always has at least three components, the object, the verb, and the quality. Uh, any sentence or word mhm, kind of lines, strings of words that have less than three words can be discarded outright. So, here we can see that Baba is you rock is it's four words, that's fine, that works. Let's Let's add it to the potential sentence list. It doesn't matter if it works or not. Then there's rock is push, is a you, again, who cares if it works? It looks fine, so let's go with go with it. And flag flag has win also has three words. It's more than one or two. It
works. Water or wall lava or wall is are all discarded. They don't get long enough. Technically, the game game even tests if this is might be the first word in the sentence going in this direction, but obviously because there are no words words here and is cannot be the first word of a sentence, then it it's just discarded. Anyway, these uh potential proto sentences get get to go forward to the second pass. And in the second pass uh the game kind of goes through these sentences a bit more carefully and uh tries to figure out kind of roughly if they might be sensible rules. And here uh something called word type becomes very important. Every different Every different type of word has its own
ID number. For example, Baba, the object, has type zero. Verbs like is have type one and you qualities have type two. And in this second pass, the game kind of starts from the first word and goes from there and checks using a certain a pretty complicated logic, actually, if the words follow this like if the word types follow a certain well, logic. I guess I repeated myself there. Um and even in this situation, there might be some cases where the sentence doesn't actually make sense, but if it follows this certain logic, it will get past this second pass. To give an example, in this first image image, we had Baba is you rock, which passed the first pass. In the second pass, the game checks that okay, Baba is you, yeah, that works.
There's type zero, type one, type two, everything is fine. Then it finds rock and thinks that okay, no, rock cannot follow you. Let's discard rock. And then it said, okay, Baba is you works. We'll use that. Rock is discarded. And it does the same for rock is push and flag is win. Flag is win also is type zero, type one, type two. So, it it gets gets a pass. Uh but if a word is discarded in this situation, it still has a second try because it could be that sometimes a word that is discarded because it doesn't fit a certain rule might fit another rule on its own. So, for example, in this case, if there is Baba is you, rock is push vertically all the way through. Uh when rock is discarded, the rock would still form a valid rule with rock is push. So, it's important that when the game checks that Baba is you rock, okay, rock doesn't work with
Baba is you, let's remove rock, that it returns back to rock to notice that hey, okay, rock is push is a valid rule again. So, it kind of yeah, there's a needs to be some safety there so that accidentally rules being next to each other don't kind of cause that each other to not work or something like that. And uh as mentioned earlier, there are some other word types that were added later that complicate this process enormously. This second pass is probably the most complicated part of this rule parsing system because of those extra rule types. Anyway, so here we have Baba is you, rock is push, flag has win, which go to the third pass. I'll check the time. Okay. Uh and in the third pass uh this is kind of in this situation the rules are finally
evaluated fully to see if they actually kind of make sense. And in this situation uh instead of just checking the word types the game checks which word words allow which words to follow them. So for example flag has win worked in the second second pass because it it had the correct word types. But in third pass uh has doesn't allow qualities like win after it. It only allows other objects. So you could say flag has Baba, but you cannot say flag has win. So in the third pass this flag has win rule gets disregarded and removed or discarded I guess. Uh as as we can see here. Uh and so in this example picture flag as win got
removed. We were left with just Baba is you and rock is push. And these two sentences, now that they were verified to work they are then transformed into a format that the game can understand and the game logic can use in the actual like in game in game functionality. Uh and they they get added into different rule lists. For example, there's a kind of a global rule list that has every single rule in it, but there's also there are also object specific rule lists. So that if I want to see which rules does Baba have, I don't have to check every single rule. I can just check from like a Baba specific list. It's nice. Uh and before everything is done, there are some extra step steps. So, finally, uh before the game is happy with the rules, it needs to do some complicated shuffling
related to conditional words, which is a kind of a special word type that I will cover more later. And it will have to make sure that the words are kind of in their own respective groups. Also, more about that later. Uh also, the game needs to handle rules that might kind of create other rules, because there are some rules that don't really do much in themselves, but during the parsing process, they get divided into other rules. A good example is all is you or all word in general, because all is you basically just means that every object in level is you. So, instead of just saying all is you and having hard-coded special code for all, the parsing system divides all is you into Baba is you, rock is you, wall is you, flag is you, and so on. And then, same happens with uh not Baba is you. Not Baba means that everything that is not Baba is you. So, here,
rock is you, wall is you, flag is you, but Baba isn't you or Baba is nothing by default with this rule. There's also There are also rules that might disable other rules. Again, with the not word, we could say Baba is not you, and this takes priority over Baba is you and disables Baba is you. So, in this situation, after parsing the rules, uh we need to go through the rules again to see these situations where some rule needs to be marked as disabled. Uh some people have wondered if this Baba is not you type thing depends on the order of the rules somewhere so that whichever is first takes uh priority, but because Baba is not you would not do anything on its own if it was had kind of lower priority. I made it so that these disabling rules always have higher priority than the rules they disable. And finally, there are some visual things like throwing particles around,
uh playing sounds, changing the color of the active rules, and marking disabled rules, stuff like that. It's not really relevant for this presentation, but it happens. Okay, so then as for the kind of how the rules are stored in this list that I've mentioned a couple of times. So, after parsing the rules, when they're added into the rule list, what is the format they use so that the game logic can understand them? This has been a very long process to get right. As mentioned earlier, I did a really quick implementation at the game jam originally, and the it has required at least five iterations and at least three almost full reworks to get this stuff working properly, and it's still not working properly for multiple reasons that I will I will cover in the obstacles uh area of the talk. Uh so, I basically I just started with a simple system, augmented and added to it
as needed, and eventually, inevitably, it became too bloated. It had too many corner cases, too many hard-coded special things, uh or I wanted to add some extra feature that was just impossible to bolt into the existing system, so I just had to decide to rewrite something, either the whole rule system or just a part of it, and then start a new iteration. So, the first iteration of the system was very simple, as mentioned. There were basically all the rules were just three words long at maximum. I only had to check if a rule has three words and if they follow the object verb quality or object verb object system. And if they follow that structure, they had no fewer no more words and the words follow this logic, then it was guaranteed that it was a working rule. So, that was very nice. And parsing, yeah, parsing was very simple, same for the formatting. Here's
actually a diagram showcasing how the rule was formatted in the list in the kind of Lua table that is the rule list. So, here's the global rule list, which is a table. And within that table, there's the rule subtable. This blue thing is the actual rule as its own kind of box of things. Uh, that was some car horns outside. And within this rule, there was just the like the base rule uh base rule as three words stored in a table. So, in this table, in slot one, there was the first word Baba. In slot two, there was the second word is. In the third slot with a like key one two three, third slot, there was the word you. In fact, I made a slight mistake with this picture. This orange subtable doesn't need to even exist.
Like, just inside the this blue rule subtable, there can just be three slots with three words and that's it. But then, I added new words that complicated things enormously, as mentioned earlier. So, I added the word and and conditional words. Uh, to start with and and basically lets you bundle words of the same type together so that they can be grouped, and it's kind of faster. You don't have to repeat the same thing multiple times in different areas. Uh, when it comes to its normal usage, it works pretty pretty simply. For example, you can say Baba and Rock is You, so you make a group of Baba and Rock, and they are both You. Or you can say Baba is You and Move, so you make a group of You and Move, and then Baba is both of those. And the nice thing about these is that the same with all earlier, I can just
divide Baba and Rock is You into two different rules, Baba is You and Rock is You. And with Baba is You and Move, I can just say Baba is You and Baba is Move, and it's the same thing. I don't really have to kind of do any special logic for the end except in the rule parsing phase. Once the rule is parsed, I can still use the same data format because that it's just the same thing, in other words. But, with these conditional words, things changed. Uh, so the first conditional word was on, and the conditional word, as the name implies, added some kind of a condition to the rule so that not every object had that rule, but they instead had to fulfill some kind of a requirement to get that rule. And the first Yeah, as mentioned, the first conditional was on, which meant that the requirement was that for example, Baba on Grass is You meant that
if Baba is on the same tile coexisting with Grass, Baba is You. If Baba is not on Grass, if there's no grass on the same tile as Baba, then Baba is not You. Uh, and these first conditional words had required these parameters. So, in this case, on is the conditional word and grass is the parameter. Baba on grass is you. But, I think the original version only had one parameter possible. So, you could only say Baba on wall, Baba on grass, Baba on Keke. Keke's another creature in the game is you or push or whatever. But, I very quickly wanted to add the and functionality to these conditional words. So, you could say Baba on grass and flower is you. And uh the problem with this is that because the conditional only applies to the single rule, I cannot do the same thing as here where I would divide the rule into multiple
things that kind of together handle the and kind of take care of the functionality of the and. But, instead, I had to add new functionality to uh account for the end. And because there could be an arbitrary number of objects or parameters for the conditional, this could be Baba on grass and flower and wall and flag and Keke and rock and Baba Baba Baba Baba is you. I needed to make a system where a rule could contain an arbitrary number of parameters. Yeah. And uh the first implementation of this say of this system the was very naive. I think my logic was that I wanted to keep the rule the kind of the order of things within the rule. This kind of what is in slot one, what is in slot two, what is in slot three, and so on. In the same order as they were in the actual sentence.
Which meant that I made a distinction between rules that have conditionals or don't have conditionals. Uh rules that don't have conditionals would still follow almost the same format so that they would be the rule list. There would be the actual rule sub table and in the sub table there would be on uh slot one, the object Baba, on slot two, the verb is, and on slot three, kind of the quality with some differences I will explain in just a moment. And if a rule had conditions conditionals, then the structure would be different. In slot one would be the object again, Baba, but in slot two would actually be the conditional because in the sentence Baba on grass is you, the on is the second word. And in slot three, there would be a sub table that contained all the parameters. So if I had
just Baba on grass is you, then in slot three would be a sub table with only one entry. So in in this sub table in slot one would be grass. If I had Baba on grass and flower is you, then slo- slot three would contain a sub table where in slot one would be grass, in slot two would be flower. And then slot four would contain the verb as usual or not as usual but like would contain the verb is and slot five would contain the quality you. And uh to keep kind of parity between these systems even though they had a different amount of slots used, uh I wanted to make it so that slot three would always be a table no matter what the format no matter whether the rule had conditionals or not. So in this non-conditional rule, I had to make it so that slot three is still a sub table. It just contains only the
quality and not grass or flower but the you and nothing else. And uh this system, as you can imagine, was very awkward because it meant that when testing if a rule exists, I had to actually do very different things. For example, if I wanted to see what the verb is in a sentence, I would have to check if the rule has three or five components and check either slot two or slot four depending on that. And uh if the rule had only three words, I would have to check the subtable in slot three in a different way than if it had five components. So, the ideal way to do this would have been a system where the structure is the same no matter if the rule has conditionals or not, but well, I I I think this worked for a moment for
me and I was happy with that, but eventually I had to rewrite it completely because uh I wanted to add more conditionals. Uh I wanted to add more conditionals with parameters such as near, where Baba near grass is you means that if Baba has grass somewhere around Baba, then Baba is you, or facing, where if Baba is looking at some grass, then Baba is you. But I also wanted to add conditionals with new types. For example, lonely, which doesn't take parameters, but works more as a kind of a prefix. So, you could say lonely Baba is you. So, Baba would be you only if there's no one else on the same tile as Baba. And as you can imagine, this old rule system couldn't accommodate. First of all, originally, I assumed that there would be only one conditional on. I didn't take into account other conditionals at all, but also this system was way too rigid to work with the lonely system at all.
So, I had to Well, I had to just like break everything and rebuild it. Uh and after this third iteration, the I found a system that I will show in the next on the next slide that has basically worked uh as it is until now. Or to this day. But, uh there have been some reworks and polishings, uh some even pretty substantial like underlying work, but the format has mostly stayed the same afterwards. Uh Yeah, yeah. Like there have been more exotic rules, more exotic words that have required extra work in the rule parsing system, but the formatting has been spared mostly. Okay? So, here's a nice diagram, very simple, very easy to understand diagram of how what the rule formatting rule looks right now.
So, uh even though you probably don't need any explanation, I'll go through this system briefly. We still have the rule list table. And within this rule list, we have these different rules in their own subtables. Here's rule one, here's rule two. They both contain the same stuff. I just didn't draw the same boxes within rule two. In rule one, there are three compartments that that contain different information. There's the base rule compartment that contains the same thing as in the first iteration. Just kind of the in slot one, Baba in slot two, is in slot three, you. The kind of object verb quality or object verb object structure. Then the second compartment is the conditional compartment, which contains all the conditionals the rule has. And uh because there can be an arbitrary
number of conditionals for reasons I will talk about in just a moment. And because those conditionals need to be able to have potentially arbitrary numbers of parameters, these conditionals need to have all their own sub-tables. So here in the conditionals compartment, conditional one has its own sub-table inside of which on slot one is the type of the conditional on in this case. And uh on slot two, there's the parameter list, which is its own sub-table. In this example, the conditional one oops is of type on and in slot two, it has only one parameter in the sub-table, grass. Uh but for example, if we did the Baba on grass and flower is you, then there would be again in slot one, grass, in slot two, flower. Uh and there could be several of these
conditional sub-tables and they would look pretty much the same. If there's a conditional that doesn't have parameters like lonely, it would still have the same structure, but the second slot sub-table would just be empty and treated as such. There's also the conditional never, which is done for disabling rules. It's kind of a special case. And the third compartment is the is storing the IDs of these words. Basically, it's like a reference to the in-level objects, the words as they as the player sees them visually in the game. These are needed because for example, when the rule becomes active and I want to display some particles or change the colors of the words, I need to be able to somehow refer back to the words from this uh formatted rule list. So the then I just looked into look into this word ID subtable, go through these, and
do whatever I want to all of those, and then, for example, like slot one might refer to Baba, slot two might refer to is as they appear in the level. I'd say it's a pretty nice system. It works pretty well right now. But then, as I've been alluding to, this system has its own problems. There are a bunch of issues with the system because I've been adding a lot more stuff over time. The game has become a lot more complicated over time. And certain new word and rule additions have made parsing everything way more complicated, even if I have this pretty stable structure. And here I will I will go through some examples. So, as the kind of rule system became more complicated, the amount of possible word combinations increased, the complexity increased pretty much exponentially.
And some of the words I added were really cool, but well, yeah, complicated matters even further. They made it even more difficult to make a stable, nice rule system. And right now, I don't think a stable, nice rule system is even salvageable. Here are some examples. First of all, there's the word not. Uh not does the same thing as I mentioned in the beginning of this presentation. Not turns the kind of meaning of a word to the opposite. Uh I gave some examples of where not is used, and in its basis, it's pretty it's pretty simple. But the rule system needs to be able to parse something like not Baba, not on, not grass, is not you, because not can go into many different places, and the rule system needs to be able to understand what it does in all those different places. Also, as a kind of a gimmick, I wanted to add multiple negation. So, not not not Baba is you needs to be parsed parsable as well. Then there's uh chainable conditionals.
So, as mentioned here, uh there can be multiple conditionals in a single sentence and you can do this uh for example by saying Baba on grass and near wall is you. And technically you can chain those forever. You can Baba on grass and near wall and facing Keke or something is you. And uh I don't think this system works uh perfectly right now. I think there are some bugs with it even right even now. I'm I need to work on that. I want to work on that. It's a still a pretty simple system. It just requires making the parsing logic a bit more involved, but it's not the worst, but it's still more complexity. Here comes a spoiler. I'm sorry, I forgot to warn you about this, but in the game eventually you run into letters that can form words and these words can be used in sentences. For example, b a b a is you
is parsed as Baba is you. w a l l is stop. Well, wall is stop. Or b a b a i s y o u is Baba is you. And the letters are probably the single most complicated and complex system in the whole game because they have a lot of corner cases, they have a lot of complex a lot of like kind of very difficult parsing quirks to them. For example, there's w a l l is stop. Uh is this wall is stop or is it all is stop? Right now, the game needs to be able to understand both of those and add both of those into the uh rule list, and it actually does. That one works. In b a b a i s y o u, uh the game needs to be able to understand the limits of the words to detect where the words
end and where the next word begins. If there's a a i word somewhere in the game that's a valid object, the game would have to have to understand that there's Baba is you, but there will also be a i here that could work form its own rule somewhere. That becomes very very very complex. Uh then there's there are stacked rules. So, you can put two rules on top of each other in some situations. Basically, in the game, you just find a way where you can have two blocks on top of each other, and if those blocks happen to be words, then you have two words on top of each other. So, for example, there's the situation Baba Keke is you, which needs to form both Baba is you and Keke is you. Or you could have Baba Keke is you move, which should form the rules Baba is you, Baba is move, Keke is you, Keke is move. Basically, the game needs to go through all the possible combination of
the combinations of those words and form all the valid rules. And this is again extremely complicated, especially when combined with some of these other things, such as the letters of the chained conditionals. Uh to give an example, here's Baba on is grass you is move. I drew a little uh diagram to show how this jumble of words should be interpreted. So, here on is and grass you are on top of each other. So, in total, there are five words seemingly, but two of the words are doubling or are like multiple words. So, there are three different possibilities for how this could be interpreted and all of those should be interpreted correctly. The rule system should get three rules out of this instead of just one or two. So, we can have Baba on grass is move. So, Baba on grass is move. Pretty
simple. Then there's Baba is So, the second option. And after this, actually both grass and you are valid options to come after is. So, there's Baba is grass and Baba is you. That should both come out of this mess. And this Yeah, this gets super complicated. There are totally go like many situations where it doesn't work right, but it's a very cool concept. I like that it's in the game even though it causes me some sleepless nights. And finally, as a fairly tame example, uh there are ways to combine rules so that uh two different rules share some words. So, for example, there's I guess this computer made a noise. Uh there's Baba is grass and rock is push. So, this should work form the words or the rules Baba is grass and rock and
grass and rock is push. Right now, this actually bugs and the game where only forms the rules Baba is grass and rock and rock is push because it doesn't realize that grass and should be included when doing the rock is push check. I'm I'm going to try to fix that, but right now, it's a problem. And there are some letters, for example, there are some similar issues that are way worse. So, those are some of the complications I've run into. Some of them I've solved, some of them are still to be solved, some of them are solved partially but create endless amounts of new new work. So, for some conclusions from all of this, let's see. I still have a couple of minutes of time. Uh the conclusions I've come to when working on this system is that it's futile to attempt to make a perfectly parsable system or parsing system
without simplifying something. The system as it is is way too complicated to ever make it work perfectly. Maybe someone dedicated their whole life to doing that or there was like a huge team, they might be able to do that, but as it is, I have to admit that I'll either have to remove some of the more unstable element elements or accept that there are going to be some oddities there, some things that don't work as they intended. Maybe some bugs that become features or something that I just acknowledge that, okay, that doesn't work, no can do. And uh at this point, I do realize that for me, including words that felt fitting or cool into the game took priority over the stability of the system. For example, those letters, they add a lot of complications into the rule parsing, but it's such a cool thing, it's such a nice exploration of the
themes of Baba Is You that I absolutely couldn't leave it out. And there are many other examples of that where I kind of uh took a larger bite than I can chew because I felt that I needed to have something in the game. Yeah, I I even mentioned to myself there like especially letters are like that. Um and I'm kind of happy with that in some situations because in the base game, if I knew that there was some problem with a certain rule or certain parsing thing or whatever, I could design levels so that I don't showcase those. I tried to generally make all the systems as dynamic as possible. I didn't want to make some rule that only works in one specific situation and then I just tried to hide from the player that it doesn't work at all. There's some specific s- Sorry, some specific examples of that as well, but I mostly tried to make everything dynamic. But even s- even still, if there were s- situations where some
some rule might be kind of arbitrarily not working, I still had the option of not giving the player the tools to break the rule rules in that way to kind of see the weaknesses of the system, which was kind towards the players, I feel, and also saved me some extra work. But, we are releasing a level editor for Baba Is You later this year at some point. I'm working on it right now. And the problem with the level editor, especially because it has level sharing online level sharing, there are going to be people trying all kinds of wild stuff. And even if I spend all the time from now on to the release fixing things, all the quirks I know, people will inevitably find s- something new that doesn't work or that is funky or uh yeah. So, eventually I'll just have to admit that, "Okay, some things are features, not bugs, and people may use
them in their levels." Or I'll have to say that, "Please don't do this. I know it doesn't work, but I cannot help it anymore or I don't have the energy, willpower, something to fix it." It's a shame, but it happens. And then finally, as the final point, a quick thing, uh there were some words that I wanted to add throughout the development, but I didn't because I kind of felt that okay, this is maybe too much too way like more work than it's worth. Uh and one specific example is the if word. It would be super cool to be able to say something like Baba is you if rock is push to create like if clauses because it could increase the kind of logic uh nuance and elegance of the system a lot. I've seen people make stuff like uh Conway's Game of Life in Baba is You and I'm super happy about it stuff like that and I I want to support those kind of India endeavors and I think the if word would have done that. But at the same time
I feel that if I added the if word, I would have to make the following sentence actually parse. Lonely Baba near grass is you if rock is on flag and facing right. And as you can see from my onomatopoeia in in there, that would be terrible. I I wouldn't want to be in a situation where I would have to make sure that all those possible combinations of words actually work in the game system. So if stays out for now. I have some ideas how to implement it in a more simplistic way, but as it is, it's it's kind of out of consideration. I have to fix other things first. All right. So, thank you very much for listening to my babbling. I hope you enjoyed. I hope maybe you learned something from this. Maybe you didn't learn anything, but it was still intriguing. Uh if you watched it until the end, I hope you didn't like have a super terrible time even if you didn't enjoy what you were watching. I'm sorry
if that happened, but to be honest, it's it kind of isn't my my fault if you watched the whole thing through maybe. Uh Thanks a lot. Oh no, I'm about 3 minutes over time, but thanks a lot to the GDC staff for organizing this virtual talk thing. Uh and uh yeah, I think that's it. Thanks for watching and uh take care. Uh remember to wash your hands and uh hope watch other presentations also from this virtual GDC presentation rigmarole. Thank you.
Auto-generated captions from YouTube — names and numbers may be misheard.
Distilling the key insights…
Game Developers Conference · 2026
Game Developers Conference · 2023
Comments