It is not as hard as that
Let's work!

We are a group of developers in Unity3D/Photon will consider orders for freelance work:

Low-poly 3D modeling of individual objects and pieces of game worlds with LOD;
Production, optimization and obfuscation of game client-server logic C# of medium and high complexity;
Microsoft SQL - design schema, query system, stored procedures, creating a ready-made models of databases;
The integration of physical models of automobile and other third-party frameworks to the existing project;
Developing terms of reference and specific algorithms in a wide range of tasks to create gaming applications;
Examination of the terms of reference, the evaluation of performance, evaluation of the sustainability of the system to cracking;
We can also propose methods of reducing costs in developing applications based on your business plan;


A lot of screenshots from our project you can found in gallery.


Contact e-mail: mehanos@mehanos.ru

Permanent link to the dynamically developing project: http://mehanos.ru (it is in Russian so far, but we plan to make it multilingual in the future).


Testdrive

For a start you can make fast testdrive on several game maps which presented below. For best FPS results you may use FireFox or Google Chrome browser.



You can find other game maps for testdrive in text below.


How it started

Our group programmers and 3D modelers was initially challenged to create a client-server application architecture that could accommodate and enhance our experience and interests. It was based on the browser system type, with hardly compatible requirements, such as:

Browser principle: all the information is stored on the server and the client only downloads what is required;
Realistic appearance (Unity3D) and flexible GUI;
The possibility of a multiplayer game (Photon server, MsSQL);
The real car physics simulation (not arcade);
Laying the foundation for the scalability of the system;
Convenient administrating and debugging the problems arising from the client and server;

This has been achieved , although the task turned out to be much more difficult.


Technology

In this project our group gained the following experience:


You will find more information about it below.


Browser principle

>Minimization of downloadable content;
The hierarchical system of logical objects;
Principles of partitioning of large scenes by sub-objects;
The data transmission system of the game objects;


    The principle is the desire to reduce the waiting time player at the expense of downloading and storing only necessary in the current game situation. Well, why would he, in fact, download a map on which he will not go for a drive? Maximization of this principle has led to a paradoxical thought, why bother to download the game at all? However, this idea sounded too revolutionary, so we decided to stop on browser type game model, in which the player in the first phase only downloads the logic core and a number of images. All this is small enough to remain in the browser cache, so next time player will not download all data any more.

    The decision to use a browser type game that has imposed stringent performance optimization scenes, because the browser is one more layer, which eats part of the FPS!

    Мost complex object in the design turned out map of the Rostov city - it is too big, about 2 square kilometers, a total weight of ~ 300MB to wait while it fully loads, and in addition, it is full of repeating details such as derbe, poles, fences, several buildings.



     It was immediately obvious that all the details should be downloaded only 1 time. But not enough to simply scan the city, write down all the positions and turns of its component parts, you need to have to figure out how to transfer them sequentially from the server to the client, depending on which area of the client is, the transmission of information by sorting by priority (first to the roads, and then stalls ), it does not transmit the information twice, passing it without haste? This problem has been resolved and data technology in parts experienced several evolutions, and now it is clear that the optimization can be better. In particular, the city is loaded, but not unloaded, on the one hand it is good, because they do not have waste time to spawn objects, but on the other hand, the objects occupy a lot of memory. Therefore, the concept have geometric detalization level for game maps, the less detailed map will be, the less objects it will contain, at the same time on the detail settings affect the overall quality of the scene.

    And what with avatars of players which represented in the project by cars? They may not be the same, at least it has external body parts, interior parts, decals may be different in real life. So avatar too pumped in parts, and player downloads only what he need to spawn his and opponents avatars.

     Finally, for all potrebmnostey developed a hierarchy of logical objects Avatar Item Reference Asset handled by the Download system. The information and media samples for this system Optimized for minimal time required to request an object from Server before his spawn on the scene.


Realistic appearance

Developing a GUI, based on XML configuration;
Using Bitmap fonts in GUI (own development of the method);
Production of low-poly 3D models with LOD;
Knowing of Static optimization for the scene elements;
Quality group for the game objects on the game map;
Regulation of the overall quality of the scene from game menu;


     To display three-dimensional graphics has been selected Unity3D framework. Unity3D development environment is very convenient and intuitive, but it took a while to begin to discover its capabilities.

     Modelers and programmers began to create different playing maps, using different technologies, in the end we have a density ~ 8500 game objects, with the size of 11 MB in asstebundle file, with many textures have a resolution of 1024x1024. This map is called Harbour it has been widely introduced system of detail, allowing each scene with the best level of quality display more objects. Average video easily master the first 4 levels of quality, while Excellent and Fabulous levels may require a little graphics card upgrade .

By press on the bottom pictures you can make quick testdrive on Harbour map:



     With all the splendor of 3D graphics on the screen, we want to also display 2D elements of the user interface - GUI, and this is where we expect a surprise, it turned out that in an imperfect system of Unity GUI, therefore, has developed our own, highly optimized, handling reminiscent Winforms. In order to split programming with a desig needs we created a system configuration for the elements of scenes based on XML. Native System.Xml Library, with more than 1 megabyte of file size, is not best choise to add in to WebPlayer, so our GUI system use the very small XML parser class.


Multiplayer

Multi-user application;
Online mapping changes avatars through a selfdeveloped revision system;
Recording and playback system of player laps;
The system of synchronization of players’ position;
The implementation of the mechanism of car collision online;
Possibility to personalize the content;
Game chat with assist of our GUI system;
Creating special authorization schemes with data protection of play session;


     This aspect of the system required selecting a server, we first wrote and test the prototype on JAVA, but the separation of programmers in C # and JAVA was a mistake, so we decided to go to the C# version, and pick up the existing framework, which provides a good base functionality, able to UDP and the choice quickly fell on ExitGames Photon Server, as well as the data store, initialize the game world while turning the server was fell on MsSQL database.

     System server Mehanos, is responsible for storing the data of the players are currently in the gameworld, if a player leaves the server forgets personalized information. If a player has changed the status of his avatar, such as mount a new unit on car, the server checks the possibility of such action, including the intent to cheat, and stores the new player state in to the database, so later, when the server starts, it was able again to restore the previous state the game world and its players.

     In it work server does not keep in memory useless information, economically works with a database, in a regular situation it uses database as a backup in a case of a reboot.

     Auto racing a good occasion to develop a bot chasing with a real player. It's an interesting challenge, but we decided to try another model of robo-opponent: the detail trajectory of the one race is playing in another race for next player, comparable to the experience with the first existing. Accordingly, a methodology was developed for store and playback that replay for a player, buyout, the same can be used to view, for the purpose of study or of being caught hacking. Take a live look to this approach on Hockenheim map example:



     Presence of fast-moving players raises questions about the system of predicting the position of the player based on their speed and direction, it is necessary to not only to give the competition more realistic, but also to create the conditions in which the collisions between the players will handled normally. In fact, the RigidBody physics has only major player, for other players used information from Server about its place position and rotation, so other players have no physics "out of box" to realistic collide with main player, and we make some additional interpolation calculations for realistic colliding.

     One of the special differences in multiplayer games of recent times is the ability to design the characters in a wide range. In addition to replacing the visible components of vehicles, such as spoilers, body kits, hoods, wheels, etc., we have implemented a system of tuning, which allows entities to impose a variety of vehicles, mimicking the vinyl decals and thus give your car more personality. Below are a few examples, if you click on the pictures you can see the tuning scene completely in good quality, which will show on top area visible decals placed on the car:

    
    
    
    


     To discuss aspects of race and family trees of each other in game was implemented in-game chat, as in many other multi-player games.

     To protect game accounts, we implement a special mechanism for unity client connection to the game server, which uses a one-time access key. This approach would prevent network sniffing and use auth information to play from stolen account.


Physics

Prototyping plug-ins;
Integration of physical frameworks into the project;
Evaluation of physical models of cars;


     During this task we create our own physical interaction model of vehicle parts, such as springs, dampers, tires. In addition, we have consistently integrated into the project all known automotive simulation frameworks working in C #, created for Unity3D and WheelCollider and Pacejka. It was necessary to create a system in which all will be realistic interconnected, so that the installation of the spoiler adds aerodynamic coefficients and the mass of the car, and then works on well optimized physics of Unity3D engine.

     Even in the case of owning the best of the physical library, in any project there is a need to integrate this library in to existing code, it is not an easy task, as long as there is no well-established standards to programming physical models, and quite often they go without the necessary interfaces. Quite often, it is necessary to take the model code and embed it in the draft, and at the same time remember that the update will come out, and they, too, should be painless embed in to project build.

     As a result, won the mixed strategy - physics stood out in a separate library with the necessary interfaces to interact with it, methods of treatment have been allocated to the logic of physics and a long time in this system changes have not been made.


Scalability

Creating a lobby system;
Sight zones for players and objects on the game maps;
Optimization of network transmission;


     Our startup project has not yet reached the limits of performance, although located in a relatively weak hardware, providing low cost of development and testing stage, however, the system was originally laid architectural framework, which, if necessary, may to expand without some special dance with tambourine.

     Easy to understand how the system can be scaled through the analysis of its key bottlenecks. Several of these places can be specified in advance:

a)
The restriction on the volume of traffic transmitted from the client to the server;
b)
The restriction on the number of clients per server;
c)
Limit of the upload speed information between server and database (Web, and servers);


Within these major, interrelated constraints live others, such as the performance of the server's CPU, the volume of RAM, access speed to data on storage devices. A common solution is to divide the server roles and increase their number, so they will work with load balancing.

     Databases can be optimized for a long time before will needs hardware scaling, that is, analyzes the load on the circuit, create indexes, indexed views, changing attitudes, a special tool. It's more routine, such work is performed by database administrators and usually similar for games and accounting software.

     Game server aspects of the scaling is not so commonality as database. Let us keep in mind that the gameplay is divided into several parts:

* Authorization the choice of the playing area the game itself. Not all of these game pieces requires from the game server maximum performance, for example - authorization. It is actually checking access rights to the player account, made one time during one session by the one player. The server is responsible for this can be the small, stand apart from the more powerful "thresher", and have exclusive access to the auth database tables, or even to a separate database.

* Further, the selection of the playing area, or in other words the Lobby area, there is also no particular load often done in the lobby chat, but it allows the use Photon Server to keep 1000+ players in the same lobby room.

* The most interesting thing going on in the play area, car racing is important to accurately convey the current position of the player, while the frequency of packets between the player and the server reaches 50 that is more than many game uses. Such high frequency requires high performance from the server when a large number of players try to compete on one server map. Game client needs do not to send too much, for example those who are far away from each other the exact position on the track is not so necessary, so you can skip some packages, offloading the server network card. We was apply other know-how, allows to optimize the amount of traffic between the server and gamers. As for the scale, the play areas may be also separated, so that the new card will be created on the least loaded server, the benefit of a racing game it lasts 4-10 minutes and rarely more, so good balance load can be achieved.


Administration

Online application of the physics parameters;
Total record of all player actions by the server;
Creating feedback between the database and the game server;
Creating extended stored procedures based on the CLR;
Server side plug-ins for restricting the use of cheats in racing;


     Questions of the friendly administration best to solve once in the programming phase, at least on typical game tasks. Because when the time comes to quickly resolve the problem, the time has to be spent a lot, and loyalty to the system user may fall.

     The typical of the options we have implemented it is a substitute of administrator login with some one real player login. So admin can clear see the problem when he became a player. Other option is ability to send commands from the server to change the properties of objects in game world, for example, configure a car parts physics details through Web interface so that they will immediately appear in the game world without needs to reenter in to the game. Sam WEB interface works with the Gameserver by a special technology that prevents the capture and use of this channel to detractors. The database is also able to give the command to the server, and use CLR library which was included as an extended stored procedure to the database, performs the necessary requests to the server and returns the result.

     Not the easiest thing is to fix the cheaters, to this end, invented the system keeps a log of Player/Server interaction in compressed form to binary trace file, if necessary, there is a special parser to see what happened and in what sequence in that trace file.

     During the development of the system we have faced and limited the use of common cheat systems and have provided a lot of those, the use of which is not yet registered. The use of the server solves many of cheat problems quite quickly.



What's next? And the project is far from over, so there may be new information!
Следите за новостями и участвуйте в обсуждениях!