 Okay. Hello, everybody. Welcome to this last talk about the game session. I will present Globulation 2, a free software real-time strategy game with a new take on micromanagement. As with most open source projects, this game is not the result of a single individual but the result of a whole community. And I would like to thank everyone who contributed time and resources to Globulation 2. And this game will not, of course, be what it is without the support of all those people who are not there today but are critical to this game. So, the outline will begin by exploring the founding principle of Globulation and what are the basis of the gameplay and the design of the game for a player point of view, not from a technical point of view. Then, we'll have a look at the architecture and all this is implemented. It will be an overall view. Later, we'll have a more detailed view on some specific subsystems such as the network or the pathfinding or the task allocation algorithm. Near the end of the talk, we'll talk a bit about the community. And in the end, we'll have some conclusion and remark about the future of the game. So, behind the Globulation adventure, there is a reason. And this whole idea started from an analysis that a strategy game should focus on strategy and not on micromanagement. When we began, a friend of mine and myself, Globulation, about 10 years ago, most of the real-time strategy game were mixing evenly the strategic aspect and the micromanagement aspect. If you imagine games such as Warcraft or even Starcraft, they all have a very important micromanagement aspect. While it can be very interesting for some players, it's also a drawback for some others that would like to concentrate on the strategy and are distracted by this very action part of the game. So, we tried to make this element better. To do so, we had a look around us and we were thinking in which type of environment there is this strategy without micromanagement. And one inspiration was the end colonies. In end colonies, there is colony-level development that is quite advanced, but there is no micromanagement in the sense that there is no overmind who is overlooking the development of the colony. So, we go ahead and implemented a game based on this idea. And this is the basis of the ecology of Globulation. There is three key element in this ecology. The first element is the resources. They are providing all the basic material for the elements of the game. The second element is the units that is the moving part of the game. And the third element are the buildings. The resources are of different types. The first one is the wood, which is used to build buildings. The second is the wheat, which is used to feed units. In Globulation, the units have to eat, which is not common in a real-time strategy game, but gives very interesting dynamics to the game. There is also the seaweed, which is a type of resource used to make advance buildings, such as the schools. There is the stones, which is a resource that never gets depleted. And it is used to make buildings that are very robust, such as the defense towers. And there is the fritz, which is a resource that is used to give happiness to the unit. The units can harvest and also clear the resources. And the units are of several types. There is the walkers, who are the basic units who build things and transport things. There is the explorers, who are the unit that goes around and discover the map, which is very important for any game, where the information war is a very important aspect. And there is, of course, the wires. There are the units that can fight. The buildings are of several types also. There is the swarms, which is sort of living buildings, which produce units. There is the inns, where the units can go and eat. There is the schools, where the units can go and gets better and then can upgrade buildings to make them much more efficient. There is the hospital, where units, when they are wounded, they can go and they get repaired. There is the race tracks and the pools, which are buildings that upgrade units. Respectively, the speed of walk and swim. There is the barracks, which train the units to fight. And there is the tower, which are defense buildings. The units build, repair, fill, and upgrade the buildings. And in return, the buildings feed, heal, and upgrade the units. With this ecology, we designed the first game, which was Globalation 1. We designed it between 1999 and 2000. It consisted of 20,000 lines of think Pascal code. We had the macOS classic version. It was a single player. And in this game, the units have their own lives. They individually upgrade. They walk, they eat. And the player has very limited control. It only chooses ratio of buildings and units. And everything else is managed by the game. The game managed the units, which move randomly. They place buildings randomly. They build buildings randomly. And they find resources randomly. When resources are found, they go to the resources, other units go to the resources using pheromones. And this resulted in a funny simulation in the sense, semi-D, as artificial life, but was not really fun to play. Because basically, we could only change some parameters. So it might be good for a scientific article, but not for a game. Furthermore, it is old now and the graphics are not really nice. But we decided to make a second game, because the idea of reducing the macro management seemed promising. So then we made Globalation 2. As you can see, the graphics have already much improved. But this is only the visible part of the iceberg. There is a lot of changes under the hood. It's now in C++. It consists of 100,000 lines. It has been developed now for the last seven years. It is cross-platform. It is multiplayer. And also the units retain their own lives. The player now has a much wider range of actions. And the player can decide what he wants to replace buildings. He can decide which buildings he wants to upgrade or repair. He can place flags, which is a way to control groups of units. So this gives the ability to control the units more or less directly without having any macro management. For instance, if you have a war flag, you can say, I want 10 units at that point. And if the units need to go to eat, other units will come to ensure that there is still your 10 units at the war flag. So this way you have the control of what happens, but still you don't have to take care of the macro management. The player of course specifies which number of units is allocated to each building to build or to repair or to work at the building like filling the hidden. And also the player can specify some areas where the units can get attracted or repelled. For instance, there is the guard area, which allows idle warriors to go. Instead of just wandering around, they are attracted to this area, and then they can be useful like defending against unexpected attacks. The game assigns units to buildings and flags. So this is then automatically player never controlled directly one unit. The games also manage unit food, health and upgrades in the sense that the units decide themselves when they want to eat or when there is an open building for upgrades to work on. And the game also takes care of every pathfinding, so you never have any pathfinding problem. And the result of this is an innovative fun and extensible gameplay. It's innovative because I don't think there is much of a game that has this particular type of gameplay. It's fun. It opens a new way to see games. And it is extensible in the sense that we can add elements to what is now. Now we have a core of this gameplay, but in the future we can add a lot of new elements. It's open. It's not closed. No. Or this is implemented from a software point of view. Basically the structure is the following. We use several libraries. The C++ standard libraries. Also the boost extension libraries. We use the Z libraries to implement compression. To access the underlying windows system and everything that is platform dependent, we use SDL. And we have an open GL accelerated back end. So if you have a fast graphic card, you will be able to play at very high resolution with no slowdown. And if you have a device or your device driver does not support it, you can still fall back to the software implementation. We also use SDL ImageNet and TrueType font rendering. We use PIC for voice of our IP. It is currently only working on Linux, but we have the intention to extend this to all platforms. We use Vorbi's org to play music and FreeBD to have rights to left text rendering. In the game itself, we have a big structure which is the game engine which takes care of updating the game state. We also have the map editor which accesses this same state that does not update it. And we have, of course, several small subsystems such as the network, the graphical user interface, the display, the input, and the music subsystem. The most interesting part, of course, is the game engine, which we will have a look into now. The game engine consists of a map. A map is a rectangular grid of cases and sector. So cases is a small cell, and it contains information about the terrain, the resources, the units and the buildings present at this cell. In the cell, there can be only one unit or one building or run resources at the same time. There is also the sectors which contain elements that encompass several cells, such as the ballot or some animations. This map does not contain the state of the unit and the buildings themselves, but rather an identifier which is used to access the states of the buildings and the units which are inside the teams. The teams is an array of structure, one per team, which is a color in the game. And a team is a faction. And each is a faction as a list of buildings and units. And in this list, each building has some information that are dynamic, that is, that are different to each building instances, such as the position, the hit point. Same for the unit also, position, hit point, and several other variables. Those building and units are parametrized by static information that describe the types of the units and type of the buildings. For the buildings, it's called buildings type, and it describes the ability, the size, the sprite, all the data about the buildings. And for the unit, there is this race structure, which also describes the same for the unit. Both those structures are parametrized by text files, so they can be edited by contributors to tune the gameplay. The last structure is the player that is the controlling entity for a faction, and there can be several controlling entity for a faction in this engine. For instance, if you have a player and an artificial intelligence that are playing together. This was a static view. Now let's have a look at the more dynamic view. If we have an information flow point of view, you have the player, which can be human or artificial intelligence that control the game through orders. The orders are a way to describe the action of those players. They can either transit the network to another computer, or they go directly to the game logic. The game logic will process the order, update the game state, and display it, which will give the feedback to the user, to the player, or if it's an artificial intelligence, it will directly hook into the game logic to get those informations. Now let's have a look a bit more detail how those orders got exchanged through the network. Glob2 features a synchronous game engine. That is, the execution of the game is the same as parallel and parallel on all the computers. It's based on TCP, with order getting exchanged to a meta server that just basically routes the orders from one computer to the other. This meta server also initiates game connections, and, as I said, routes the data. That's the player's only exchange order. The good thing with this is it only uses the smallest possible bandwidth, because basically just the action, like the click, are exchanged, and if the player just scrolled the map or don't do anything, there is no information exchanged. It provides a small and uniform latency, and with the order, we also exchange a checksum of the game state that ensures that cheating by state modification is impossible. Of course, this is not perfect, and there is several drawbacks. For instance, the most important thing is that the code execution must be predictable. As the game is running in parallel in all the computers of all the players, every code, including the artificial intelligence code, must be completely predictable. That removes a lot of possibility for coding, floating points are forbidden, some sorting algorithms are forbidden also because the implementation of them are not predictable, and some containers are very difficult to use properly, such as that, because there is a lot of unpredictability in them. Of course, this cannot prevent view cheating. Everyone can modify his client to view what the others are viewing. Now, when you are running in a network, you have some latency. Basically, it works like this to overcome this latency. At some time, let's say T equals zero, there is two computer with two players and they all do some actions. So, those computers create orders and send them to the network. In the same time, they queue locally the order, and they will execute those orders, the one they have queued and the one for the other computer after a certain amount of time, which corresponds to the latency. If the other have not come yet, the game waits for the order, but of course, this latency is usually computed such that there is no such waiting. Now, we will have a look at two other sub-systems that are of interest. The sub-systems are the path finding and the task allocation algorithm. In globalization, the path finding are linked to targets. That means that the units do not path find themselves, but rather the path finding are attached to the destination of the unit. The destination can be the buildings, the resources, or the area. The path finding, the path created by the path finding are used by the unit, which request the targets to create the path on demand. If there is congestion, like there is a lot of units that want to go into a specific target, this path is locally overridden by the unit, but globally, it's managed by the target. This approach has some drawbacks. It takes a large amount of CPU time, and to make it efficient enough, it took a substantial amount of development time. But we like it because it's good. It's working well. And in general, your path finding in the game must be perfect. Otherwise, it may easily kill your game because the player gets frustrated. Of course, there is some big game vendor that can not take this into account. The algorithm of the path finding is based on having gradients to the target. So imagine you have a pile of sand and you want to go to the top. It's very easy because you just have to follow the maximum ascent. So we create the path starting from a target using gradient propagation with an algorithm that will have a look into some moment later. And then the units only use gradient ascent to go to the target. This algorithm is good because it provides a complete exploration of all accessible map parts. And its complexity is quite large, but it's a polynomial. It's in the order of the amount of targets multiplied by the size of the map. So how does it work? Let's imagine a very simple map. We have a target denoted t and we have two units denoted u. We have also an obstacle which is in white. At the first step, we initiate some value to the target, for instance, 255. And then we set up the value around the target at this value minus 1. In this case, it's 254. And we will continue to do so. Always setting the value of a cell to the smallest value of all its neighboring cell minus 1, which will do something like this. Then when we have updated all the cell of the map, we can just go from any point of the target if there is a value by following the maximum value of the all the cell around. In this case, the two units can easily go to the target following those values. Now let's have a look at another important part of the game, which is task allocation. In population two, units are allocated to task that are basically resources transport using a market-based approach. In this market-based approach, units that are free, that have nothing to do, for instance, that have finished their job or that just get out of the inns, they can subscribe to lists such as working and employment lists. The buildings who wants the units, they also subscribe to lists. And then there is an algorithm which saw the list according to some priority. For instance, the inns get higher priority and the higher level buildings also get higher priority. Then there is a greedy allocation that allocates one unit per building, per allocation one, which ensures that there is a fair allocation of the units to the buildings. So now we have just some look into some software aspect of globalization. But of course, with any open source project, the community is a very important aspect, if not the most important one. So globalization provides several ways to interface with the community. If you just have the binary, you can already have a lot of interaction with the game. You can pay it, of course, but you can also contribute to it by making maps or editing campaigns. You can work on translation and you can add by testing the game and tuning the gameplay through the text file I've already mentioned. If you want to go a bit further and one, for instance, to exchange some graphics or change some music, there is a virtual file system which allows to very easily change any external file of the game without having to actually modify the distribution of the game just by overriding them using a directory in your own folder and you can, of course, help with the documentation. If you want to go a bit further, you can use the source and do some coding for the documentation. Regulation 2 is also presented at the web, first through its homepage, which is a wiki-based, so you can subscribe and help to maintain or edit it. There is an IRC channel and there is a yog, which is an online game system when you can connect and it's also linked to IRC, so if you are an org, you are visible on IRC, so you can talk with the developers. There is the main list, which is actually mostly used by developers and the forum, which is actually mostly used by players. There is a bug tracker and the source code revision system we use is Mercurial, so it's a distributed source code system so you can branch it and do your own patch and then you send us and we can merge things together very easily. And of course, any game needs the community to live, so you are very welcome to join the relation to community. To have more insight of all these works, let's have a look at the scripting. Imagine that you want to make a map, but you don't want to have a standard victory condition map, you want a map where the victory condition is to build 10 schools. So you want the first player to be able to build 10 schools win. So you can do it with the actual game scripting, which is a very easy to use scripting language. It's sedimentary, it's not generic, but it's very easy to use. In the scripting language, you have the concept of story that basically are threads that are safe, that means that you can't trash the game state even if you write buggy code. It's synchronous, they execute and all the computer the same, of course, because of the network model we have, we are forced to have synchronous scripting and they are serializable, which means that you can save the status of the script if you have a safe game and reload it afterwards. So in this example you see that you have two weight conditions that are weight, school, 0, 1, bigger than 9 for the for the story 1 and the weight, school, 1, 1, bigger than 9 for the story 2, which means that the first story will block until the first player has more than 9 schools of level 1 and the second story will block until the second player will have more than one schools of level 1. And of course the first story that's got past the weight will have the next two actions that are win 0, which means make the player 0 win and lose 1 makes the player 1 lose and in the contrary with the other condition you have the invert, which means that the first story that goes there terminates the game by making the player win and the other lose. This scripting is nice but it's limited so we are currently working in a much more advanced next generation version but that will retain the safe synchronous and serializable aspect of the script. Another element is the graphism. To have a nice game you need to have nice graphics. So this show all we made the actual graphics of the game. We first did a drawing which you can see at the top left then serial which is just sitting there made some coloring which you can see at the top right and this is the current way with the graphics. In the future we might or might not make 3D graphics for instance we can take back the drawing graphics and make a blender 3D version and then we can texture it. Right now it's not textured yet because it's a big work but it's just to show that we can still work and improve things starting for the actual graphics. A very important aspect of any open source project is the contributors. In this slide that I've called contributors capture and storage I want to just show a bit what are the critical elements of the interaction with the contributors. First thing is that open source developers are highly volatile resources especially in a game where you don't have any company backups so just people they contribute and perhaps you have something more important in the live and they just stop and they can stop from one day to the other. If you have a game you need artwork and the graphics the artist are even more volatile. So this is a problem. A second problem is that if your game is well advanced there's a quite good engine with a lot of capabilities it's quite complex and complexity is both both in vain in the sense that if it's complex it provides a lot of features a lot of things you can do and potentially a great game but in the same sense there is a lie entry buyer. Developers need to know a lot of things before they can contribute anything and this can be a very big problem. It was a very big problem with globalization too which we developed at home for five years or four years and then we made it open source and there were a lot of complexity. Very few documentation it was really very difficult for people to get into. Know that much more people are standard people have contributed to the project it's getting easier and easier. The problem is that people come they implement great things and then they disappear. Of course they don't document much because there is no pressure to do so and it's not fun to document. Another problem is that by doing so people like to reinvent the wheel and of course they will invent better wheels each time but often it's not yet finished. So you get better wheel but less and less finished which can be a very big problem. So as a community you have to maintain a balance between guiding new developers into your rules and letting them express their vision otherwise you won't have any new developer at all. So this is very difficult to balance that you have to maintain. Now as conclusion the current situation is quite good. The code base is stable. The community is stabilizing in the sense that there is is growing and more lasting people are around. The core engine scales well in the sense that the same code that we wrote six or seven years ago basically still works and is still capable of powering our game even if we now have games with thousands of units. The game is still working well and there is no problem. And the gameplay is innovative and promising. Of course not everything is finished. Game is always a work in progress and in the future one critical aspect is to tune the gameplay because the game got a lot of work from development but not that much feedback or advanced feedback for a player yet. Already quite some but we could do much better. We should also improve campaigns and improve the user friendliness of the game. Right now some people are afraid because they think it's a bit too complex so we have already a good tutorial but we have to make it better. We can hope to further reduce micromanagement for instance through adding new gameplay elements there is a lot of idea in this direction and we hope to make them become reality. And why not if there is enough demand but enough artwork we might put 3D graphics because it won't be difficult in the open gel mode to just have a trendy renderer for part of the game but I think it's not really the most critical element for such a game and it would be better to improve the gameplay first. And if you want to take home a message about game development is that gameplay atmospheres and artwork are critical for success more than code and more than speed or efficiency. You need to have a game in which players feel well and want to contribute and make it live. So join the globalization adventure and have fun with us. Thank you for your attention and if you have any question feel free to ask them. No question? Someone wants a demo? So you want to play versus an artificial intelligence? Let's take... So this is a demo effect. Sorry. So I took a very standard map and I put four stupid but stable artificial intelligence and now I'm... I've swarmed her with some units that are getting width to it and I've set up two new buildings to build that are INS. It's very critical to make INS at the beginning of the game otherwise the units can't eat and they just stupidly die. I will also make a swimming pool which will allow the units to swim because initially the units do not swim which is a problem because the sewage which are needed for the schools are in the water. So I will also make a school. I will make an hospital and I will make a barracks. Now I will make some more units. I will associate more units to the swarm because only one unit is working at the swarm. It's not enough to have a good number of units. I will request a lot of workers and some explorers and some wire. I will put some exploration flag. The exploration flag basically will attract explorers so that they will just go into those flags and discover the terrain under. I will put some area. I will put forbidden area onto the wheat so it's not easy to see. This is a bug of the Intel OpenGL driver which does not run the properly the line and I will put some turret in the entrance of the base so that other players will not easily come into our base and destroy things if they decide to. I will also put a racetrack so that my units will be faster and I will put an additional in ah yes which should be considered a bug. Ah yeah it was better. Ah yes I have not talked about yes I've not talked about the fact that one thing we liked in the idea of globalization is that when you is that everyone is in the center of the world because basically the world is a terrarial topology which means that the left is the right and the top is the bottom and everyone begins in the center which is interesting for the dynamics of the world but can be complicated if you play in network and you ask if you are in the middle and I'm also in the middle. This is the reason we have put some mark tool which does not work. Is the autosave is the autosave feature working again? The autosave reloads feature. Good. So we have an autosave reload feature which means that even if it crashes it's not a problem. There you can see frits. Frits are very interesting because they give your unit happiness at the expense of the armor so if you're a warrior take fruits they get kind of happy and weak but it's important to be happy because if they are not they can decide just to convert to the enemy. So it's a subtle blend. So I'm putting some walls in front of the tower to defend them in case of an attack. So now that we have explored we can just remove the exploration flag and we see in the mini map that there is an enemy at right. Attacking would not be wise in only one warrior but we can if you want. Yes they can. One can. Two can. Wow. And we will build more schools because it's more profitable to make schools than to make war. It's a very mobile game. We see if we click on the barracks that we can't upgrade it because no unit has gone to school for long enough yet so they are still very stupid and you can put some area. For instance you can put area there if you want to attract the warrior. That area will ensure that idle warrior will go there with preference. We'll also put one there which is very good because otherwise you have a lot of wire that just do nothing and stay the way of your workers which is a very bad situation. So we see the nice particle effect. So normally with a normal player or more powerful artificial intelligence you can't win with just one unit. We have several artificial intelligence and I've taken the simplest one which has the lowest probability to crash and the resources they got depleted. For instance if you have a look there you see that the wheat is getting depleted but they also grow in proportion to the distance to the sea. So you have to carefully manage your resources. This is also a very different aspect with respect to other games such as Starcraft when you can just harvest at maximum. Here if you harvest everything you just don't get anything. In addition to being moral it's ecological. We'll let this warrior alone because he's angry anyway so he will he will go to the inn. The game also provides some nice statistics about the evolution of your colony sorry for the bug of the driver and you can have some map so you can have some like starving map which will show whether unit are starving. It's very good no unit is starving. Ah yes there is one warrior which is starving there and you can have some other map such as the defense map which shows the amount of defense given the location and you have some fertility map which show you area where the wheat or the the wood is would grow more easily. You have some statistical text statistical information if you really want to and you can of course upgrade the buildings once you have the unit you are able to. So for instance there I upgrade the barracks I will upgrade one school I will upgrade one inn and also upgrade one defense tower. I won't upgrade this race track but when buildings upgrade they get bigger so I need to remove some resource first so I will took the clearing area and I will make sure that all the unit that goes there helps to remove the resources around and I will try to make an extension in the territory of the AI let's go for instance there or put a new swarm new inn. Perhaps now you have more questions now still not want to play again yes but I didn't want to make you suffer with the sun from the small there is music there is no sound effect yet the music is a dynamic mixing system which means that you have three tracks that have to be composed so that they can be at any time and the music is mixed depending on the action a bit like the IMU system in the old Lucas arts games but the music is currently not very long but we are some people are contributing longer music sorry yes not really in the sense that if you invest your time to make micro management like precisely positioning the war flag it might have some effect but if you better manage your economy and you better manage which building you will upgrade at which time and if you want to because if you produce for instance a lot of unit then you will have a lot of you of unit working at the in buildings to feed them then you have some dynamics that go in some direction and maybe it's at some point not the best idea maybe it's better to have few units and have schools to upgrade them a lot so micro management have a very small effect the I don't know yes if I request a lot of and also with the this area you can really set up the one base for instance I put some tree area there because I don't want the week to take all the place and then the you just the the colony will just walk alone there of course if you do this everywhere the AI will finish by winning because you won't be able to dynamically adapt to the news situation there was a question there okay yes although I have a have a number which is the time step at which they have been sent so by ensuring that you have all the orders for all the players for a specific time step you can execute it so at work you will have some computer that will be in advance but it will always be less than the latency if they are the time out then the game free then you have the opportunity to drop the player yes the conversion system so I can show my inns to the enemy to the enemy teams which will attract their units in a sense that if I have more fits than them which I currently does not their units they will try to convert ah yes I got one unit converted so there in the in the enemy's town one warrior decided it it is better at my place it just got killed by his time and teammates because people don't tend to like this but of course if you play this properly it's very efficient because you can just by doing economy you can win versus an opponent that is doing a lot of war so now I'm placing tower into the into some other fruits because you need to have a look at the fruits to be able to to get them so you need to also control well the environment to make sure that you have access to all the fruits then you have some fruits war you have a lot of war at some place just because you want to control the specific tree I think it's the only game that reserve strategy game when you fight for a fruit tree so I can request more units that means I really want it to build other question I have an attacker so I will redirect all my warrior there but I don't have any warrior free because they are all trying to attack the enemy which is so of course you can let your colony going alone but if you don't react to these things it will be bad but we see that the walls are working well and the tower are efficiently defending of course we won't stop the unit ever for infinite time but it can stop them long enough until we got our warrior there so it's very important to have a good to have a good defense also and I have to build more ins because right now there is a lot of unit new units that got converted and I will remove the conversion because otherwise I will have too much units and my economy will collapse sorry well it's not illegal because you know we showed them very nice building a lot of fruits so they all decided to come there so we are a bit responsible I think and ah the units have gone through the wheat because we have taken too much wheat so it's very bad because they just enter our our colony from a side that is absolutely not defended so that is the problem when you take too much resources out then you get some unexpected effect so I would put a defense tower there just in case so this smoke symbolize the wall which is burning yes it might be but it's yeah well some of the developers do not agree the reason but okay I think we are time out soon if you have still one or more question sorry yes now because none of the existing streaming languages provides the uh the predictability and the sializability that we need we plan to make a new functional light scripting languages with a very modular syntax you can ask martin who is just two three ranks not below the guy who looks like me but he's not my brother and he can tell you a bit more in two detail about it we currently have some prototype compiler and runtime environment but it's not finished yet three out of working progress okay so the time is out thank you a lot for your attention again I hope you will get a lot of fun playing globalization thank you