I have spent this week working on the gameplay variables for this project. This turned out to be a lot harder than I thought. I am currently modelling food, water, sleep, nutrition, morale, stamina and endurance, as well as several other variables related to the “Life simulation”.
I only have a few variables left to implement, but I did find it extremely difficult to model real world events in variable form. Many of these variables will depend on each other as well, for example a users endurance will depend on their hunger level, how much water they have had, and their levels of exhaustion. However, these variables will also affect endurance in return, in a complex circular relationship.
I have had to make several compromises in order to get the system even somewhat functioning, and it is a lot simpler than I wanted to make it, but it seems to be at least functioning for now. I will need to add more detail to this system as the project progresses.
The first “virtual worlds” were Text-based MUD’s, or “Multi-User Dungeons”. These were essentially chat rooms, with almost all gameplay being conducted through text messages. Some MUD’s had ascii art, or additional gameplay features, but the worlds were predominately text-based. Even though MUD’s do still exist today, online roleplaying gaming and virtual world development has almost entirely shifted to rich, graphical worlds. However, I think that, ironically, the increase in technology has in some ways limited the capabilities of modern Role Playing worlds.
This might seem like a strange idea, but with the text-based MUD’s of the 1980’s, the only limit was the imagination and creativity of the players, which was boundless. A world could be described in rich detail in a few paragraphs, engaging, interesting characters and stories could be created and equipped with powerful weapons and equipment, and interactions between users could be as unique as the players themselves. Even with all of the recent developments in “user-generated content” we have not come close to this level of user agency in a virtual world. A modern MMO can allow customisation of characters, weapons, and equipment, but this is generally limited to choosing from a set of options. Newer games allow real-time deformation of the 3D mesh, which is an exciting and very powerful addition to gaming, but there are still hard limits on what a user can create. The old MUD’s were limited only by imagination, our newer MMO’s are limited by technology.
The question becomes: How can we correct this, and do we want to?
Virtual worlds are becoming more and more advanced with regards to imagination and creativity. Second life, for example, allows for the importing of custom meshes from external modelling tools. With the rise of 3D printing, it is quite possible that average users will become more and more proficient with 3D modelling tools, which will reduce the technological barrier to creativity.
Further advances in in-game tools, such as the aforementioned real-time mesh deformation tools, will also close this gap, but we will likely never eliminate it completely.
With my project, I want to allow the user as much freedom as possible. I am trying to create a sandbox, full of the tools and resources necessary for complex behaviours to emerge. This is the reason why I am starting the game in primitive times, I want to start with a blank slate. Most games of this type would either go the MMO route, and create a world full of fictional races, cities, alliances, enemies, and unique weapons and powers. Others would go the social world route, and create virtual meeting places and activities for players to spend time with. I intend to start with a world devoid of human activity, and see what develops.
With my recent integration of Awesomium in T3D, I have also thought about how this type of technology affects immersion in games.
Including tools like this in a virtual world is a big step, for a number of reasons. Yes, there is great power there, and the potential to do many exciting things (especially since the vast majority of common programs are now web-accessible, as I talked about in my previous post). However, including these tools can also break “suspension of disbelief”.
There are many different kinds of virtual worlds, and they all handle suspension of disbelief differently. Some are essentially 3D Chatrooms. They are places for users to interact and communicate. They don’t pretend to be “real”, they are overtly an online community. Having real-world integration tools like a web browser in a world like this would make perfect sense.
However many worlds, like the MMORPG’s are alternate realities. They require deep levels of suspension of disbelief, and require users to immerse themselves in the world, it’s history, and it’s characters, while essentially not acknowledging the real world. Being able to log in to facebook to update your status while you are fighting to save the kingdom from the rampaging marauders is not something that will benefit the users experience.
The future of my project will be a virtual space, not just a game, although it will have game elements. It will be defined as a place existing alongside the real world, while still having some mythos and internal fiction to it. I am trying to conceptually marry the concepts of game-based virtual worlds and social worlds together with a complex simulation engine, in a kind of grand experiment. I am not sure how it will all fit together yet, I am still in the early concept stages, but I am making progress in this area.
I have recently purchased the Awesomium Integration Pack from HERE. I had to make some minor changes to integrate it into the latest (well, version 3.6) version of T3d, and the latest version of Awesomium, but this was relatively trivial.
I now have a fast, reliable, web browser with flash support in the game. The possibilities for this are endless. It should allow not improved immersion while checking emails, using facebook, twitter, etc, but also javascript gui’s and menus, and video playback.
This type of technology would allow things like videoconferencing in a virtual environment to be extremely easy.
I still have some work to do to enable keyboard input with 3D shapes, (currently keyboard input is only supported for the Gui’s) and some other minor issues, but this is almost completely working.
Awesomium is a HTML user interface engine. Essentially, it allows a program to access the internet in the same way that a web browser can, and display a web page, play a flash video, etc. This is obviously extremely powerful, and it can be used in various ways with virtual worlds and virtual reality technology to increase immersion.
I first came across Awesomium a number of years ago, and found it very easy to use. The only reason why I didn’t integrate it into T3D at that point was that the version of visual studio that I was using to compile torque couldn’t compile Awesomium, and the latest version didn’t compile T3D. Now, that has changed, and Awesomium should be fairly easy to integrate into T3D.
There is a paid resource HERE which does exactly that, and even allows for easy communication between Torquescript and Javascript, and allows for interactive gui’s using HTML and Javascript to be used as textures on game objects.
I am still in the early stages of my Virtual World project, and I am not certain exactly how I want to achieve total immersion. The way I would envision a technology like Awesomium being used in my case would be to allow users to perform computing tasks without leaving the game world. So, for example, they wouldn’t need to quit the game (breaking immersion) to check emails, browse a website, communicate on facebook, twitter, etc. Since more and more of a computers tasks are now web-centered or at least web-compatible, integrating a web browser into a game engine would allow a user to do everything they needed to do on their computer from within the game world. So, instead of the virtual world being just a program that is run on the computer and then quit, it essentially replaces the operating system, and becomes an always-on ever present virtual environment which can communicate and integrate with the real world when required.
I think this has the potential to dramatically increase the immersion in virtual worlds, and increase suspension of disbelief.
The only problem that I can see would be integrating these “real-world” tools with the virtual world itself. If you are building a realistic world, how do you explain these web browsers, email apps, etc? There are a few ways of doing it. The easiest way would be not try to integrate them with the setting and backstory of the world. Just allow the user to interact with the virtual world as normal, and create a web browsing window whenever they need to. This isn’t realistic, but it will break immersion a lot less to do this than to have the user quit the game and check their email, then start the game up again.
A better way to do this would be to integrate the web browser technology with the game world itself. So the user could interact with a computer in the virtual world, and use it to access real-world websites. Additional websites designed to be accessed in-game could also be created in the real world, and could be accessible from both in game and out of the game. This would provide excellent immersion, it would appear as if the virtual world bridges the gap between the virtual and the real.
This of course will not work if the game is set in an era which doesn’t have computer technology. In that case, some creative solutions specific to that world would need to be used to integrate the technology.
My current project is set in prehistoric times, as I discussed previously, so any integration of web browsers would need to be overt, since there wont’ be computers in game for the player to access. However, I intend to simulate the development of human civilisation and society as much as I can, which, eventually, will include more modern, and possibly even futuristic technology. This project is intended to be a “Virtual Universe” after all.
I have completed some modifications to the database connector which allow me to easily access even large sql query results from script. It is probably not as fast as it could conceivably be, but it is more than fast enough.
I have also implemented the context-sensitive menu, although I will need to test this properly on the network, to ensure that the proper client/server data transfer is happening. I need to keep as much data on the server as possible, for security reasons, and as much processing on the client as possible, for performance reasons.
I have also implemented a very simple demo of the action/effect code, the player can now eat an object that supports that action. I intend to have a separate function for each action, although some actions, like eat, pick up, etc, can be generalised. Eating one food is the same as eating another, for example, it’s just the nutritional content that changes.
I have a lot of work to do here, and I have still to implement support for the effects of actions, such as, for example, adding the “poisoning” effect when a certain food is eaten. I also need to add extensive code to calculate the players recommended daily amount of food, and calculate their hunger levels, thirst levels, fatigue, and a lot of life simulation variables, but I have made significant progress.
While researching technologies for my virtual world project, I looked into a realistic physics library. This would allow me to further explore dynamic content, by allowing players to, for example, construct objects, buildings, or simple machines from discrete elements in the world, using only the physics model to “Make them work”. I would not need to use prefabricated objects, object combinations, and scripted logic and mechanics. I don’t know if this concept will work out, but I am planning to research it in more detail, and come up with a concept. There are a few options out there for physics libraries in games. The main ones I found were NVIDIA’s PhysX, Bullet Physics, and Intel’s Havok physics, and ODE.
I am not going to spend time comparing the advantages and disadvantages of different physics engines, but suffice as to say, the two main options for T3D are Physx and Bullet Physics. Bullet is open source, but PhysX is free for commercial use, so there really is advantage in price. I am leaning towards PhysX, mainly because it seems like the most supported (by commercial projects) engine, and it seems like the most fully featured, although Bullet is catching up. PhysX is used in many Triple-A games, and it part of Nvidia’s “GameWorks” technology package.
GameWorks also contains several other fascinating and powerful technologies, including one that I am particularly interested in, NVIDIA TurfEffects. I haven’t looked into the licensing of this yet, or the work required to integrate it into T3D, (Nvidia’s website mentions a dependenc onf DirectX 11, currently, T3D uses DirectX 10, but this is being worked on) however, this system capability to render grass is staggering. I have seen many games, even high quality games, use what is obviously a randomly generated sprite system for grass. A 2D sprite is created, animated, and then replicated many times in the world. The effect looks decent, but unless the object count is very high, the grass just looks patchy and fake. In addition, the sprites will be billboarded, which means that they will rotate to face the player. This prevents the player from noticing that the grass is two dimensional. This can cause problems if the player views the grass from above, or from an extreme angle.
However, with TurfEffects, the grass is not only completely seamless with no patches or dead spots, it is also capable of collision! Even large grass fields support deformation due to player footsteps, or objects striking the grass. This video, from Nvidia’s site, demonstrates this:
According to the video, TurfEffects allows one millions blades of grass to be drawn in less than a millisecond, using a GTX 680, which is incredible performance.
Nvidia’s Gameworks also features HairWorks, which provides superbly detailed hair and fur simulations. This solves an irritating problem in the creation of characters for games. Hair is normally modelled as a mesh, similiar to any other object, and then either left static, or animated as a mesh, which looks very stilted and wooden, and very poor looking. This is one of the things that I, as a developer and gamer, just accepted as the status quo in games, since real time hair physics was just not really possible. However, with solutions like HairWorks, this may change. From watching the below video, it is surprising to see how much of a difference realistic hair actually makes to the depth and immersion in a game. This is a video, from Nvidia, of HairWorks in action:
Again, I don’t know what type of licensing or pricing HairWorks uses, (It’s not on Nvidia’s site) and I am also not sure how easy, or even how possible, it would be to integrate this into T3D. This is an area where using a more populate engine, such as Unity or Unreal, would be an advantage, since there would be greater support for the integration of technologies like this.
I personally tend not to like to use external libraries and resources, I am reluctant even to use art packs, since I prefer to create everything completely from scratch. I do use engines, such as T3D, and I do use some resources and libraries, but I try to create my own solutions and art when possible. However, the time required to “reinvent the wheel” like this will get prohibitive for a massive undertaking like a virtual world. I intend to seriously look into various libraries and tools to make the job easier. Some, like PhysX and MakeHuman, will be readily available, however, other technologies will have to be developed, such as a Spherical Terrain implementation (I was never able to find a library or resource which fit my needs).
Virtual Worlds are my main area of interest, if I am going to create the world that I am working towards, I am probably going to have to make use of any tools that are available. This is especially true with art and animation tools, since I have much more limited skills in this area.
I have now moved on to the actual Game World Creation. I am using a similiar system to “Astral Realms”, my previous virtual world game, except I am writing it from the ground up for this project.
I am storing all of my world object in a database, not a mission file, this will allow me far more control over them, and is essential in a persistent world game like this. I am, for now, going to simply going to query the database for all of these objects, send their data to the client, and draw them. In future, of course, I will need a very complex optimisation algorithm. My experience with Spherical Terrain has taught me that this will likely be difficult. The easiest thing to do would be to return only objects within a certain distance of the player, however I am not sure how this could be done with an SQL table. For my previous project, I used a zone-based system, where I would calculate which zone the player was in, and return all objects in that zone.
This worked ok, but this could cause problems if the player was standing on the border between two zones, or if a zone was very heavily populated with objects. I really need a distance-based optimisation system, similiar to what I was trying to d with my spherical terrain system. I am sure I will figure something out eventually, for now however, I can simply return all objects.
I did run into some slight issues when working on the world creation code, however. The database connector code that I implemented is missing a data structure to return a set of results from c++ to script. This will need to be implemented, and it will need to be fast. I could have several hundred results coming from the database server, and I need to be able to access them easily from script. I also noticed a bug with the database code when one of the database fields is null, this will also need to be corrected.
I do have a working populateworld() function, however, which selects an object from the database and creates several instances of it in the world, in random locations, then adds those locations back to the database. I am using raycasting to make sure the z position of the object is always on the terrain.
I also set up a dedicated server and tested it on my development machine. I will likely use a single executable for the near future, since it is much easier, but I wanted to make sure there would be no major issues with regards to implementing a dedicated server.
I am using simple test objects for now (just textured spheres) because I want to get the concept working first, before I spend any time on the art. I have, after some effort, implemented collision on the staticshapes that I am using (Collision is easier to implement on TSSTatics, but they don’t support the guishapenamehud, which displays a very useful text box above the shape).
Finally, I began implementing the context-sensitive menu that will allow the user to interact with the world. I will again use raycasting here. The user will select an object, and a list of its supported actions will be displayed on screen (having been read from the database). The user will then be able to select an action, and that selection will be sent to the game server where the actions effect will be implemented by the behaviour scripts. Before I can finish this, however, I need to add quite a bit more functionality to the database connector code.
I have made significant progress in creating the basic gameplay variables which will be used by the game.
This has really made me realise the enormity of the task that I have set for myself. Basically, I have been working to produce a listing of all of the basic elements of the game. I now have the food and drink table basically done, and I have identified the variables that I will be modelling. I intend to model a whole host of variables in order to make this the most realistic “life simulation” that I can. Instead of just having a “food” variable, I am actually modelling the protein, fat, and carbohydrate content of the food, in addition to vitamind, niacin, biotin, pantothenic acid, vitamink, phosphorous, iodine, selenium, manganese, molybdenum, calcium, cholene, iron, magnesium, potassium, sodium, riboflavin, vitamina, thiamin, vitaminc, vitamine, and zinc.
I have, so far, 10 different game animals, at least 14 different kinds of vegetables, 11 species of edible seafood, 8 types of nuts, 6 types of mushroom, and 6 types of grains, with many more food types that I haven’t categorised yet. I have not added in the exact concentations of these variables to the database yet, but I have added the foods themselves. I have also created a non-exhaustive list of raw materials, such as Iron Ore, Copper ore, Many different types of trees and shrubs, many different types of stone, etc etc. This level of detail will be one of the defining features of the project, and should serve, amongst other things, to set it apart from other games.
ALL of these will need to have sufficient information stored about them to model their behaviour in the game, in addition, of course, to having art assets created to represent them. This will be quite an undertaking, but there is no reason why it wouldn’t work.
My next goal is to create a concept demo of the action/effect system. I will start by modelling the “Eat” action and it’s effects, and then gradually add more and more behaviours to the behaviour database (this will actually be a script file, stored on the gameserver, containing all effects, and not an actual database).
I am very slowly reaching a level of understanding with this project. I think I am solving most of the conceptual problems that I have been dealing with. It will be a mammoth undertaking, but I already realised that with my Spherical Terrain project, which will eventually be folded into this project.
I spent some time today conducting some tests on large numbers of objects in torque. For my project, I intend to allow the user to combine many simple meshes together to make more complex meshes. So, a complex building might be modelled from individual wall segments, floor panels, doors, windows, etc, instead of being one large structure. The problem with this is that I suspected that loading many meshes would cause a far greater performance hit than loading one single one.
Based on some testing that I did, it turns out that I was right.
I conducted a very simple test. I created some spheres in a modelling tool, with a known number of polys. One high res sphere, with 10082 polys, one medium resolution at 1058, and one low res at 105.
I then wrote three drawing functions, which I executed separately:
Test 1: Draw 512 of the high res spheres (512*10082 = 5,161,984 polys),
Test 2: Draw 4,913 of the medium res spheres (4913*1058 = 5,197,954)
Test 3: Draw 46,656 of the low res spheres (46.656 * 105 = 4,898,880)
Since the polycount is quite similar in all cases, the FPS should be similar too, but it isnt. With nothing at all rendering, the polycount is about 200, after Test 1 (512 polys) the FPS is about 50, with all polys in view. However, Test 2, in the same conditions, produces a poly count of 9.3, and Test 3 wasnt really conclusive due to issues drawing all of those objects, but it was giving me about 5-9 fps, depending on the angle I looked at the objects at.
I was also getting script warnings about “too many ghosts” from NetConnection, so, clearly, there is an issue here. The problem now will be deciding how to fix it. The polycount isn’t the problem, with 512 objects and over 5 million polys on screen I get an easy 50 FPS in debug build. The problem is optimising the system to draw many small objects as quickly as one large one.
The main issues that I can imagine would slow this system down would be collision calculations for each objects, and network updates for each objects, but for this test, I used a single player game with no collision objects set, just simple TSStatic objects.
I haven’t finished my testing, but this will likely be a difficult challenge to overcome.
I have decided on my database and general server architecture for this project.
Torque has always had excellent network code, (and in fact, for a time the Torque Network Library was being sold as a standalone product) and generally the way networking works in a Torque game is that clients connect to a T3D gameserver by using a “master server” as a kind of directory lookup. This allows players to host their own servers, and other players to search for them using various search tags. The master server then returns a list of all of the (dedicated and non-dedicated) servers which match those search parameters.
For Astral Realms, which was basically the previous version of my virtual world concept, I used a slightly unusual setup for the game servers. Instead of connecting each client using T3D’s built-in multiplayer code, I instead set up each T3D client as a single-player client, with no networking. I then connected them to a complex Java server, which handled all of the object updates and synchronisation, and then send a list of objects to be rendered on screen to the clients. This list also included any other players in the area. The clients could also communicate with the database server using torquescript calls (although, for security and licensing, all of the actual SQL calls were done from the server-side, not the client). This system worked remarkably well, even with other players on screen. It was simple and easy to make changes to it, since I had developed it myself, and I knew the system well, and it was optimised for the type of project that I was working on.
The main reason why I used a Java game server and not a T3D based dedicated server was that I wanted to be able to connect to the game from other platforms. For example, I had a telnet client running that could access the java server, and interact with the game using text commands. I even printed out an ascii art map of the level with different types of objects represented by different letters, it was a great system. The idea was to try to integrate the virtual world with the real world as much as possible, and with a separate Java server, any device could interact with the virtual world, whether it is a smart phone, a computer with limited hardware, a web browser, etc etc.
I strongly considered using the same type of system for this project, since this project is essentially the next in a line of Virtual World type concepts, that all tie in to the same overall goal. However, with the previous virtual world concept, I focused more on the world building and object creation. I had a very complex system to model climate, zone-based object placement, etc (which I will also need in my current system) and the player was given tools to build structures. The system was designed for static objects, which wouldn’t require high-speed updates.
My current system, however, will focus much more on both social interaction (between human and AI players) and world interaction (interacting with flora and fauna, etc). This will require a network capable of handling fast object position updates. Consider hunting for example, if the player fires an arrow, or throws a spear, it’s position and velocity will need to be very precisely modelled in order to hit an animal. If the server lags even slightly, the system won’t work. Interaction between players, even though it will be quite rare (players will begin in a random location on their own, and may not meet other players for some time) will need accurate position updates to work properly. Visible lag will not be tolerable. I am also not really interested in developing browser based or mobile phone based plugins for this project, so I intend to use a T3D game server, which will connect to a mySQL database on another machine.
Since this is a persistent world game, there will only be one server (or one network of servers) so I shouldn’t need the master server either, but I may need to include it anyway if removing it proved to be more trouble than it’s worth.