openTTD tileset atlas I'm trying to create an isometric game and would like to use some tiles from Open Transport Tycoon Deluxe newGRF library link The atlas I'm used to work with are basically a big image that can be splitted in 64x32 tiles, so I can use any Atlas import tool or just easily extract the tiles with a loop. However, OpenTTD uses atlas that I don't understand. The files look something like this, where each tile has a numer and starts at positions that are not evenly distributed. I assume it might exist some file with metadata that contains the locations and sizes of each tile, in order to be extracted and used. Has anybody experience with this type of Atlas? How can I extract the tiles so I can use them? Thanks


Torque2D, Class vs Datablock I'm scripting my first game with Torque2D and have not fully understood the difference between "Class" and Datablock. To me it seems like Datablock is similar to a struct in C C or a Record in Pascal. If I create Datablocks with keyword new, are they instantiated in the same way as a "Class"? I have a large TileMap and need to attach some information to each Tile. I was thinking to use a Datablock, as a struct, to attach this information to the tile's CustomData property. The two questions are What is a Datablock and should I use a Datablock or a "Class" for this tile information?


How to draw a character behind and in front of a building? (isometric map) how is it possible to draw the player behind and in front of some building in an isometric map should I slice them, replace the number in the map (one number for a tile usually) by an array of number (each being a piece of a bigger tile), and somehow add a Z order related to each small number (the pieces of building), something like this? replace var map 1,0,1 , 0,1,1 , 0,0,1 , 0,0,1 by var map "2 zOrder 1","3 zOrder 1" ,0,1 , 1,1,1 , 1,0,1 , 0,0,1


Tile tilemapping render error I'm having rendering issues in Tiled with a border tile I'm applying to shapes. In Tiled In game I'm using Tile Flipping to reduce work. I thought this may be the issue, so I tested out a few tiles by themselves Tiled In game They render as expected What may be the cause of this? My game engine is Melon JS


Building placement in tilemaps (pattern matching) I'm building a small RTS and in my code I've given my buildings a pattern, much like you would pieces in tetris, i.e. I want to place irregularly shaped buildings on a map without overlaps. The map could be 100x100 and my structure that I'm placing could be as follows OXO XXX XXX I'm currently bruteforce checking each building cell individually against cells in a map. Is there an easier nicer way to check a tile map for a matching pattern?


How to use multiple tilesets in a map? I'm currently looking at this phaser example http phaser.io examples v2 tilemaps blank tilemap Here, the author creates a simple tilemap editor. In line 33 he adds a preloaded image as tileset. The problem is the author adds only one tileset but I'd like to add multiple tilesets to the map (via map.addTilesetImage), switch between them and paint with the "current one". I've read multiple times on the internet that it is possible to add and use many tilesets on a single map, but so far I haven't found any examples of that and the phaser docs also don't give that away.


How to use 16 32 square pixel tiles in tilemap on arbitrarily sized canvas in Phaser My question is about Phaser and Tiled but I'm not quite sure how to ask it so please bear with me. Do I need to make the size of the canvas or area on which I want to display my tilemap a multiple of the size in pixels of an individual tile in my tileset? Or is there a way of scaling a tilemap to fit a particular screen area? I'm not really sure how to explain my question better so I will give an example of what I'm talking about. Because I'm using only freely available game art (such as that found on opengameart.org), most tilesets come with tiles sized 16x16 or 32x32 pixels. Does the game area I want to display the tiles in have to be a multiple of 16 or 32, respectively? Or put another way, if I wanted to have a grid of 32x32 tiles fit inside of a canvas of say, 900x900 dimension, must I have to draw design my tiles to be of size 28x 28 pixels? And if I want to use a tileset with tiles of size 32x32 must I make the canvas a multiple of 32, like 1024x1024 for example? Thanks for bearing with me and for any help.


Did old games like Golden Axe or Street or Rage use tilemaps? I am wondering if old games like Golden Axe (genesis) or street of Rage (genesis) used tilemaps or background bitmaps for the levels. I could not find any resource that explain this and searching around in the web I can find background images, but I never found any tilemap for the levels. This off course, does not answer the question, but it looks like they used background bitmaps for the entire level. But I am not sure if it was practical for those old consoles to store such "big" images and render those. Does anyone knows a bit of programming on those old systems and knows how those "perspective" levels were built?


How do I convert an image into a tile map? I am working on a game in Pygame Python, and I'd like to turn an image into a map. The idea is simple Pixels in the image are colored by tile type. When the program loads the image, I want the color (e.g. ff13ae) to be matched to a certain grass tile, and the color (e.g. ff13bd) to a different tile. I know that I may have to convert from hexcodes to RGB, but that is trivial. I just want to know the way I to go about loading an image file, mainly because all my other games don't do anything of this sort.


Manually creating cycles in planar, procedural trees? I am creating a procedural map using delaunay triangulation and an MST. I'd like to have a bit more control over my final graph. Like when i was looking looking at the MST I wondered how I can connect specific points of the MST? The following image shows the MST in green and the points I want to connect in red. I was thinking about traversing from a dead end and counting the steps. When it gets within a certain treshhold add a connection. But this might add a connection when there is still a room closer to it. So I have to check for that as well. Same goes for entrance, exit and perhaps other important places on the graph. I want to end up with a random yet fun and playable dungeon. There must be proven concepts about controlling a graph for procedural dungeons and I would love to learn from it.


Segmentation Fault using Allegro Tiled, function al open map() I have consistently segfaulted trying to load a TMX file into a map. int main(int argc, char argv ) ALLEGRO DISPLAY display NULL ALLEGRO EVENT QUEUE event queue NULL ALLEGRO TIMER timer NULL ALLEGRO KEYBOARD STATE keyboard state ALLEGRO MAP map al open map("data maps", "TestMap.tmx") ... Active debugger config GDB CDB debugger Default Building to ensure sources are up to date Selecting target Debug Adding source dir home X Desktop Programming C AllegroRoboticsTest Adding source dir home X Desktop Programming C AllegroRoboticsTest Adding file home X Desktop Programming C AllegroRoboticsTest bin Debug AllegroRoboticsTest Changing directory to home X Desktop Programming C AllegroRoboticsTest . Set variable LD LIBRARY PATH . usr local lib opt opencascade lib Starting debugger usr bin gdb nx fullname quiet args home X Desktop Programming C AllegroRoboticsTest bin Debug AllegroRoboticsTest done Setting breakpoints Debugger name and version GNU gdb (GDB) 8.1 Program received signal SIGSEGV, Segmentation fault. In al get standard path () ( usr lib liballegro.so.5.2) 2 0x00005555555563ba in main (argc 1, argv 0x7fffffffe3a8) at home X Desktop Programming C AllegroRoboticsTest main.c 45 At first I thought, maybe I just didn't build the library right, so I rebuilt it 2 more times, once as a static and another as a shared library. The interesting thing is that it builds just fine when using the cmake files that came in the example. I cannot recreate it though. This is the callback after I moved the open map command into it's usual place, directly from the example that comes with allegro tiled. If MAP FOLDER is relative to the working directory and not the running executable, then add a call to al find resources as(RELATIVE TO CWD) before calling al open map() . al find resources as(RELATIVE TO CWD) map al open map("data maps", "TestMap.tmx") int map total width al get map width(map) al get tile width(map) int map total height al get map height(map) al get tile height(map) Draw the map al clear to color(al map rgb(0, 0, 0)) al draw map region(map, map x, map y, screen width, screen height, 0, 0, 0) al flip display() ... Setting breakpoints Debugger name and version GNU gdb (GDB) 8.1 Child process PID 25749 In strtoll l internal () ( usr lib libc.so.6) 3 0x0000555555556615 in main (argc 1, argv 0x7fffffffe3a8) at home X Desktop Programming C AllegroRoboticsTest main.c 114


Generating "tile map" by stamping a full map I'm building a game using Tiled tilemap editor. I was originally creating tilesets to stamp around and create my map in Tiled. Id prefer to create the base map in a Adobe Illustrator and stamp in the whole map as the level. Then stamp in trees or whatever on more layers as needed. What are the implications on performance doing it this way vs creating the tilemaps and stamping them in tiled? Example Tile Stamped Map


Touch Gesture Map Movement I really dig the way that the map is moved in Clash of Clans (https itunes.apple.com ca app clash of clans id529479190?mt 8)... I can recognize the pinch and finger movement needed for the zooming and the swiping around the map, what I'm looking for is a tutorial in any language that reveals how to test for the map going out of bounds when moved or scaled. My google fu has failed so far on this one, any hints? Right now I can perform the scale operations and the movement operations, but I can't figure out how to stop the map from going out of bounds when pinched or scaled. My code is a crazy mess and makes me think I'm missing the fundamental logic of how this is done. (I am using Starling with AIR, but a tutorial in any language if you have a link). Update this is what I'm basing what I have currently so far https github.com PrimaryFeather Starling Framework blob master samples demo src utils TouchSheet.as


What maps sizes did old 2D RTS games like C C and WarCraft support? I'm looking for the size (in tiles) of the maps for the old 2D games Command and Conquer and Warcraft 1 and 2.


How do you use these kind of rpg ground tileset ? Searching about some tilesets for a little RPG game, I've often found these kind of tileset Their structure are special, there is two upper tile and 4 others for the same material. I understand that, like that, you have all what you need to create more various shapes than simple rectangles of different sizes. But I don't get how they are used in practice. I'm talking about the two little upper tiles that are used to make some corners. for me the 4 corners are stored inside only one tile ? (hard to explain with my bad english but I'm sure you understand what I mean) Also, do you know if that tilemapping technic has a name ? And do you kown if it is possible to use them directly in Tiled ?


Capping neighbour height difference on heightmap? I am generating a heightmap with some basic perlin noise but I need to cap the differences between each neighbouring value. A cardinal neighbour can only be 1, 0, 1 in difference while diagonal neighbour can range from 2 to 2. What is a good approach to make sure the map is generated within these rules? Does perlin or a small extension help me do this or should I make 2nd pass after the map is generated by perlin or simplex? I am currently doing the latter where I go over each tile and change it's cardinal neighbours according to it's own value but it is going over the same position number very often.


How exactly do you deconstruct the Tiled Map Editor exported tile ID? I am trying to build 2D maps with Tiled Map Editor for my game, and I export them under text format, so a tile can look like this 1,2,3,15,2,12,2 5,23,1,6,2,3,4,6 and so on, for many rows. In this link you can see an example of a map, to get a better idea. Now let's say I have 3 layers, each using its own tileset. The numbers in the layer represent the ID of the tile, basically the number of the tile in the sheet. If grass is the 2nd tile, then the ID is 2, and so forth. However, as you can see in the link, different tilesets will export different IDs per layer, notice how in the object layer I can have IDs such as 81, when in fact the ID is only 1, so it adds up 80 or so. Since I am trying to make my map system as flexible as possible, I need the real ID in order to make some calculations. How does tiled export these sort of IDs? I simply want to determine what number to substract in order to get the id, like so tile.id currentid something strange


How are really big maps made? I'm interested in how huge games like The Witcher 3 and Skyrim create and save the open worlds. In my own game I used a system where I stored the map data in a file seperated by commas. For example 'stone' would code for a stone tile, and I just typed in codes for how I wanted my map to appear in the game. I feel like this was a really innefficient and incorrect way of doing things. But, I couldn't think of a different way to get past the problem. The creators of skyrim obviously used a level editor, but how did they actually save a map as big as skyrim's world? How is the data stored? Because with something as intricate as an amazing, 3D world, you can't store it like I did by just having codewords for different tiles that are all the same height and width. How is it done in 2D games as well? For example Ori and the Blind Forest, which does not use a tile based system. Or, in fact, do they not have files that hold data for the level layouts at all? Thanks )


Store metadata for tile in Tiled Map Editor In my tilemap based game, I need to associate lights with light switches, buttons with doors etc. I am using the Tiled map editor (mapeditor.org), but I have yet to find a way to store these associaltion. My idea is to store a number with each tile, so I can have groups of tiles that interact with each other. Is there a way to store custom data with each tile in the Tiled map editor? Just to be clear I don't want to store custom data with each tile type, but with individual instances of one tile type.


What AI scheme is appropriate for a 4 player, Tic Tac Toe style game? I am about to release an android game that is like tic tac toe, but on a bigger board, and 4 player. Instead of winning when you get 3 in a row, you get points for chains, and the most points at the end wins. I'm going to have a later release that will include AI, but I'm quite new to this. Would minimax be a good choice, but does it work in 4 player? I'm worried that because there are around 90 possible moves for each turn then this would get slow too slow for large enough searches. Any suggestions?


How to force a sub optimal path I'm currently trying to develop a "Taxi Driver" AI that intentionally makes sub optimal pathing decisions. I need to have my driver go from point A to point B using a sub optimal but still logical path. "Logical" in this case isn't a well defined condition per se but it is instead defined as a path that would make sense to a passenger (player). Here's an example where Green Optimal Red Suboptimal but "logical" Blue Suboptimal but "illogical" I'm currently using A so I tried modifying node weights but I couldn't find a way to come up with a logical value for the weight. I've also tried to sometimes pick a random open node (in the right direction) instead of calculating the closest node. However this (understandably) made the pathing look even more illogical. If it can be done I'd like an A solution but I'm open to other solutions as well (even non pathfinding solutions!). It is fine if a solution doesn't always give a sub optimal path for certain conditions (e.g. only one path possible all paths are the same length etc).


How does pathfinding in RTS games work? crossposted from stackoverflow In a game such as Warcraft 3 or Age of Empires, the ways that an AI opponent can move about the map seem almost limitless. The maps are huge and the position of other players is constantly changing. How does the AI path finding in games like these work? Standard graph search methods (such as DFS, BFS or A ) seem impossible in such a setup.


Pokemon Artificial Intelligence I'm working on a thesis about programming an AI combat system for Pokemon (To be implemented in Showdown!). However, I would like to include historical information about the existing implementations of Pokemon AI. This information would offer valuable context to my thesis. I have been scouring the internet for some sort of algorithm that explains how the AI Trainers make their choices, but have found nothing promising. I realize the fan games have implemented some more interesting AI systems for their trainers, these would be interesting to see as well. What I am looking for is examples of the methods used for Pokemon Battle AI decision making used in Pokemon videogames, whether from main series by Nintendo or the many fan games out there. I realize most of these pose no challenge to an experienced player, but I don't mind, I only wish to compile historical information on previous Pokemon AI attempts.


approach for the system that record player actions and imitate it I am trying to implement some kind of system, that would allow AI to imitate player's action at certain points in similar cases. Case example Player (hp 10, mp 5) used skill BasicAttack when in battle When I set for a bot parameters like hp 10, mp 5 and state attack it should use BasicAttack skill because in same case player used that action. (I'd like to have ability to define similar cases like when hp 11, mp 6 then bot use BasicAttack too because it is similar to hp 10, mp 5 case but whatever) The question is that what are the basic approaches for such cases? Leaving aside snapshotting of player's state, how can such system be implemented? So far I have two ideas. My ideas are 1. order player parameters by priority and states and create tree where every node would be corresponding parameter value. For example node with name hp and value 10 will have a child note mp with value 5 thus I can create required paths to actions 2. I have event log with recorded player events. It keeps its record ordered. I iterate over it and using pattern matching I compare player parameters and retrieve corresponding player action The first approach seems much faster though. But I'd like to know if there already exist approaches for such systems, in order not to reinvent the wheel as I used to do. Are any?


What are the possible options for AI path finding etc when the world is "partitionned"? If you anticipate a large persistent game world, and you don't want to end up with some game server crashing due to overload, then you have to design from the ground up a game world that is partitioned in chunks. This is in particular true if you want to run your game servers in the cloud, where each individual VM is relatively week, and memory and CPU are at a premium. I think the biggest challenge here is that the player receives all the parts around the location of the avatar, but mobs monsters are normally located in the server itself, and can only directly access the data about the part of the world that the server own. So how can we make the AI behave realistically in that context? It can send queries to the other servers that own the neighboring parts, but that sounds rather network intensive and latency prone. It would probably be more performant for each mob AI to be spread over the neighboring parts, and proactively send the relevant info to the part that contains the actual mob atm. That would also reduce the stress in a mob crossing a border between two parts, and therefore "switching server". Have you heard of any AI design that solves those issues? Some kind of distributed AI brain? Maybe some kind of "agent" community working together through message passing?


What AI modding is possible in Civ 5? I'm interested in tinkering with the AI in Civ 5. I know there are XML files that can adjust the AI's strategies, but are there other easily moddable AI components? The XML files contain comments that reference some CPP files, are those available to end users or are those comments just aimed at internals?


Roguelike game detect intent of other actors by observing their moves In grid turn based roguelike game, how can I detect the following scenarios other actor is following observing actor other actor is intentionally moving to block its path Path blocking can happen if for example player intentionally stops right in front of actor and then when actor moves to avoid player, player moves in front and that keeps repeating as long as player does it. I managed to detect that situation in hackish way and I would like to know if there is a better method for solving things like this.


Collaborative Diffusion vs. A for loose armies combat any clear winner? Collaborative Diffusion (CD) takes a lot of the work that A does and combines (writes) it cheaply for multiple agents to read cheaply. This is because the majority of CD's processing works via a simple CA diffusion approach that produces a single shared map for every agent to use on a given game update. Agents then perform hill climbing within that space, which is also very cheap. The primary downside is that the data structure created by CD must apply for all agents that is, each agent's subjective view of the environment is identical A OTOH needs a path calculation per agent, each frame. In spite of this, the relatively low cost associated with CD would seem to make it, on average, a far more suitable approach than A , even when we must create unique views for agents (comments experience on this are welcome). EDIT Consider the following example using Collaborative Diffusion Two armies are on a battlefield, each army emitting a uniform scent. They charge (climb the scent gradient), and as the two lines clash, each agent takes on the first, closest enemy agent on the opposing line. This happens because on each approach step for each unit, it checks whether it's yet adjacent to an enemy if so it locks on attacks indiscriminately. This is much freer than specific targeting, which is where A would seem to be a better choice. Am I correct in these assumptions? Are there other downsides to CD as opposed to insert your flavour of A , for selecting ANY target between large groups?


How can I maneuver an AI pirate ship for a sea battle? I'm trying to picture in my head what would be required to make an AI controlled enemy do the following in a top down pirate sailing game Approach the player ship Bring player in line with port starboard guns Keep guns trained on player Be able to manoeuvre around obstacles Not cheat acceleration to achieve the above When I first started thinking about the idea it was quite simple, but the more I think about it, the more complex the requirements become with the major problem being the AI calculating perfectly the curve required to come up along side the player, or to better yet, make a pass along their bow stern before coming along side without needing to let them quickly speed up slow down to achieve this.


How much logic should be in an individual behaviour tree node? Let's say I have a condition node which has to spend a lot of time calculating something to finally return a bool to the behavior tree. But in the following action, we need this information again. I now have a few options I could just calculate the information again. That could unnecessarily take a lot of time and may result in redundant code. I could save the information into some kind of state data dictionary but now the action depends on calling the condition first. I could make it a single action that would just fail if the resulting calculation would end up being False. I would possibly end up with a bunch of very similar, very complex actions. Again possibly a lot of unnecessary redundancy. How do I tackle something like that? Is there a pattern that I could apply to the action condition design (or whatever) or inside the behavior tree implementation that solves this? Or am I using behavior trees wrong entirely?


Is chess like AI really inapplicable in turn based strategy games? Obviously, trying to apply the min max algorithm on the complete tree of moves works only for small games (I apologize to all chess enthusiasts, by "small" I do not mean "simplistic"). For typical turn based strategy games where the board is often wider than 100 tiles and all pieces in a side can move simultaneously, the min max algorithm is inapplicable. I was wondering if a partial min max algorithm which limits itself to N board configurations at each depth couldn't be good enough? Using a genetic algorithm, it might be possible to find a number of board configurations that are good wrt to the evaluation function. Hopefully, these configurations might also be good wrt to long term goals. I would be surprised if this hasn't been thought of before and tried. Has it? How does it work?


What should be created first in a video game? When starting developing a video game, should one focus on creating the environment (buildings, trees, mountains etc) first or the A.I. (Playable character, NPCs etc)?


How would intensive AI pathing be done server side in an MMORPG? Take WoW or Runescape for an example. You have an incredibly large map, filled with cities and forests, each filled with people and monsters. Monsters roam around an area at random that is 25x25 tiles big (ambiguous). This is done server side, so every player than comes across this area sees the same location of the same monster, and when a player attacks kills that monster other players see it too. How is this calculated without being a massively intensive task? If you have 500 different types of monsters, all of which have 5 maximum spawned, you'll be calculating 2500 different paths continuously.


Python java framework for developing artificial intelligence for board games like Diplomacy Risk I am trying to pick a python java framework for developing artificial intelligence for board games like Diplomacy Risk for research purpose. I am specifically looking for multiplayer, multiple round games without any dominant strategies that require players to cooperate as well as non cooperate at certain times. The idea of the research is to not build the game itself or the AI bot, but to discover novel methods for game theory, specifically to deceive other players bots or humans. This research is specifically based on Deceptive Artificial Intelligence. Please share any frameworks(game code with stubs for decision making) that you may know about. It would be a lot of help for my work. If you have any ideas about some other game that I can pick, please mention that as well. I have tried a few frameworks but the lack of documentation is extremely annoying and I haven't been able to move forward in the process. Thanks and Regards!


Doing a passable 4X game AI I am coding a rather "simple" 4X game (if a 4X game can be simple). It's indie in scope, and I am wondering if there's anyway to come up with a passable AI without having me spending months coding on it. The game has three major decision making portions spending of production points, spending of movement points and spending of tech points (basically there are 3 different 'currency', currency unspent at end of turn is not saved) Spend Production Points Upgrade a planet (increase its tech and production) Build ships (3 types) Move ships from planets to planets (costing Movement Points) Move to attack Move to fortify Research Tech (can partially research a tech i.e, as in Master of Orion) The plan for me right now is a brute force approach. There are basically 4 broad options for the player Upgrade planet(s) to its his production and tech output Conquer as many planets as possible Secure as many planets as possible Get to a certain tech as soon as possible For each decision, I will iterate through the possible options and come up with a score and then the AI will choose the decision with the highest score. Right now I have no idea how to 'mix decisions'. That is, for example, the AI wishes to upgrade and conquer planets at the same time. I suppose I can have another logic which do a brute force optimization on a combination of those 4 decisions.... At least, that's my plan if I can't think of anything better. Is there any faster way to make a passable AI? I don't need a very good one, to rival Deep Blue or such, just something that has the illusion of intelligence. This is my first time doing an AI on this scale, so I dare not try something too grand too. So far I have experiences with FSM, DFS, BFS and A


How AI is balanced across different type of races in RTS games? There are some real time strategy games (like StarCraft 1 or 2) where AI needs to be balanced across different type of races (in SC it's Protoss, Terran, Zerg), so despite they've different type of troops to play, no specific type of opponent have any advantage. Not to mention that they need to consider different type of maps, so in overall each AI playing different race have the same changes of win. How in general this balance can be achieved by gaming companies? Is it just by playing massive amount of games headlessly with different setups? This study and this one plus this dataset may help answering it, but it could be not related.


Can Neural Network play tic tac toe? Is this have any common sense? I'm thinking about theoretical possibility of playing tic tac toe by neural net. Is this have any common sense? Let's consider tic tac toe which contains 3 rows and 3 cols (it's 9 cells). Ok, then the input vector is contains of all our cells 0..8 , where 0 is "O", 1 is "X" and 2 is empty cell. But what we have for the target vector? On every NN's step we need to know some target and make our distance to target shorter. But the target of this game is only win (or maybe draw), I don't understand how we can make shorter our distance to win. Is any suggestions? My goal is to learn more about neural networks in games that's why I consider such easy game. Maybe it's not the best choice for the NN and I need to consider some other game? )


Single or Multiple Behavior Trees? I just finished coding a generic Behavior Tree structure for my games. My question is, when creating behaviors for enemy AI's, do I create one large behavior tree with every possible configuration as a node or do I create many multiple Behavior Trees and simply swap them in and out as I need them? To better understand my question here are some examples One large Behavior Tree might look something like this Multiple smaller Behavior Trees might look like this In the second tree I would simply swap out different trees depending on when I need them. This is more apparent for things like evading and backing away from obstacles, I feel like that would need to be done alongside many other behaviors like chasing and evading. I hope that made sense.


What are the most common AI systems implemented in Tower Defense Games I'm currently in the middle of researching on the various types of AI techniques used in tower defense type games. If someone could be help me in understanding the different types of techniques and their associated advantages. Using Google I already found several techniques. Random Map traversal Path finding e.g. Cost based Traversing Algorithms i.e. A I have already found a great answer to this type of question with the below link, but I feel that this answer is tailored to FPS. If anyone could add to this and make it specific to tower defense games then I would be truly great full. How is AI most commonly implemented in popular games? Example of such games would be Radiant Defense Plant Vs Zombies Not truly Intelligent, but there must be an AI system used right? Field Runners Edit After further research I found an interesting book that may be useful http www.amazon.com dp 0123747317 ?tag stackoverfl08 20


How do I make NPC pathfinding look believable? Is there an "academic" way to have NPC walking randomly on a map, but having a believable comportment ? The obvious scenario is a armed guard who is walking around a basement to secure it. It's quite easy to set up a "believable" path. What I'm looking for is a way to simulation a crowd in a small town, in fact. How can I make their move look like they aren't goalless robots.


One AI object for each npc Let's think for a moment a game where you'll have around 1k npcs, each one has to take its own decisions. Should each one has an object that decides what to do, or maybe exist one to process every unit? Also, let's think about a complex ai, not just check if npc can see the player nor decides if npc will attack or not. Something like Dwarf Fortress does.


In MMO game, how to handle user characters, who are offline? In my medieval MMO game, players have their own character, that represents themselves inside game. Like a King. Players could have cities and armies, but King acts as main driving force. Then it comes to player, going offline vacation disconnect. How to deal with "offline King", to keep some sort of reality in game, without ruining everything for player. I have never liked unrealistic stuff in games, like appearing dissapearing from thin air, like in WoW or other MMO RPG's, when it comes to connect disconnect, like in Matrix movie, when you are disconnected, your "avatar" inside the system just vaninshes. Ok, if player char stays where it was left, other players who are online could kick his ass like offline player char was frozen? I see only one solution give player char, while offline, some sort of AI, that controls char. Is there any other solutions? May be, some sort of legend story, could make users only as inner voice, leaving King just passively controlled by user, or other stuff... Please, help! I hope you understand my question.


Are square or hex grids better for pathfinding? Is there any significant difference between using a square or hexagonal grid for the area searched by a path finding algorithm. In other words, is square or hexagonal better, and if so why.


Player Ai for games involving scoring goals like soccer, hockey, basketball? I've been working on a soccer game, and was thinking of different ways to program player AI's and was wondering how they actually work. The concept is probably similar to all games where there are balls and goals like Soccer, Hockey, Basketball etc. Which algorithm do they use ? I imagine if you have the ball, you can use A , to figure out a path passed other "enemy" players and score. That seems simple to implement. But if you do not have the ball then then it becomes really complicated you could either play "zone" in which case, you stay within a particular region on of the playing area, and orient yourself towards the ball. Or switch to playing "man", in which case you stick to some player on the other team. Was wondering what other algorithms people use, as machine learning for a simple mobile game seems like over kill.


How to create a reasonable AI? I'm creating a logic game based on Fox and Hounds game. The player plays the fox and AI plays the hounds. (as far as I can see) I managed to make the AI perfect, so it never loses. Leaving it as such would not be much fun for human players. Now, I have to dumb down the AI so human can win, but I'm not sure how. The current AI logic is based on pattern matching if I introduce random moves which make the board go out of pattern space the AI would most probably play dumb until the end of the game. Any ideas how to dumb down the AI in such way that is does not go from "genius" to "completely dumb" in a single move?


Scripting a sophisticated RTS AI with Lua I'm planning to develop a somewhat sophisticated RTS AI (eg see BWAPI). have experience programming, but none in game development, so it seems easiest to start by scripting the AI of an existing game I've played, Warhammer 40k Dawn of War (2004). As far as I can tell, the game AI is scripted with some variant of Lua (by the file extension .ai or .scar). The online documentation is sparse and the community isn't active anymore. I'd like to get some idea of the difficulty of this undertaking. Is it practical with a scripting language like Lua to develop a RTS AI that includes FSMs, decision trees, case based reasoning, and transposition tables? If someone has any experience scripting Dawn of War, that would also help.


Prevent instances from overlapping gamemaker studio I have a game where multiple instances of an enemy move towards a player in their step process. There can be as many as 50 instances on screen. The issue is that the instances all end up in 1 big group as they follow the player. I would like to prevent them from getting more than 2 pixels of each other. the code is as follows if distance to object(player) lt 160 direction ppoint direction(x,y, player.x, player.x, player.y) p potential step(x,y, player.x, true) If I put a distance check of 2px in this code, the instance starts making jerky movements and spins. I would like the instance to continue following the player, but just not allow themselves to overlap.


Approaches to partner trick taking card game AI I am creating an android game out of a partner based trick taking card game. What are some generic approaches to AI players for these types of games and what are the advantages disadvantages of each?


Chess Artificial intelligence with python and pygame I created chess game with python and pygame. Now I'm trying to make Artificial intelligence, but what is actually best way to do it? Some tips, tricks, links? Thanks


Positive Evaluation Function Territory AI Help I am trying to implement some positive evaluation into my game. Let me explain. I have a series (anywhere from 5 to 25 (might vary)) of circles (three sizes, big medium small). And each player starts with a main circle which gains 1 every turn (like risk the circles gain at different speeds, the big one gains the fastest and the small one gains the slowest). You can use these numbers to take over other circles, if the "enemy" is on this circle it does a risk thing (you fight to see who takes it over, who ever has more wins most of the time, I'm not getting into this logic as it is rather irreverent). So this is a very basic overview of what occurs, now what I need some help with is how I can create an AI which will look at all available (and taken) circles and determine where it wants to move to. There would be circles closes to it, and circles in the enemies area and circles available and circles taken over. And it would need to determine where to move it's forces too next, and so on and so forth. So after some research I read a lot about Positive Evaluation, which it takes all possible moves and determines the best one. So I am wondering if anyone could help me out or give me some direction as to where to go from here. I think what I need to do is take all the circles with any forces on them, throw them into a table array with the cords of each circle and determine which would be best, then I would need to determine how many forces I want to send and where from. Help! ADDITION Allow me to explain a bit, http imm.io 4Xwy see that diagram lets assume the circles are sections of forces, and you gain a new force each "time interval" and lets say I want to take all my forces (I'm pink) the circle directly below me and capture it, well the AI would need look at all available circles and pick for example the big green on in the top right (since big would make more troops and its close to the "main"). I'm assuming what you said would still work? Weighted options?


Simultaneous AI in turn based games I want to hack together a roguelike. Now I thought about entity and world representation and got to a quite big problem. If you want all the AI to act simultaneously you would normally(in cellular automa for examble) just copy the cell buffer and let all action of indiviual cells depend on the copy. Actions which are not valid anymore after some cell before the cell you are currently operating on changed the original enviourment(blocking the path) are just ignored or reapplied with the "current"(between turns) environment. After all cells have acted you copy the current map to the buffer again. Now for an environment with complex AI and big(datawise) entities the copying would take too long. So I thought you could put every action and entity makes into a que(make no changes to the environment) and execute the whole que after everyone took their move. Every interaction on this que are realy interacting entities, so if a entity tries to attack another entity it sends a message to it, the consequences of the attack would be visible next turn, either by just examining the entity or asking the entity for data. This would remove problems like what happens if an entity dies middle in the cue but got actions or is messaged later on(all messages would go to null, and the messages from the entity would either just be sent or deleted(haven't decided yet) But what would happen if a monster spawns a fireball which by itself tracks the player(in the same turn). Should I add the fireball to the enviourment beforehand, so make a change to the environment before executing the action list or just add the ball to the "need updated" list as a special case so it doesn't exist in the environment and still operates on it, spawing after evaluating the action list? Are there any solutions or papers on this subject which I can take a look at? EDIT I don't need information on writing a roguelike I need information on turn based ai in respective to a complex enviourment.


Entity's FSM and exposing internals of the entity I'm trying to implement FSM according to Programming Game AI by Example, it is a pretty standard and straightforward FSM that goes like similarly to this (some stuff omitted and translated from C to C , hope it's fine) class StateMachine lt Entity gt Entity owner State lt Entity gt state void StateMachine lt Entity gt (Entity entity) owner entity void Update() state.Execute(owner) class State lt Entity gt Entity owner void Execute(Entity owner) if (owner.Foo) owner.Bar() class Entity() public type Foo private StateMachine lt Entity gt stateMachine public void OnStart() stateMachine new StateMachine lt Entity gt (this) public void Bar() My problem with this state machine is that the because the state machine is not part of the class anymore (as opposed to, let's say, the naive "switch" "if else" implementation), it is necessary to expose internal logic of the Entity (e.g. variable Foo, method Boo()). Is this the right way to do it? What if the the Entity class grows, how does it scale. Is it really necessary to keep exposing more and more variables creating getters setters? How are these FSMs implemented in larger projects?


AI Agent realistic leap to a player in a MMO In the last month I have been struggling with an issue, movement synchronization of a leap of an AI agent in a MMO. I know some theory and basic movement was not a problem with interpolation and stuff, the difficult part is implementing a leap move. My current setup has a server and multiple clients connecting to it. The movement of the AI agent and its behaviour is computed on the server, the AI client receives position updates and interpolates between the current position and the position received from the server. When the server decides that an AI has to attack, it sends an attack command to clients and, to make the thing more realistic, the clients stops their agents as soon as they receive the message and start an attack animation. The important part now during this attack animation, the agent quickly (0.6 s approx) translates (the translation is not in the animation) toward the targeted player. The client of that player then sends the landing position to the server which does some validation and hit checks and then resumes its behaviour computation sending new attack commands or position updates to clients. This creates a very pleasing effect on the client of the player being attacked but may cause weird translations (due to the error in the position of the agents and the players) on other clients. I tried predicting the "landing position" on the server but it's always somehow too wrong as it depends a lot on the target direction from the agent, and small changes in both the agent position and target position often lead to big errors. Having a good look and feel of the leap on the client is imperative. My questions are is there a better way to handle this in my case? is there a good practice to follow in this that I am completely disregarding?


How to ensure a condition in a behaviour tree when processing following nodes? Example tree (Source) As far as I understood, a sequencer iterates over the children until one failed or all are successful. If one children returns "running", the sequencer will start to process from that child on the next tick. Let's say "Do I have food?" takes longer than one tick because the AI has to walk to the fridge. When "Am I Hungry" was successful, it won't be processed anymore. Now while walking to the fridge, the hunger magically disappears. How do I prevent the tree from processing the other nodes even though I am not hungry anymore? Should every following node check the condition again? That doesn't seem to fit the idea of a behaviour tree. How do I implement a condition that has to stay true while following nodes are processed?


Unit turning in navmesh based pathfinding I'm working on an RTS game, and I'm using navmeshes for unit pathfinding. I do know how to find a general path within a navmesh, but how do you determine if the unit have enough space to turn? I have units of different shapes (mostly rectangles with different dimensions), and with different turn radii. Additionally some of units can turn in place, and some can move in reverse. So, how to find a path which unit can follow, considering that it can not rotate easily?


Game Maker Studio Make objects avoid other instances of same object with A pathfinding I have a game where there are multiple enemies who must chase a single player. I have pathfinding set up using the GML A pathfinding with mp grid and a path. However, these enemies can walk on top of each other when seeking the player. To fix this, I also told the path to ignore enemies as well with mp grid add instances, but then they stop moving altogether because they see themselves as obstacles, thus trapping themselves within a bounding box. Is there a way I can add "all other enemies BUT self" with mp grid add instances? Here's my grid creation code (in a CONTROLS class for initializing variables) global.zombie ai grid mp grid create(0, 0, room width 50, (room height sp dashboard.sprite height) 50, 50, 50) mp grid add instances(global.zombie ai grid, obj obstacle, false) This is my path initialization code (in Zombie class) path path add() alarm 0 5 This is my path creation code in Alarm 0 (path updates every 2 seconds) mp grid path(global.zombie ai grid, path, x, y, nearest.x, nearest.y, true) path set kind(path, 1) path set precision(path, 8) path end() path start(path, MAX SPEED, 0, true) alarm 0 room speed 2


To what extent are video game bots NPCs artificial intelligence ? Wikipedia says In video games, this usually means a character controlled by the computer through artificial intelligence. https en.wikipedia.org wiki Non player character In video games, a bot is a type of weak AI expert system software which for each instance of the program controls a player ... https en.wikipedia.org wiki Video game bot However as far as I know such bots amp NPCs are way too hard coded or explicitly coded to be accurately called "artificial intelligence". Mainly most often they lack the ability to learn dynamically from the player. Arthur Samuel calls "artificial intelligence" The "field of study that gives computers the ability to learn without being explicitly programmed" (1959). So to what extend can bots and or NPCs be called "artificial intelligence" if they (or a subset of them) can be designated as such?


Path tables or real time searching for AI? What is the more common practice in commercial games path lookup tables or real time searches? I've read that in many games path lookup tables are pre calculated and baked into each map, so to speak, then steering behaviour is used to handle dynamic obstacles. or is it better practice to use optimised hierarchical A searches? I understand the pro's and cons of each, I'm just curious as to what is most often used in the industry.


What should be created first in a video game? When starting developing a video game, should one focus on creating the environment (buildings, trees, mountains etc) first or the A.I. (Playable character, NPCs etc)?


Problems with Obstacle Avoidance steering behavior I learned how to implement the Obstacle Avoidance steering behavior from this tutorial. The approach depicted in this tutorial (simplified) is this (note that I'm using rectangular OBBs for obstacles, not circles) The entity that avoids obstacles will have a 'ahead' vector, representing the entity's 'sight'. It will be equal to the velocity vector, but scaled to some length (the "sight distance"). For each entity in the "sight distance" radius from the entity, we check if it contains the the 'edge' of the ahead vector, marked with a red dot (actually the vector itself treated as a point) For an entity that contains the red dot, we calculate the vector from the center of the entity to the red dot This vector (scaled by a scalar MAX AVOIDANCE FORCE) is the avoidance force. We apply it on our entity, and it should avoid the obstacle. However, what happens in practice after applying the force is this As you can see, the entity is about to get stuck on the obstacle. That's because it doesn't sense it's about to collide, because the obstacle doesn't contain the edge of the 'ahead' vector. So what would be a good solution to this problem? How should I implement the algorithm?


Best next step for game AI implementation I have recently finished a small framework that employs agents governed by a small hierarchical finite state machine, however I have quickly discovered the drawbacks of this approach. Namely the fact that increasing numbers of behaviours call for an exponentially complicated rule base to govern the switches. It occurs to me that there is probably a much better way of coding AI, where they have overall goals and can assess new information with regards to this. I did some research but was a little overwhelmed by the amount of methodologies, and for that matter the lack of information about which techniques are more commonly used and which are best for certain situations. what would be a good next implementation methodology for a 3rd 1st person shooter? such as a neural network or GOAP.


Pokemon Artificial Intelligence I'm working on a thesis about programming an AI combat system for Pokemon (To be implemented in Showdown!). However, I would like to include historical information about the existing implementations of Pokemon AI. This information would offer valuable context to my thesis. I have been scouring the internet for some sort of algorithm that explains how the AI Trainers make their choices, but have found nothing promising. I realize the fan games have implemented some more interesting AI systems for their trainers, these would be interesting to see as well. What I am looking for is examples of the methods used for Pokemon Battle AI decision making used in Pokemon videogames, whether from main series by Nintendo or the many fan games out there. I realize most of these pose no challenge to an experienced player, but I don't mind, I only wish to compile historical information on previous Pokemon AI attempts.


Good way to handle offscreen AI? For example sake Let's say there are 10 rooms in the world. And let's say the world is inhabited by 10 entities. And each entity has it's own "daily routine" where it performs certain actions in the room and also might navigate between the rooms as well. Given that the player can only be in one room at a time, what is a good way to keep track of the actions the other entities are performing in other rooms offscreen? The most straightforward option is to check on each of the 10 entities on every frame, check their position state and determine whether or not the entity should be in the room where player is located in at any given time. ( This however feels really resource heavy especially as the room entity amount is increased. ) Another option is to keep track of the time that has passed since the start of the game, then each of the entities checks whether its pattern intersects with the room the player is on, and if it does it checks against the time whether or not the entity is supposed to be in the same room at this particular time, entities whose patterns do not intersect with the current room the player is located in do nothing until the player enters a room which their pattern intersects and only at that point calculate whether or not they should render. ( But if they interact with the room, then they will have to always check the state of the rooms which intersect their route in order to determine their location at that point in time, which is not that great. ) The third option I came to would be to first of all only look at the routes which intersect the player location (as described previously), secondly upon entering a room, check if the player is in that room, if not then to only check the state of the room and how long will it take to proceed to the next room. For example a janitor NPC enters the room, checks the state of the room, sees that there is a spillage made by player, calculates how much time it will take to clean that up and how long the pathing will take etc. And until the mentioned time is due to enter the next room we only check if the player is in the room. The exact location of the NPC for rendering purposes would only be calculated when the player enters the room. After brainstorming a while I came to the third option, but I was wondering if perhaps there is a known or better way to handle things like these?


Interrupt on behaviour tree I'm using a custom Behaviour Tree library (not UDK or any other engine) so I'm wondering on the best way to cause an interrupt to a currently running node. I don't have decorators or parallel nodes in this library so looking for a different way to do it. I don't care about the specific reasons as to why the interrupt is needed. In general it just needs to tell the currently running node to stop running so the tree can be transversed again and that would find out the reason as the main "threats" would be checked. I'm trying to think of a clean way to cause such interrupts in the tree. Generally the conditions that are already in the tree would be the reason for the interrupt (IsEnemyInRange, IsThirsty, IsHungry, etc) but if a node is running over multiple frames these don't get checked. Any ideas given the above limitations I listed?


Dealing with multiple prerequisites in goal orientated action planning using A I'm currently having difficulty reasoning about how multiple prerequisites are satisfied using the A algorithm during planning. Assuming the following actions (with prerequisites in brackets) Get Material Make Gloves (need material) Get Iron Make Axe (needs iron) And the following goal (prerequisites in brackets) Chop Tree (needs gloves, needs axe) Now, assuming I am doing a backward search from the goal, as I understand it, I would start considering actions that have effects that directly correspond to the prerequisites of the node (this is where I think I'm going wrong). The problem with that is, the first 2 actions to consider are Make Gloves and Make Axe. However, for this goal to be satisfied they both need to be done. If I only build my graph by linking effects to prerequisites, I only consider each of those actions once, and only choose one. I.e. if I arbitrarily choose Make Axe that leads me to Get Iron, I don't have anything making me reconsider Make Gloves as Get Iron has no prerequisites. For the actions and goal I had above there are many routes to solving it, below I have highlighted one to illustrate my point. As you can see, in this case I would need Get Iron to be done after Make Gloves even though their effects prerequisites don't match in any way. Can someone tell me where I'm going wrong in my thinking?


Conditional priority in behavior trees I want to trigger behavior based on certain conditions. I currently just have a sequence that runs different behavior, it triggers on condition but always in sequence. When the first condition is met it runs that. Let's say I have 2 behaviors. Flee from threat and find food if hungry. Usually the flee from stronger threat prevails and thus is placed early in the sequence. But what if the entity running the behavior is starving, it can take more risk. Since the flee from threat comes first in sequence and triggers on a threat it will never pick to gather food if there is a threat present. I guess I need something like a scoring system and let the tree pick the best option. Is this common in behavior trees? How is it called or best implemented? I'm using gdx.ai in particular and perhaps there is something out of the box I can use. I can make a task in the behavior tree that weighs all the possible actions but this ties everything together and bt's are widely used for the opposite.


Snake AI Is a Hamiltonian approach valid for all grid sizes? So, as has been done many times before, I am designing an AI that can play Snake as effectively as possible. It didn't take me long to find this extremely useful thread here How to find a safe path for an AI snake? where the top answer first and foremost recommends forming a Hamiltonian circuit for the grid and begin by just having the Snake follow this route. However, after attempting this, I realised it didn't work with my initial grid size (23x23), at least I don't think it does. My understanding may be incorrect, but from what I gather, with m rows and n columns, if mn is odd, then there is no Hamiltonian circuit possible. If this is the case, then should I abandon this method? Or is there any way of implementing it in some case?


Understanding the Seek steering behavior I'm currently studying steering behaviors. Have recently learned about Seek. I have a question about this. Seek is supposed to turn the agent slowly in the direction of it's target, and then move in that direction. However, I don't understand how Seek turns the agent around slowly. It seems to me like it should make the agent change direction immediately. This is the code for a Seek function Vector Seek(Point target) Vector toTarget new Vector(target agent.getPosition()) Vector desiredVelocity toTarget.normalize() agent.getMaxVelocity() return desiredVelocity.subtract(agent.getVelocity()) And then here is the update() function of the agent. void update() Vector force seek(target) Vector acceleration force.divideBy(mass) mass 1. velocity velocity.add(acceleration) position position.add(velocity) Anybody mind explaining to me where the gradual change of velocity takes place? Thanks


Designing client server to mitigate hosting advantage? My game will be client server, and I'd like to prevent the hosting player from enjoying the usual benefits you'd associate with playing on a server. For example, the advantage of the server running ahead of time compared to clients. Are there simple ways of mitigating host advantage? Or do I have to make something complicated? My naive solution would be having the host run a "ghost" state, and a client state, on the same map. The ghost state is an authoritative server simulation, it doesn't render the simulation which remains invisible, but does run ahead of time making calculations and decisions as usual. The host also plays a client on the same map, in which their input is regarded as any other client across the network, and like any other client is required to wait for the server simulation to make and transmit outputs. And so the host doesn't enjoy an advantage because they aren't playing the simulation which is making executive decisions on the game state ahead of client time. Has this solution been done by any other games, or is there a better way of handling the problem?


udp over cellular networks? I'm starting to build a multiplayer iOS game using UDP. I want the game to be playable over cellular networks, but I can't really find that much information on it. Many people say that it's dependent on your carrier whether or not it will work. I tried searching but I can't really find much info on this topic. I know carriers must allow UDP because of things like video streaming, but what about custom game protocols? Will UDP work over a cellular network? If anyone has a definitive answer or can point me to some resources that'd be great


When to stop taking items from ever growing queue and start processing them? I am developing a fast paced multiplayer shooting game and following instructions from this source http www.gabrielgambetta.com entity interpolation.html. In the article it says that several clients may be sending inputs simultaneously, and at a fast pace (as fast as the player can issue commands, be it pressing arrow keys, moving the mouse or clicking the screen). Updating the game world every time inputs are received from each client and then broadcasting the game state would consume too much CPU and bandwidth. A better approach is to queue the client inputs as they are received, without any processing. Instead, the game world is updated periodically at low frequency, for example 10 times per second. The delay between every update, 100ms in this case, is called thetime step. In every update loop iteration, all the unprocessed client input is applied (possibly in smaller time increments than the time step, to make physics more predictable), and the new game state is broadcast to the clients. now I am wondering how to implement such a queue system? I can have an in memory queue where each input is added. and after say 100ms how many number of inputs do I process? i.e when should I stop popping events from queue and apply simulation? from my point of view clients are sending inputs constantly which are being added to the input queue. below is the psuedocode. queue inputQueue gameloop() while (inputQueue not empty) lt obviously i cannot use this condition, what should i use then? inputEvent inputQueue.front() updateState(inputEvent)


P2P synchronization can a player update fields of other players? I know that synchronization is a huge topic, so I have minimized the problem to this example case. Let's say, Alice and Bob are playing a P2P game, fighting against each other. If Alice hits Bob, how should I do the network component to make Bob's HP decrease? I can think of two approaches Alice perform a Bob.HP , then send Bob's reduced HP to Bob. Alice send a "I just hit Bob" signal to Bob. Bob checks it, and reduce its own HP, then send his new HP to everyone including Alice. I think the second approach is better because I don't think a player in a P2P game should be able to modify other players' private fields. Otherwise cheating would be too easy, right? My philosophy is that in a P2P game especially, a player's attributes and all attributes of its belonging objects should only be updated by the player himself. However, I can't prove that this is right. Could someone give me some evidence? Thanks )


Which toolkit to use for 3D MMO game development? Lately i've been thinking about which path to follow for developing an 3D Online game. I have googled a lot but i couldnt find a good article that covers both game development and online server amp client development in same context. This question has been in mind for about 2 weeks now. So.. yesterday i started developing a game from scratch by using Irrlicht.Net Wrapper to use Socket library of .NET which im already familiar. But i found out .Net wrapper of Irrlicht is not totally finished yet and still have lacks from the original. So i lost all my motives . So i thought why not to ask the experts before i run into another dead end... What Game Engine and Networking Library is best way to go for 3D MMO Development? Here is some of my early conclusions Please let me know the ones im wrong. C Best Performance for 3D Graphics. Most Game Engines has native C Libraries. Lacks a Solid Socket Library .NETC Lacks Intellisense Support. C Intellisense Support NET Socket Library Lacks 3D Graphics Performance Lacks a native solid 3D Game Engine


Components in a client server network game? Behavior and logic are executed on the server. The clients are mostly for rendering, audio, and gathering input. It looks as though most of the a components architecture benefits are only realized on the server. Is it still beneficial to design the client with an component based architecture? Or is there a different approach that better fits a client.


How do I prevent identity spoofing in a multiplayer game? I'm thinking about clients spoofing IP addresses, tricking other clients that they are the server that sort of stuff. (I don't know much about this, so if this is completely wrong, please correct me.) What should I do to prevent this? Because it is a real time game, if I were to use encryption, I would use something fast and secure like RC4. Should I encrypt packet data with a key, that the server gives to the client? If it makes any difference, I'm using UDP.


How to make a multiplayer game work reliably behind NAT? Even games that are 100 client server sometimes have issues when the client is behind NAT. Peee peer games are even a bigger issues. Some games need to use multiple transports (such as UDP and TCP) or multiple connections (such as a different UDP port for voice). What are some ways to make sure a game works reliably when running behind a NAT router? Peer Peer No centralized server exists. Player A starts a game and Player B wants to join Client Server A centralized server on a well known address (hostname) accepts all incoming connections. Each client only communicates with that server. Combo Where the server is just matchmaking, but game updates are peer peer. Different peers may see each player with a different IP port potentially (e.g. some clients are behind the same NAT and some are on a different router)


How can I handle sharing storage units in multiplayer? I have recently come across a certain problem in programming my MMORPG the synchronization of shared storage units. With shared storage unit I intend something like a "chest" that can be accessed by multiple users. Any user can take items from it or put items in it or even move items around and merge items stacks in the chest. To get the idea, think about the guild chest in WoW. At the moment my approach with non shared storage is to apply any transaction on the client (move split merge they take place instantly on the client) and then communicate to the server the change which also does validation and stuff. This works just fine it's rather impossible that one client issues a transaction that would conflict with another of its transactions as he always sees an updated state of the storage (because he she is the only one issuing transactions on that storage). How do you keep a storage synchronized among its co owners when they share a storage unit and therefore can issue conflicting transactions? For example two players issue at the same time a move transaction of the same item. An approach I was thinking about is scratching client side prediction for shared storage but that adds some overhead to my work as clients at the moment are not aware (code wise) that a storage unit is shared. Is there a smarter way to do it?


Do UDP game clients servers block for receive calls? One way to implement a client server relationship is to have the server simulate the whole game based on the clients input and send updates back to each client, while the client is is simulating the game for the player and sending back input and game state messages that the server can use to process the whole state of the game. My question is, since a ReceiveFrom() call blocks till it receives data and a Select() call blocks for a set period of time, does that mean all clients and servers block for a certain amount of time each frame? I am aware that a call to Select() can be set to zero which would be an effective poll to the read write states of the current sockets, but wouldn't you miss out on new data if it comes in just microseconds later? How is this problem solved now a days? Pro select() method handling? Asynchronously? Separate thread completely? Other? I may be over thinking this, but I would like to know more information so I can write an effective client sever relationship. Haywire


RTS game How to handle disconnects in a fully connected peer to peer architecture? I'm currently working on a game in which I am considering implementing a networking architecture as described in this article http www.gamasutra.com view feature 131503 1500 archers on a 288 network .php In order for the implementation as described in the article to work, all peers need to be interconnected without any exceptions. Like so This works fine when everything is well. But I am wondering how to agree on disconnects in such a network. (Sadly something the article does not go into). It is relatively easy if one client goes down. Just give every client a timeout, and if a client does not respond for a certain time, it is removed from that client. However, how should the system solve a case in which one client does not respond to another, but still responds to all others. In such a system the following could happen, resulting in a invalid state Of course this can be solved by giving one of the clients some kind of "master" role. It being the only one that can decide whether or not to disconnect other clients. But I'm wondering if it can be achieved in a pure p2p network. Note I realize this case is not one that can likely occur "naturally". But I want to prevent players from being able to ruin a networking game for others by playing a trick like this by using the firewall for example.


Authenticate player on backend server with google login I would like to create a mobile game which communicates with my own backend server. For authentication I want to use google Sign in(https developers.google.com identity sign in android backend auth), so users don't need to create an account. My backendserver uses a TCP connection to communicate with the client and I don't want to send the google login auth code unencrypted over the network. I read alot about SSL encryption, but I'm not sure if it is the thing I need and if this is sufficient. Another question I would like to ask is do I need to encrypt all packets my client is sending to the server. Because when I just do authentication over an encrypted connection, potential hackers could simply perform a man in the middle attack to access the account of a player after they logged in. So what would be the best way to send this token to the server, is SSL sufficient for this and do I need to encrypt the whole traffic my game creates?


Networking in a strategy, city management game I'm developing a city management mobile game with its' share of multiplayer elements (leaderboards, achievements, social interactions). It's built using Unity and GameSparks as a backend. I'm a little bit confused on how I should be implementing the networking. At the end of every in game month, the game should go through every business building, calculate the revenue (each building generates different amounts of money depending on the number of workers), then add this value to the player's funds. These funds can then be used to continue building more businesses and houses, which increase the population. I have to save the states for the city (buildings, population, etc) and player (funds, premium currency, etc) in the cloud. I'm afraid people will exploit the game (due to the leaderboards) if I entrust data with the client, and I feel it would be best to keep the system deterministic, but I'm not completely sure I'm doing the right thing. How would you solve the problem?


How to prevent game client version spoofing Basically I have a c server that will use a binary protocol to talk to my client (unity game). As part of the login process I want to send the client version to the server. The server then responds saying (assuming login credentials are correct) they are okay to connect, or if the client version is outdated it returns a client version outdated. My question is, how can I prevent people using old client versions and spoofing as the latest version. As this could potentially lead to server bugs as it is handling an outdated client thinking it is up to date... Thank you )


Network game like MMO TPC or UDP I saw this subject several times, however I will wish better understand. I am working on the development of a 2d game like a little MMO. (Currently I only do research). I see people who says it's easier to use TCP for all the game. But is it really viable ? In my mind, what I would have made is to use UDP in multicast. What about this solution ? Thank you !


How do I create game rooms using Kryonet? I'm currently about to create my first networking game, and it's supposed to be two player and turn based. I wrote the client using the LibGDX library, and the server with Kryonet. It should be possible for multiple users to play the games, at once, I feel the need to create something like a "game room". I thought about creating a class with two connections (the two players), adding a listener to each, and to handle the messages within the game room. However, I am not sure how to permanently update the game rooms. At the moment, my server only listens for new connections, and registers them in a list of connected clients. Maybe, I should create a new thread for each match? How do I create such game rooms within the game server, itself? Edit So after doing some more research, this is how I currently do it I store the players, that are currently searching for a game in a LinkedList (more precise, their Connections) and once there are more than two, I do this in my Server class if (connectedPlayers.size() gt 2) GameRoom newGame new GameRoom(connectedPlayers.removeFirst(), connectedPlayers.removeFirst()) gameRooms.add(newGame) some list, storing all the current games newGame.start() and my GameRoom looks like this public class GameRoom implements Runnable Thread t Connection playerOne Connection playerTwo more variables your GameRoom might need public GameRoom(Connection playerOne, Connection playerTwo) this.playerOne playerOne this.playerTwo playerTwo whatever more variables you need to use can be declared here, e.g. Override public void run() while (true) Game logic goes here public void start() t new Thread(this) t.start() I am not really into threading and this is what I set up after a little more reading into that topic, but I assume this is not really scaleable because 1000 games would mean 1000 more threads, which I think is not so good. Please let me know, whether this is the correct approach and if not, just stick to my question and help me with it, if you can and feel like it.


How to prevent a hacked server from spoofing a master server? I wish to setup a room based multilayer game model where players may host matches and serve as host (IE the server with authoritative power). I wish to host a master server which tracks player's items, rank, cash, exp, etc. In such a model, how can I prevent someone that is hosting a game (with a modified server) from spoofing the master server with invalid match results, thus gaining exp, money or rankings. Thanks. Cody


Using Unity's uNet to create a turn based RPG I've been checking some tutorials about uNet and it seems pretty powerful. The NetworkManager is a great tool when you want to make generic games, but what is troubling me about it is the need of spawning a "Player". I intend to create a turn based RPG, and for that, during the battle there's not a "physical player entity", there's two players which have a set of monsters and the players can select a monster to attack the opponents', but the player itself doesn't exist, in the end it sums up to a trade of commands between the clients. How can I achieve such an architecture with uNet? Should I discard the use of the default NetworkManager? Should I simply create a bodyless Player and go along with it?


How do MMO servers handle a large concentrated number of players? I have a pretty good understanding of how to scale servers but there's one thing I can't quite be sure about is how to manage a lot of players in a concentrated area. If I have a server which is using multiple threads and processes as long as you limit the amount of players that can join a single game instance then this can scale indefinitely by adding more servers and placing it behind a load balancer. But MMO games don't work that way because it's broken down into zones that anyone can connect to. So if a massive amount of players all decided to connect to the same zone it would put all of the stress on 1 server. If you tried to spread the load across multiple servers then you'd run into problems of having to share information between the servers (Such as if player X was connected to sever 1 then all of his movements would also have to be passed on to the players connected to server 2 since server 1 and 2 are managing the load for the same zone). So I was wondering how do you go about solving this problem? Do you just keep on ramping up the specs for the server on heavily populated zones? Or is there a fast and efficient way for multiple servers to manage the load for the same zone and efficiently share data between the two servers?


I'm making a networked game for mobile. Should I worry about cheating? I'm in the process of making a racing game for Android iOS. I'm thinking of implementing a server client model, should I worry about cheating and make all players communicate with a server of mine, or will I be good by letting one of the players host the game? I'm not sure how much memory editing or packet editing is possible in Android iOS, and that's the main reason why I'm asking this.


Client Server RTS networking with lockstep and lag The peer to peer lockstep networking model would seem to indicate that everyone's input is delayed the same amount. And so this would indicate that everyone would feel the same lag in response to their input. But in Warcraft 3 from playing many custom games it is clear that the creator of a custom game has much faster response time to their input. How can this be given the lockstep model?


Sending changes to a terrain heightmap over UDP This is a more conceptual, thinking out loud question than a technical one. I have a 3D heightmapped terrain as part of a multiplayer RTS that I would like to terraform over a network. The terraforming will be done by units within the gameworld the player will paint a "target heightmap" that they'd like the current terrain to resemble and units will deform towards that on their own (a la Perimeter). Given my terrain is 257x257 vertices, the naive approach of sending heights when they change will flood the bandwidth very quickly updating a quarter of the terrain every second will hit 66kB s. This is clearly way too much. My next thought was to move to a brush based system, where you send e.g. the centre of a circle, its radius, and some function defining the influence of the brush from the centre going outwards. But even with reliable UDP the "start" and "stop" messages could still be delayed. I guess I could compare timestamps and compensate for this, although it'd likely mean that clients would deform verts too much on their local simulations and then have to smooth them back to the correct heights. I could also send absolute vert heights in the "start" and "stop" messages to guarantee correct data on the clients. Alternatively I could treat brushes in a similar way to units, and do the standard position velocity client side prediction jazz on them, with the added stipulation that they deform terrain within a certain radius around them. The server could then intermittently do a pass and send (a subset of) recently updated verts to clients as and when there's bandwidth to spare. Any other suggestions, or indications that I'm on the right (or wrong!) track with any of these ideas would be greatly appreciated.


How to properly handle sending arrow key movement data to a authoritative server? I've made a little C server which receives UDP packets and shows me the incoming information. I want to make an authoritative server in C which simulates character movement and interaction in a 2D real time world and sends information back to a Unity game client where the information is then represented. My question is How does my server know how long a button is pressed in real time (example right arrow key to move character right)? My guess is that the client would send a UDP packet to the server on key press saying move this direction. The server would then simulate the character moving and new positional information is constantly sent back. When the Client releases the key a new UDP packet is sent to the server saying the movement key has been released thus stop moving this direction. BUT the problem is UDP unreliability and the lag between letting the key press up, and the server knowing that the key press is up which would make the character keep moving for a period of time after letting go of the key is this solved with proper movement interpolation?. Any ideas or information sources how to properly handle sending arrow key movement data to a authoratative server?


Game clock Synchronization in python I am working on a network game project in python which we want to keep synchronized. I would assume we should use Network Time Protocol to cater for different levels of lag. That being the case, is there an implementation for Network Time Protocol in python?


How to measure packet latency? In the context of lag compensation, one needs to know when the command is instantiated on the client (this can be named as "command execution time" as well). AFAIK, there can be 2 methods for this Client sends a timestamp with the command. Client doesn't send any timestamps, but server does a smart thing to calculate the command's instantiation time. About 1 Is this safe in terms of cheating? About 2 According to Valve's paper, command execution time is as following Command Execution Time Current Server Time Packet Latency Client View Interpolation This means, server must know the packet latency. Another paper from Valve confirms this and says Before executing a player's current user command, the server Computes a fairly accurate latency for the player ... How can the server compute "fairly accurate latency for the player"? Most naive and easiest approach would be sending pings regularly (less frequent than game commands and updates though) to find out an average of the latency and use it. Busy network traffic, latency fluctuation and naiveness of this method makes me feel there must be a more elegant way. EDIT Would UDP vs TCP change anything in this context?


Lightwight cross browser library for server side push? I am looking for a lightweight javascript library that allows the server to push update information to the client reliably and regularly. We use a fixed turn time of 300ms and often there are only about 20 bytes of changes. So doing polling using XMLHttpRequest would imply a huge overhead (3 way tcp handshake, http request headers, http response header). There area number of alternatives, but they have limited browser support streaming lt script gt tags in another frame (does this work on IE?) MIME multipart x mixed replace responses (Firefox, Safari, Opera only?) WebSockets (removed from recent beta version of Firefox and announced to be removed from Opera 11 because of security issues) Server sent events (only Opera?) Java Flash relays (requires the users to have those plugins installed) Polling using XMLHttpRequest (huge overhead) Is there a website which has recent information on which technology works in which browser? Are there javascript libraries which provide a common cross browser interface that hides the messy details? (Yes, i know that it still requires me to write multiple server sides, but that is rather easy. And more important it is easy to write automatic tests for the server sides).


How do we make online games deterministic? I am trying to understand how networking in games work as I am trying to make an online game myself. I can't grasp how it is possible to synchronize the players, in order to make the game deterministic. I found an article saying this in order to ensure that the game plays out identically on all machines it is necessary to wait until all player s commands for that turn are received before simulating that turn. This means that each player in the game has latency equal to the most lagged player. This makes sense and I also came to the same conclusion after hours of drawing graphs with various scenarios. However, there are some games where one player can have 500ms delay, and another player could have 40ms delay. In this case, how is the game deterministic ? Lets name players with 40ms, 500ms delay Player40, Player500 Lets say that Player40, shoots Player500 with an instant laser shot at T1 0ms. Exactly 40ms after the Player40 actually clicked with his mouse to shoot (so T2 40ms), The "laser shooting event" registered on the server and returned "ok, you can execute laser shoot" to Player40. So, the shot is being applied on Player40's machine and on his screen he sees that he killed Player500, and the corpse is lying on (x1,y1,z1). Meanwhile, what happened on Player500's machine, was that Player500 was running straight. A few moments later he sees a laser a few feet behind him, he dies even though the laser didn't hit him, and his corpse is lying on (x2,y2,z2). Since this scenario never happens in some games, does this mean that those games are deterministic ? How is something like this possible, without forcing all players to get a delay equal to the delay of the most lagging player ?


Need help choosing the right networking approach platform for an RTS I have been thinking for a while about making an online 2D RTS like game. (2 6 players in a match, up to 50 60 units, no AI). The key thing here is that I want the game to be playable in a browser, so it'll have to be either flash or java applet, both using TCP sockets. At first I was entirely focused on flash because of a higher market penetration and accessibility. However, after reviewing different networking approaches I am unable to make a choice. I really liked lock step simulation approach where server and every client are running the exact same simulation, until I realized that it's going to be tough as hell (if not impossible) to implement exactly the same logic in two different languages, one of them being actionscript. This is where java comes in. With java client and server can share simulation related code that may as well cut the development time in half. But then there is another approach, where clients try to simulate (or rather extrapolate) the game state correctly as long as possible, but they don't have to do it right at some point they are going to receive the full state snapshot an adjust accordingly. Flash looks like a viable option again, but still, lock step simulation seems so much more straightforward, as there is no "adjusting" part. So are my assumptions correct? What would you suggest?


Kryonet Open a server locally only On the game I'm working on I wanted the singleplayer mode to use an integrated server to make adding more players via networking easier. The way I have it right now is I open a server and connects the client to my local address which works fine. But the problem is that if I play the game Singleplayer I don't want to leave anything exposed to the internet while only playing locally. Is there any way to limit the "range" of the server to only let communication happen via LAN? Thanks in advance! EDIT I am using kryonet for networking. The game is written with LibGDX.


how to guarantee the order of response in a service oriented mmo server cluster i'm working on a mmo server these days. it's a service oriented architecture, every service is one process which processes a specific type of request, and i have inventory service, battle service, etc. when received a request from client, the request will be dispatched to some corresponding service, based on the request type. let's assume we received two requests from one client in the cluster side request message queue, first request1 and then request2, then the two requests will be dispatched to service1 and service2. so request2 may be handled first and the client will receive response2 first and then response1, which will not be what the client expect. so i'm wondering how to guarantee that response will go back in the same order request come?


How does delta compression reduce the amount of data sent over the network? Many games use the technique of delta compression in order to lower the data load sent. I fail to understand how this technique actually lowers the data load? For example, let's say I want to send a position. Without delta compression I send a vector3 with the exact position of the entity, for instance (30, 2, 19). With delta compression I send a vector3 with smaller numbers (0.2, 0.1, 0.04). I don't understand how it lowers the data load if both of the messages are vector3 32 bit for each float 32 3 96 bits! I know you can convert each float to a byte and then convert it back from a byte to float but it causes precision errors which are visible.


Does StreamPeerTCP guarantee received packet is same from server? I'm making simple Godot project that works with Node.js server. To receive and send packet to Node.js server, I used StreamPeerTCP. First seems works, but after 2nd transmission from server, extract data from packet were broken and mess all other logics. This wasn't happened when same logic tested with Unity C https github.com rico345100 unity multiplayer with nodejs blob master Assets Scripts Network NetworkManager.cs Here's the repo I'm currently developing https github.com rico345100 godot multiplayer with nodejs https github.com rico345100 nodejs tcp server for godot Used Godot 3.1.2 but also works with 3.2.rc6. Tested with Godot 3.1.2 and macOS 10.13.6.


Solution for lightweight LAN peer discovering? I built a library for purely cross platform programming. My games made with it run fine in Android , Pc, Linux, Mac etc. The networking capabilities are provided by ENET library, therefore all communication between my apps is not TCP or UDP compatible, but only in the custom protocol, even tough its based on the UDP ultimately. I don't think its possible to do what i want with ENET, thats why I ask here for help! Lets say I have the same game running in my Android phone, my laptop and my pc. They are all in the same wifi network, and therefore in a LAN, whether its Wifi hotspot(?) or the household router. I need each of those 3 peers to discover the other two in the network. This is meant only to find the IP of alive apps in the LAN network, to be able to host multiplayer games between them. I can only think of one effective way to do this, UDP broadcast, wait responses, but if that is the solution, i need something small, since its the only purpose of the implementation. Other way could be to try to connect to all IPs in the LAN address subrange, but I don't think the OS would be with me on this one p


Handling packet impersonating in client server model online game I am designing a server client model game library engine. How do I, and should I even bother to handle frequent update packet possible impersonating? In my current design anyone could copy a packet from someone else and modify it to execute any non critical action for another client. I am currently compressing all datagrams so that adds just a tad of security. Edit One way I thought about was to send a unique "key" to the verified client every x time and then the client has to add that to all of it's update packets until a new key is sent. Edit2 I should have mentioned that I am not concerned about whether the actions described in the packet are available to the client at the time, this is all checked by the server which I thought was obvious. I am only concerned about someone sending packets for another client.


How do I determine how far to move an object in the client when using client prediction? I have a game server which, for testing purposes, is updating once per second, or 1hz so I can correctly implement client side prediction. Everything is running locally at the moment so there is no lag issues to deal with, but this setup replicates potential packet loss, or if the server somehow is behind on processing. I am using Unity for the client. I have a tunnel where the position is updated on the server and then broadcast to each client each tick (once per second). The client simply then lerps between its current position, and the new position received from the server, and this seems to work nicely. However, as I have set the tick to 1hz, there are unexpected results where the position seems to pulse, rather than smoothly transition. An example can be seen below. It can perhaps be seen more clearly without lerping I have tried constantly increasing the tunnel's position in the client, but if it's moved too far in the client, once the server's position is received, it is snapped back to that position which creates some weird rubber banding like effects even though there is no lag. How can I determine how much to move the tunnel in the client to create some seamless movement, even when the tick rate is so low? Baring in mind this movement is variable, so it can move faster slower at times so the movement in the client cannot be a fixed number. Yes, I can just increase the tick rate which gives smooth movement, however, there is no lag to account for as it's all local so I am just preparing for when I move the server to actual hosting. Instead of lerping between the current position and the received position, should I be trying to lerp between the current position and the next received position? Lerp Vector3 currentPosition transform.position Vector3 newPosition new Vector3(currentPosition.x, currentPosition.y, tunnelPositionZ) transform.position Vector3.Lerp(currentPosition, newPosition, Time.deltaTime) DMGregory's solution attempt If I decrease the 1.0f for the blend variable, the tunnel will move very slowly and then jolt forward when a snapshot is received. Decreasing the 1.0f to around 0.1f seems to align the speeds but there is still a noticeable jolt. I'm using the same velocity for the currentPosition and newPosition because the velocity never changes. float dT Time.time latestSnapshot.arrivalTime float blend Mathf.Clamp01(dT 1.0f) Vector3 currentPosition transform.position Vector3 currentVelocity rigidbody.velocity Vector3 newPosition new Vector3(currentPosition.x, currentPosition.y, latestSnapshot.tunnelPositionZ) Vector3 newVelocity new Vector3(currentVelocity.x, currentVelocity.y, latestSnapshot.tunnelVelocityZ) Vector3 velocity Vector3.Lerp(currentVelocity, newVelocity, blend) Vector3 position Vector3.Lerp( currentPosition velocity dT, newPosition velocity dT, blend) transform.position position


Only send moves for P2P 2 player LAN game? I am making a 2D network game. The concept is simple, a player have to shoot the other player to win. I'd like to improve this game ( add a map, items, monsters, w e ), but later. This is my first network programming experience. I have little theorical knowledges about packets, sockets, client server side, what is dangerous to do client sided, but I've never really used them. Goals set This is a 2 players LAN game, no more no less. No server. Player 1 starts the game waiting for player 2... ... which leads the game open for reverse engineering or packet editing, but w e, for this kind of game I prefer simplicity over security. Pretty basic. For a first network game that will never be shared, I take off problems and will see later. This is where I am each player is a square that can move in four directions. The approach TCP Packets. Each movement ( each frame a key is pressed to be accurate ), a packet is sent to the other player with his position. Packets are received each frames before drawing and updating game elements, in the same thread, with a non blocking receive() function. And that's it. My questions Is sending a packet for each moves overkill? Will I have problems with this later? What kind of problem can I meet? mono thread non blocking function will be a problem later, assuming the goals I've set?


RTS game How to handle disconnects in a fully connected peer to peer architecture? I'm currently working on a game in which I am considering implementing a networking architecture as described in this article http www.gamasutra.com view feature 131503 1500 archers on a 288 network .php In order for the implementation as described in the article to work, all peers need to be interconnected without any exceptions. Like so This works fine when everything is well. But I am wondering how to agree on disconnects in such a network. (Sadly something the article does not go into). It is relatively easy if one client goes down. Just give every client a timeout, and if a client does not respond for a certain time, it is removed from that client. However, how should the system solve a case in which one client does not respond to another, but still responds to all others. In such a system the following could happen, resulting in a invalid state Of course this can be solved by giving one of the clients some kind of "master" role. It being the only one that can decide whether or not to disconnect other clients. But I'm wondering if it can be achieved in a pure p2p network. Note I realize this case is not one that can likely occur "naturally". But I want to prevent players from being able to ruin a networking game for others by playing a trick like this by using the firewall for example.