Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

283 Neutral

About ManHunter

  • Rank

Personal Information


  • Twitter
  • Github
  1. ManHunter

    MMOG Optimizations

      Honestly, at the moment I collected no detailed data. This will be the topic of another article, when I complete my analysis tools. With no data, I can surely say that this optimization affect your bandwidth in a positive way, because you will not send data to useless clients. But, in parallel, you also optimize your CPU usage. You increase your calculation complexity to populate your proximity lists (usually I do it on a parallel thread, few times in a second, not related with game update rate), but you also decrease your complexity when you need to perform operations over near entities.  As example, if I move my character, the server will need to broadcast your new position. If you made no optimizations, your server will send this update to all connected clients (or, atleast, you will calculate this list of near clients when you need to broadcast a packet around). If you made these optimizations, your server already has a proximity list for a specified entity, so you can easily send your packet around. A circular AoI is what I use too in my solution, but a nice subzone subdivision can help you to optimize the number of entities you need to iterate on to create proximity lists.     Not yet, because I don't send the entire entities' state for each update. I have different packets with a really restricted content for different situations. But it can be a nice solution depending on how you build your network solution. When a new player enters in my character's AoI, I will receive a packet with particular information, so my client can correctly instantiate the new player and its features.     Yes, I have a single game loop per map. But, also, I have a packet receiver loop on a separate thread (I'm currently using Lidgren). Basically, the game loop allows all entities to update their state and execute their routines. From these routines, various packets can be sent (depending on what happens in server simulation). When you send an action, instead, your message will be processed by another manager class (depending on action type, it can be processed by a different server), that can modify your player's state (or can influence other entities' state).     Not exactly, it isn't so hard as it can seem. With the help of a node manager, you can instantiate and monitor your processes on a single machine, so you can broadcast the internal state of your node manager to your master server, in this way you're informed about processes on all machines. I will write about this topic in detail in a different article. 
  2. ManHunter

    MMOG Optimizations

    Hi community, here is Emanuele from Crimson Games Development Department. An user asked me about how I am dealing with main MMOGs problems in Heroes of Asgard, so I prepared an article about this topic. So today we will discuss about main optimization problems that you can find in a MMO game development. I will be happy if someone will add his contribute, so we can learn together: I will add it to open post! DEFINITION By definition, a MMOG should allow you to play with a huge amount of people at once and interact with them as if you are in a normal multiplayer game, this in a persistent world. Now, if we want to dissect a little more this statement, we will see that this is impossible without applying various “tricks” behind the scenes. WE ARE COMPLAINING ABOUT PERFORMANCES You can definitely understand how when the amount of connected players grows, server performances will be degraded. Many operations on the server are required to operate on all connected players or a subset of them, on all objects around the world, on all monsters and their AI, etc. All these calculations are executed several times per second: imagine, then, to have to iterate over 200 players, having to iterate over 2,000 players or having to iterate over 20,000 players, frame each frame of your server simulation. For each iteration, I have to send packets, make calculations, change positions, etc. There is, therefore, an exponential growth of the computational load for each new connected player. As you can well imagine, is a very large amount of work for a single machine, this due to an obvious hardware limitation. Usually, therefore, there is a maximum threshold of concurrent players simultaneously processed, after which the server itself (the physical machine) can not keep up, creating a negative game experience (lag, unresponsive commands, etc). You can not accept new connections beyond this threshold until a seat becomes available, in order to not ruin the experience for those who are already connected and playing. You could then start multiple servers on different machines, so you can host more players, but of course they can not interact with players from other servers. The division into various “server instance” definitely does not fall within the definition of MMOG, as it does not allow you to interact with all players in a persistent world, but it creates different instances of the same world. It is acceptable, of course: but it isn’t what we want to achieve. That said, what can we do to “bypass” a little bit this problem? And what did I already do for Heroes of Asgard? What I describe is the result of my experience and, therefore, it is also what I provided for Heroes of Asgard, obviously trying to get the best. WHAT CAN WE DO? There are several measures that can be applied to improve the maximum threshold. Yes, improve it: there will always be a maximum threshold beyond which it is difficult to go (by maintaining the same hardware, of course). YOU ARE THE CODE THAT YOU WRITE As first thing: write good code, with your brain attached to this task and without unnecessary waste of resources. It may seem obvious and trite, but it is not. Wasting resources is equivalent to worsen server’s available resources. Wasting bandwidth means exhaust it in no time, every single piece of data that is transmitted has to be carefully selected. If I send an extra byte for each user, when my server hosts 20,000 players, it means sending about additional 20KB for each frame. Wasting CPU cycles is like shooting myself in the foot: the actions you perform must be kept to a bare minimum, add a single more function call per user may mean adding N additional CPU cycles, which for 20,000 users will be N x 20000 additional CPU cycles. Waste memory (and therefore to allocate unnecessary resources) is harmful: the allocation requires both additional CPU cycles and memory. And system memory ends. In managed environments, also leave resources allocated causes garbage collection, which may mean spending huge CPU cycles to free resources, instead of serving the players and simulate the world. Ultimately, wasting resources in your code will ensure that you will spend more money and more frequently to improve your servers (when your userbase increases), in order to maintain acceptable performance. FIX YOUR SIMULATION As you certainly know, the simulation of a virtual world can be executed a certain number of times per second by the server. This means that every second, all entities and systems in the world are “simulated” a certain number of times. The simulation can include AI routines, positions/rotations updates, etc. It allows you to infuse ”life” to your virtual world. The number of times your simulation is performed is called FPS or Frames Per Second. It is obvious that if the simulation is cumbersome and requires time, our hardware will tend to simulate the world less times in one second. This can lead to a degradation of the simulation. But consider: does we need a big amount of simulations performed by the server? Does we need to strive our hardware in this manner? Can we, however, improve this? Yes. For most games with few players in the same map, and a high game speed (see the FPS, with a high number of commands) our world can be simulated 60 times per second (or less, obviously it depends on game type). For a MMOG a more little amount can be enough, depending on the genre. There is no need to simulate the world many times per second as possible, since this will change the simulation in a minimal way, wasting more resources than necessary. In Heroes of Asgard, for example, the world is simulated 20 times per second (at the moment). DO WE NEED TO KNOW ABOUT THE ENTIRE WORLD? We said that in an MMOG we must be able to interact with other players and with the surrounding environment and I should be able to do it with anyone in the world at that time. Quite right, of course. But, from the point of view of a player, do you really need to know what a player is doing on the other side of the map? No, not always. Indeed, in the majority of cases this player isn’t interested to know if another player, as example, is walking or not in another far area. Send an information that can not be displayed on the user’s screen is a waste of resources. This observation is important, it allows us to implement a big optimization. How can I inform a particular player only on entities that may interest him? Why not break the map (or maps) in zones? A simple subdivision is grid one: divide the map in N x M zones, where N and M are greater than or equal to 1. This technique is also known as space partitioning or zones partitioning. In this way, a player can only receive information on the entities contained in its area, without needing to have knowledge of distant entities. If in my map 8000 entities are uniformly distributed and it is divided into a 4 x 4 grid, the player who is in the [1, 1] zone will have the burden of receiving information only about 500 entities. A great advantage, doesn’t it? But consider: what if the player is on zone’s borders? It will not see the players in the nearby zones, although they are visible. We can therefore understand that the player will have to be informed about the entities contained in its zone and in zones immediately contiguous. The size of the zones allows you to optimize a lot this method, so depending on the size of a map the size of the grid can vary , in order to obtain the best effect. Also the shape of the zones can vary, to better fit to the composition of the map. LOOK FAR AS THE EYE CAN SEE As mentioned, zone division already offers a decent level of optimization, allowing us to send information about a single entity to the players who really can benefit from them. But let us ask ourselves a question: can we identify useless information in our zone division (remember that also include those contiguous, so in a regular grid we have to dealt with 9 zones in the worst case)? Of course we can. Most likely a player does not affect entities outside of his field of view. If I can not see an entity, I do not care to trace what it is doing, although it may be in my own zone. Then sending information about that entity is a waste of resources. How can you determine what your server needs to send to a specific player? The easiest way is to trace, in fact, the field of view. Everything within that radius is what matters to the specific player, entities outside are not necessary to the specific player’s world simulation. And since we already have a zone subdivision, we can simply iterate over the entities in player’s zones of interest (instead of all entities in the map) to determine who is within our field of view. This concept is also called area of interest or AoI. So, continuing the example before, let’s iterate on 500 entities instead of 8000, to extrapolate those hypothetical 25 which fall within the visual range and exchange information through the network only with them. From 8000 to 25, a good result: doesn’t it? And without the user suffers of missing information as it does not see them. Indeed, it will notice less use of resources. You can further enhance the area of interest, by applying various measures:organize various levels of visual rays; the most distant entity will receive updates less frequentlyfilter the interesting entities depending on the morphology of the map; if an entity is in our sight, but behind a mountain, I can possibly ignore it. This measure, however, (in my opinion) only makes sense if you already use culling for other things, so you don’t introduce additional calculations to filter few other entitiesDISTRIBUTE YOUR COMPUTATION LOAD We already said that a single machine will still have a certain threshold beyond which, despite all the optimizations made, you will experience performance degradation (and thus a bad gaming experience). Fine, but then why not take advantage of multiple computers simultaneously? There are obviously different ways to do it. For example, in Heroes of Asgard each map that composes the world is hosted on a separate process. This causes each map can be hosted on a different physical machine. Obviously, however, you can go down even more and accommodate sets of zones on separate processes (so a single map may be divided into several parts and hosted by different servers). SLICE YOUR PIE You can also combine global services (such as chat) in different server processes, to give to your player the impression that, even being connected to different maps (so different servers), you can interact with distant players. Furthermore, break those services from the main world is getting an additional gain in performance. RECYCLE YOUR TOYS As mentioned, allocate memory costs a good amount of resources. So why not reuse what we already allocated? The use of objects pools is of great importance in the multiplayer development. It allows to shift the burden of allocating costs when it can be faced with no problems, for example during bootstrap of our app server. A monster is defeated and dies? Well, I put it aside. I can use it again when another monster must be spawned, just recovering from my pool. Of course it is clear that you have to use a certain criteria in order to choose which objects to keep in memory and which are not. Should I keep in memory a pool of a monsters that spawns once a month? No, it may be useless. Should I keep in memory a pool of objects representing the drop of the currency? Yes, it makes more sense. USEFUL LINKS Of course, an important part of this thread is for resources. Articles, papers: each thing you think that can be useful on this topic. Spatial Partitioning http://gameprogrammingpatterns.com/spatial-partition.html Objects Pooling http://gameprogrammingpatterns.com/object-pool.html Game loop http://gafferongames.com/game-physics/fix-your-timestep/ Feel free to add your questions or your contribute! Best regards, Emanuele
  3. I'm working on a MMORPG (server side and networking part) for my company and I'm working on my own architecture for distributed/load balanced servers for all MMO games (see Pulse.NET on Unity forum, if you're interested I will post something here). I will read your chapters, I really love to read something on this topic: there are few documents on MMO networking.
  4. P.A.T.C.H. is a professional solution for applications patching and updating. It can generate very small patches thanks to included file binary diffing algorithm. What it means? It means that if you change only 5 bytes in your build, P.A.T.C.H. will create a patch that will change only that 5 bytes on users' builds, instead of downloading the entire edited file. Your users will be able to maintain updated their application copies with no pain or headaches. And you will be able to create patches quickly with our included tool! It includes Unity integrated tools and standalone version (if someone prefers to use it). You can export Unity integrated P.A.T.C.H. for each platform you want thanks to Unity. Standalone P.A.T.C.H. can be compiled for each platform you need with Xamarin/Mono. You can check out this feature in P.A.T.C.H. documentation. P.A.T.C.H. supports each type of application: Unity based or standalone. If you can run Launcher, you can use this patching system: games, business applications, websites, etc. Asset Store: https://www.assetstore.unity3d.com/en/#!/content/41417 Features: • Binary diffing algorithm; • Enables very small patches; • Bandwidth saving; • Checking for patches hash; • Strong patches compression; • Callbacks system to monitor what P.A.T.C.H. is doing; • Encrypted configs; • Linear and non-linear patches application; • Unity GUI integrated; • Customizable settings; • Outstanding flexibility; • Comes with launcher source code; • If download fails, it will take care to download again failed patch for customizable amount of attempts; • Launching argument to avoid obsolete clients; • Files download over FTP; • Localization system integrated; As usual, I would so much like to receive suggestions on what to change, add or delete. In addition, if any of you decide to buy it, I'd like to receive feedbacks on your experience! I want to improve this software to meet the needs of the user base that will use it! Documentation: http://mhlab.altervista.org/p-a-t-c-h-documentation/ Some Launcher skins created with P.A.T.C.H.: Best regards, Emanuele
  5. Here we are with a new P.A.T.C.H. update! New version, 1.2p1: https://www.assetstore.unity3d.com/en/#!/content/41417   Changelogs: • Added a new event to check when current build version changes • API: PatchManager class now exposes GetCurrentVersion method • Added a reminder of current build version in Launcher • Patching process now will apply ever the latest patch available, so if you have 0.1>0.2 and 0.1>0.3, P.A.T.C.H. will apply 0.1>0.3 patch, skipping 0.1>0.2 • FIX: Version constructor now strips correctly “\r” char from remote hashes • Added some new LogEvents to describe better what is happening during long processing • Added new in-game GUI that informs your users when checking of launching arguments fails • Added forced run-to-admin behaviour to Launcher and Patches Builder for Windows • FIX: now Launcher will apply patches in linear way and non-linear way both, without Launcher restarting • FIX: added a “s” char in versions.txt example URL, in this way users can't be wrong • Added support for FTP credentials to download files over Files Transfer Protocol.   Let me know!  I like your advices to improve usability and user experience, so don't be shy!   Best regards, Emanuele
  6. P.A.T.C.H. v1.1 is out!   Changelogs: - FIX: patching process run now on a new thread  - FIX: delete file process now retry to delete files for a customizable amount (to avoid deadlocks on file deleting)  - FIX: PatchFailed event now doesn't shutdown the patching thread before GUI updating  - Added core version reminder and launcher version reminder to Launcher  - Added core version reminder and patches builder version reminder to Patches Builder  - Added patch rollback feature: if patch process fails all changes will be discarded to avoid a build corruption  - Added generation of patch files indexer in patch building process  - Added hash validation for patched files   Let me know! :D
  7. ManHunter

    Pirate Crusaders

    Howdy, Today I present a new game branded Crimson Games. No more talk, video and images speak louder than a thousand words! Website: Pirate Crusaders - Website Forum: Pirate Crusaders - Forum [MEDIA=youtube]https:[/MEDIA]   Official presentation: [spoiler][/spoiler]   Artworks: [spoiler] [/spoiler]   Closed Beta Test is started successfully! CBT testers will be rewarded when the Open Beta Test starts!   As always, we are very interested in your feedbacks and advices.   Thank you!   Best regards, Emanuele.
  8. ManHunter

    Heroes of Asgard - MMORPG

    Hi guys, what I'm presenting is called Heroes of Asgard, a Crimson Games' project that I'm developing as Lead Programmer.   I write immediately some reference, if you want to read a detailed page. Site: http://crimson-games.com/ Devblog: http://crimson-games.com/devlog/   Heroes of Asgard is an hack 'n slash, old school MMORPG, but with the inclusion of new ideas and a gorgeous graphic (we tried to reach a good graphic level). It is based on the concepts learned from Metin2 (our team played the aforementioned title), which has influenced us so much. For the history and description of classes, I refer you to page Indiegogo, where it is explained really well. The development is still in progress, we are working for months now and I'd much pleasure to receive comments and a tons of constructive criticisms!   Update:   while we are waiting for character presentation, here is a glimpse of Talos. It is still a work in progress, but our guy is making certainly a good work!   Summary: "Talos, a strong and mighty kingdom who fought bravely against the titans, where names of those legendary heroes are now recorded in the book of Asgard. Talos is the birthplace of great heroes. The Talosian are proud of their ancestors and train hard each day with an aim to continue the legacy and be remembered forever."   Screenshots:     UPDATE: The character in question is the Sura (many of you know from experience just in Metin2, but for those who do not know what is: http://en.wikipedia.org/wiki/Asura), an entity halfway between the man and the devil, able to develop its strength through the Dark Arts and evil. His body is gradually eroded and corrupted by the evil that he uses as his strong point. Here is a screenshot:   UPDATE 15/05/2015   Persistance manager added, the position of the players is now saved at regular configurable intervals, with a system that always finds the last valid position Rewrote the database wrapper, I did not like as I had done before: now I like it Various modifications and additions to the manager of equipment and items, also added CRUD functionality for their rescue Now I'm working at the monster spawn in the maps, then: The map is loaded in it are loaded spawn groups, easily configurable (I will make also a tool to create them directly walking maps) Spawner thread of the map is instantiated, which is responsible to check the status of the group spawn and spawn them effectively   UPDATE 02/06/2015   Server side: Monsters included in the maps (for the moment only the map of Talos) and subsequent spawning on remote clients Place various proximity list to ease the load on various calculations Made a skill system (which I believe came cute) Created and tested physical attacks against other entities of the game Client side: Added an interpolation system on the motion of remote entities Spawning visual monsters communicated by the server Started the making of Ascalon map UPDATE 20/06/2015 Tested and debugged monsters spawning on various clients Tested and debugged area of ??interest for players and monsters Minor changes to the skill system, a skill now can invoke a specified script Minor changes to the bonus system, you can now assign an array of callbacks to be called when the value of the bonus changes Tested, debugged and improved the first skill (the classic melee attack) Added elements in the GUI to bring clarity to the world of game (names of players and monsters, physical damage, magic damage, critical  damage, heal amounts, etc.) Fix on MonsterGroup: now for the respawn is necessary that the whole group of monsters is dead Introduced exping and leveling on server side Introduced exping and leveling on client side, with its effect (to be improved) Parallel tasks: rewritten some service to improve maintainability and performances     Soon, probably, I will post new screenshots or a video.  Stay tuned!   Best regards, Emanuele, Crimson Games Lead Programmer
  9. Hello everyone, finally my solution for games and applications patching/updating was accepted on the Asset Store. As usual, I would so much like to receive suggestions on what to change, add or delete. In addition, if any of you decide to buy it, I'd like to receive feedback on your experience! I want to improve this software to meet the needs of the user base that will use it!   Let's introduce P.A.T.C.H.!     P.A.T.C.H. is a professional solution for applications patching and updating. It can generate very small patches thanks to included file binary diffing algorithm.  What it means? It means that if you change only 5 bytes in your build, P.A.T.C.H. will create a patch that will change only that 5 bytes on users' builds, instead of downloading the entire edited file. Your users will be able to maintain updated their application copies with no pain or headaches. And you will be able to create patches quickly with our included tool! P.A.T.C.H. supports each type of application: Unity based or standalone. Features: - Binary diffing algorithm - Very small patches - Bandwidth saving - Checking for patches hash - Strong patches ZIP compression - A lot of raised event to hook to monitor what P.A.T.C.H. is doing - Encrypted configs - Customizable settings - Very flexible - Comes with launcher source code - If download fails, it will take care to download again failed patch for customizable attempts amount - Launching argument to avoid obsolete clients   Asset Store: P.A.T.C.H. - Ultimate Patching System Documentation: P.A.T.C.H. - Documentation Support: P.A.T.C.H. - Support   Best regards, Emanuele
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!