How Can I Improve This Card Game AI? Let me get this out there before anything else this is a learning exercise for me. I am not a game developer by trade or hobby (at least, not seriously) and am purely delving into some AI and 3D related topics to broaden my horizons a bit. As part of the learning experience, I thought I'd have a go at developing a basic card game AI. I selected Pit as the card game I was going to attempt to emulate (specifically, the 'bull and bear' variation of the game as mentioned in the link above). Unfortunately, the rule set that I'm used to playing with (an older version of the game) isn't described. The basics of it are The number of commodities played with is equal to the number of players. The bull and bear cards are included. All but two players receive 8 cards, two receive 9 cards. A player can win the round with 7 bull, 8, or 8 bull (receiving double points). The bear is a penalty card. You can trade up to a maximum of 4 cards at a time. They must all be of the same type, but can optionally include the bull or bear (so, you could trade A, A, A, Bull but not A, B, A, Bull). For those who have played the card game, it will probably have been as obvious to you as it was to me that given the nature of the game, gameplay would seem to resemble a greedy algorithm. With this in mind, I thought it might simplify my AI experience somewhat. So, here's what I've come up with for a basic AI player to play Pit... and I'd really just like any form of suggestion (from improvements to reading materials) relating to it. Here it is in something vaguely pseudo code ish ) While AI does not hold 7 similar bull, 8 similar, or 8 similar bull, do 1. Establish 'target' hand, by seeing which card AI holds the most of. 2. Prepare to trade next most numerous card type in a trade (max. held, or 4, whichever is fewer) 3. If holding the bear, add to (if trading lt 3 cards) or replace in (if trading 4 cards) hand. 4. Offer cards for trade. 5. If cards are accepted for trade within X turns, continue (clearing 'failed card types'). Otherwise a. If only one card remains in the trade, go to 6. Otherwise i. Remove one non penalty card from the trade. ii. Return to 5. 6. Add card type to temporary list of failed card types. 7. Repeat from 2 (excluding 'failed card types'). I'm aware this is likely to be a sub optimal way of solving the problem, but that's why I'm posting this question. Are there any AI or algorithm related concepts that I've missed and should be incorporating to make a better AI? Additionally, what are the flaws with my AI at present (I'm well aware it's probably far from complete)? Thanks in advance!


How can I write my scoring system and add a score multiplier? I am new to the scripting world and I am currently trying to add a score multiplier to the game code I am working on. Right now the score is set to increase as the player runs across the level however I want to set it up so that the players gains X amount of score for every Y amount of distance traveled. I also want to add a multiplier for when they come into contact with certain objects X amount of time. Any help would be greatly appreciated.


A Partial recalculation when one node changes I have implemented an A library. Its most interesting feature is that it is "interruptible" for example, you can stop the calculation loop on a game frame, and resume it later on the following frame. The library works by creating "Nodes". Each node holds information about a cell in a grid what is the cost to get there, what is the cell's "parent" (from which it is cheaper to get to the cell) etc. This information is stored until manually released it is available for other uses if needed. The "bestNode" is a pointer to one of such nodes. When the search starts, it is the "origin", and it gradually changes until the destination is reached. Now I'd like to use that information to "partially recalculate" the node information when a node changes the typical example is a door which opens closes, allowing new paths cancelling existing paths. Since I have already calculated the path from the origin to the "changed" node, I'd like to conserve that info, instead of re calculating everything. So far my thinking is function update(location) If the modified location is not in a node, return not affected let node self.nodes location let parent node.parent delete all nodes that where created after parent add parent to the open list bestNode parent end So I have two problems I don't know how to select the "nodes created after parent". Would a "unique increasing integer", like in a database, be enough? This looks kind of complicated and clumsy. Is there a simpler way to do it? Are there any other "partially re calculable" A algorithms out there? I could not find anything on the subject. Regards!


Tron type game AI algorithm Im looking for a tron AI algorithm on snap! scratch. If not can you help me develop an AI for this game?


Implementation of finding an index in a 1D array for a triangular grid Am using a while loop to find an index within a 1D array, is there an easier, less time consuming and or mathmatical way to find the index? Consider the next grid 4 o 3 o o 2 o o o 1 o o o o 0 o o o o o 0 1 2 3 4 To find an index in the triangular grid within a 1D array I have the next function int size 5 int getindex( int x, int y ) int columnCount size while( y gt 0 ) x columnCount return x The array (The numbers within the parenthesis are the coordinates and to simplify your view, in reality the (x,y) is in its whole the data) pointdata data 15 (0,0), (1,0), (2,0), (3,0), (4,0), (0,1), (1,1), (2,1), (3,1), (0,2), (1,2), (2,2), (0,3), (1,3), (0,4),


How to maximize enclosed area and minimize perimeter on a grid with obstacles? Developing an RTS game, I have a tile based terrain (grid) filled with obstacles. It looks like this (red shapes are obstacles) Now I need to plan an enclosed area on the terrain with some restrictions tile marked with a quot star quot must be included (it is a seed) area needs to be at least 20 tiles (for this example) farthest area tile from the seed needs to be no more than 7 steps away (for this example) area needs to traversable by moving in 4 directions area should be bound by existing obstacles and by new fences new fences building takes time and resources, it is beneficial to use existing obstacles as much as possible and have the smallest number of fences placed. there are cases where terrain could be free of any obstacles, or contrary to that be a maze like labyrinth) it is okay to fail (e.g. there's not enough walkable tiles around the seed), or the area fences ratio is too low. processing is done on CPU (if that matters) So, here are some quot manual quot attempts at outlining an area of required size using the least fences As you can see, there are 3 enclosed areas (green, blue, orange) with very similar perimeters, yet different areas. Best one in this case would be quot green quot one it has the least fences added (just 10) and has the sufficient area (21). What is the algorithm to allow to plan area of given size ( 20) while minimizing the amount of additional fences required? So far I have tried to take the larger area and try to clip it using BFS to get the area within possible reach (7 steps), clipped the last step (since it is touching the unexplored and has no neighbor info) and clipped the obvious protruding buds leaves plenty of tiles to work with. I'm out of good ideas on how to improve from that yellow tile is the seed red tiles are walkable (saturation shows distance from the seed) dark grey tiles are obstacles light grey tiles are obstacles that also need fences purple tiles got clipped by existing incomplete algo black tiles are unexplored yellow dashes are required fences As you can see, it looks quite sub optimal, but I'm at loss as to how to proceed.


Path Finding for an Arena based map in 3D using NavMesh I have a 3D arena map (consider a small island surrounded by water on all sides) for a multiplayer Tank fight game. The moveable areas are marked using a Navigation Mesh made by the Arena designer. My question is what would be the best way for navigation in such an environment ? Specially considering the case when there is a Bridge at the center of the arena and you could walk under it or even above it ? If suppose the enemy is standing at the top of the Bridge and my AI is at one of the edges of the map ? How can it know whether the enemy is above or below the bridge and how can it navigate till it ?


How can I generate Sudoku puzzles? I'm trying to make a Sudoku puzzle generator. It's a lot harder than I expected and the more I get into it, the harder it gets! My current approach is to split the problem into 2 steps Generate a complete (solved) Sudoku puzzle. Remove numbers until it's solveable and has only 1 solution. In step 1, since I'm using a brute force methods, I'm facing some run time issues. Is there an optimal way of filling in a complete Sudoku puzzle? In step 2, what kind of algorithm should I use to "puzzlize" a solved sudoku?


How to divide hex grid evenly among n players? I'm making a simple hex grid based game, and I want the map to be divided evenly among the players. The map is created randomly, and I want the players to have about equal amount of cells, with relatively small areas. For example, if there's four players and 80 cells in the map, each of the players would have about 20 cells (it doesn't have to be spot on accurate). Also, each player should have no more than four adjacent cells. That is to say, when the map is generated, the biggest "chunks" cannot be more than four cells each. I know this is not always possible for two or three players (as this resembles the "coloring the map" problem), and I'm OK with doing other solutions for those (like creating maps that solve the problem instead). But, for four to eight players, how could I approach this problem?


Voxel sparse octrees for indirect illumination I don't understand the use of voxel sparse octrees for indirect illumination calculations. First of all, what exactly is happing? We're rendering the scene as usual with diffuse lighting. In the meantime, we're maintaining the octree of our scene. But when do we use it and for what exactly?


Checkers AI Algorithm I am making an AI for my checkers game and I'm trying to make it as hard as possible. Here is the current criteria for a move on the hardest difficulty 1 Look For A Block This is when a piece is being threatened and another piece can be moved in behind it to protect it. Here is an example Black Moves W W W W W W W W W W W W B B B B B B B B B B B B White Blocks W W W W W W W W W W W W B B B B B B B B B B B B 2 Move pieces out of danger if any piece is being threatened, and a piece cannot block for that piece, then it will attempt to move out of the way. If the piece cannot move out of the way without still being in danger, the computer ignores the piece. 3 If the computer player owns any kings, it will attempt to 'hunt down' enemy pieces on the board, if no moves can be made that won't in danger the king or any other pieces, the computer ignores this rule. 4 Any piece that is owned by the computer that is in column 1 or 6 will attempt to go to a side. When a piece is in column 0 or 7, it is in a very strategic position because it cannot get captured while it is in either of these columns 5 It makes an educated random move, the move will not indanger the piece that is moving or any piece that is on the board. 6 If none of the above are possible it makes a random move. This question is not really specific to any language but if all examples could be in Java that would be great, considering this app is written in android. Does anyone see any room for improvement in this algorithm? Anything that would make it better at playing checkers?


Player ranking using Elo with more than two players I would like to use Elo to track player rankings between matches of a certain game, however the game can be played with up to four players in a match. I have seen games like Carcassonne use Elo with more than two players playing, but I am not familiar with Elo beyond a 1 1 matchup. From the wikipedia article the two player equations I would like to extend are Ea 1 (1 10(Rb Ra) 400) Eb 1 (1 10(Ra Rb) 400) Rxnew Rxold 32 (W Ex), where W 1 if X wins and W 0 if X loses. How would the computation for Ex and W change given more than two players?


Fastest way to group units that can see each other? In the 2D game I'm working with, the game engine is able to give me, for each unit, the list of other units that are in its view range. I would like to know if there is an established algorithm to sort the units in groups, where each group would be defined by all those units which are "connected" to each other (even through others). An example might help understand the question better (E enemy, O own unit). First the data that I would get from the game engine E1 can see E2, E3, O5 E2 can see E1 E3 can see E1 E4 can see O5 E5 can see O2 E6 can see E7, O9, O1 E7 can see E6 O1 can see E6 O2 can see O5, E5 O5 can see E1, E4, O2 O9 can see E6 Then I should compute the groups as follow G1 E1, E2, E3, E4, E5, O2, O5 G2 O1, O9, E6, E7 It can be safely assumed that there is a commutative property for the field of view if A sees B, then B sees A . Just to clarify I already wrote a na ve implementation that loops on each row of the game engine info, but from the look of it, it seems a problem general enough for it to have been studied in depth and have various established algorithms (maybe passing through some tree like structure?). My problem is that I couldn't find a way to describe my problem that returned useful google hits. Thank you in advance for your help!


What is the best practice to handle event with order? When you play card games, you always face some abilities and effects will be triggered at the same time. To resolve this, players relies on the rules. For example, if a minion dies, it triggers effects on my side and opponent side. If the effects is handled on my side first if it is my turn. But how would you resolve it in computer games. Even you are using mediator for event handling, the event is usually handled by the order of subscription. Unless there are some indicators for the subscribers, you will not able to distinguish between the subscribers. But wouldn't it defeats the purpose of observer pattern? What is the best way implement it?


which is the best approach or algorithm to calculate real time ranking I want to know the fastest and most efficient way to compute points and ranking in real time. I'm doing a betting football game (a game where users try to predict the outcome of a game before it). In my country is called "Quiniela". Players put "predictions" just before the match starts. My question is from the moment the game starts, which is the most efficient way (not just code level but to the database and server) to calculate the ranking for the players "real time" as their predictions regarding the actual outcome of the game. For example If a Team1 vs Team2 plays, the user U1 predicted that the game would end 0 0, U2 predicted the game would end 1 0, U3 predicted the game would would end 1 1. When starting the game, the U1 would be to first in the ranking because, if the match ends like this, his prediction would be correct, or at least the most accurate. Then the score switches to 1 0, and the user U1 would be the last of the ranking (because his prediction is not possible anymore), U2 would be the first and U3 second. If the score changes to 1 1, U2 would go first, U3 would be second (because he guessed part of the result) and U3 last. I thought about creating a tree of possibilities with one level (0 0 first node, with 1 0 and 0 1 as child nodes) as you change the score, changes the Ranking "temporarily" and I would keep it in cache. Once the game is over, I keep the latest Ranking in the database. There is a more optimal way to solve this problem? It has been proposed before and already solved? I'm using MySQL for database, PHP (Cake Php) for the server and a bunch of mobiles who ask for the ranking once in a while.


How can I quantify a drawn line's straightness? I'm working on a game which requires players to draw a line from a point A(x1,y1) to the other point B(x2,y2) on the screen of an Android device. I want to find how well that drawing fits to a straight line. For instance, a result of 90 would mean the drawing almost perfectly fits the line. If players draw a curved line from A to B, it should get a low score. The end points are not known in advance. How can I do this?


What techniques make next gen look so realistic I have watch several gameplays from upcoming titles for ps4 and xbox one and I must admit that they are breath taking. Of course with new hardware, models will have more polygons and higher texture resolution but that is obvious tip of iceberg. So my question is Are there any complete new techniques, algorithms, shaders broadly used in next gen, already known on paper but not used in current gen because of limitation of hardware or this is all same but more complex,less generic or made for in house use(unknown for public) to provide better visual result for specified engine. From my observation Realistic particles,fluids (papers?) Geometry shaders (examples?) What I expected to see but was not shown Fracturing Generic destruction of buildings and cars! Is this still to compute heavy for large scale scenes?


How can I retrieve the outer most points on a 2d graph? I have a 2d graph which has some points plotted on it. What I need to do is get only the outer most points so that I can connect them up (isn't really relevant). What I can't seem to wrap my head around is the algorithm that I need to use in order to do this? I think this might help you understand what I want to achieve o o o o x o o o o All the o's I want to get and the x I want to ignore. Also, the points can be in any position and any shape but I still want to only grab the outer most points. Any ideas? Thanks.


Gesture Recognition Strategies Working with the Wii I often find it necessary to recognize simple gestures, so far I've been able to mainly look at magnitude of acceleration in order to recognize the gestures called out for in our game design documents, but I'd like to create a more robust system that allows "recording" of example gestures and recognition of complex gestures. What strategies have you used in the past? Why did they work? Why didn't they work? What would you do differently?


Ray tracing and Z buffering in graphics I am a high school student taking computer science as a subject, and someone who is very interested in the game development industry. I am currently writing an essay on Raytracing and Z buffering by comparing them and deducing the right situation for each of them. I was wondering if the developers could help me answer a question of in what specific situations those two are used specifically. I already know how both of them work. Also, do developers prefer another method than these two or is there a way to combine both to make an even more efficient 3D graphics algorithm? Thanks a lot!


How do I avoid obstacles on a predefined path? I want is a character to walk along a path defined as a waypoint sequence. For example, a soldier patrolling around a castle. However, I want the soldier to avoid (dynamic) obstacles, without deviating from the path too much. How can this be done?


Procedural... house with rooms generator I've been looking at some algorithms and articles about procedurally generating a dungeon. The problem is, I'm trying to generate a house with rooms, and they don't seem to fit my requirements. For one, dungeons have corridors, where houses have halls. And while initially they might seem the same, a hall is nothing more than the area that isn't a room, whereas a corridor is specifically designed to connect one area to another. Another important difference with a house is that you have a specific width and height, and you have to fill the entire thing with rooms and halls, whereas with a dungeon, there is empty space. I think halls in a house is something in between a dungeon corridor (gets you to other rooms) and an empty space in the dungeon (it's not explicitly defined in code). More specifically, the requirements are There is a set of predefined rooms I cannot create walls and doors on the fly. Rooms can be rotated but not resized Again, because I have a predefined set of rooms, I can only rotate them, not resize them. The house dimensions are set and has to be entirely filled with rooms (or halls) I.e. I want to fill a 14x20 house with the available rooms making sure there is no empty space. Here are some images to make this a little more clear As you can see, in the house, the "empty space" is still walkable and it gets you from one room to another. So, having said all this, maybe a house is just a really really tightly packed dungeon with corridors. Or it's something easier than a dungeon. Maybe there is something out there and I haven't found it because I don't really know what to search for. This is where I'd like your help could you give me pointers on how to design this algorithm? Any thoughts on what steps it will take? If you have created a dungeon generator, how would you modify it to fit my requirements? You can be as specific or as generic as you like. I'm looking to pick your brains, really.


Object detection in bitmap JavaScript canvas I want to detect clicks on canvas elements which are drawn using paths. So far I have stored element paths in a JavaScript data structure and then check the coordinates of hits which match the element's coordinates. Rendering each element path and checking the hits would be inefficient when there are a lot of elements. I believe there must be an algorithm for this kind of coordinate search, can anyone help me with this?


How can I detect connected (but logically distinct) bodies of water in a 2D map? I have a 2D hexagonal grid map. Each hex cell has a height value used to determine if it's water or ocean. I'm trying to think of a good way to determine and label bodies of water. Oceans and inland seas are easy (using a flood fill algorithm). But what about bodies of water like the Mediterranean? Bodies of water that are attached to larger ones (where "seas" and "gulfs" differ only by the size of the opening)? Here's an example of what I'm trying to detect (the blue body of water in the middle of the image, which should be labelled differently from the larger body of ocean on the left, despite being technically connected) Any ideas?


How can I generate a lightning bolt effect? Is there an algorithm to generate a lightning bolt? I would like an algorithm that generates a list of segment or point objects specifying where the bolt will land. The method would need a start point parameter, along with an endpoint. The bolt should have random branches coming off it, and zig zag at random intervals. The result will be a random lightning effect that would look somewhat like this (source wikimedia.org) If anyone knows of an algorithm that this may work for, help would be greatly appreciated!


Creating blur with an alpha channel, incorrect inclusion of black I'm trying to do a blur on a texture with an alpha channel. Using a typical approach (two pass, gaussian weighting) I end up with a very dark blur. The reason is because the blurring does not properly account for the alpha channel. It happily blurs in the invisible part of the image, whcih happens to be black, and thus results in a very dark blur. Is there a technique to blur that properly accounts for the alpha channel?


Road river generation on 2d grid map This is a newbie question, but here it goes My map is a 2d grid, and I want to generate roads and rivers. The route from the starting to ending point must not be the optimal route in number of tiles. Instead, they should have a certain level of randomness (turns). Is there a standard algorithm for this kind of thing? Cheers! UPDATE This is the result of playing with weights on the grid, and applying a shortest path algorithm (Bellman Ford) using the jgrapht library. I went with Donutz' answer after all. http pastebin.com AGQGK5ik


Maze algorithm with field counter I am new to algorithms but currently creating a little game with the need for some. I have a 2d grid board with a start and a finish field. Between those two fields are several platforms which can be entered. Each platform has a counter on it. When going on a platform the counter is decreased by one. If the counter reaches zero the platform is gone. The goal is to go to the finish field AND destroy every platform field. A little exmaple 0 1 0 1 2 1 1 0 F S 0 0 S being the Start field and F being the finish field the right path would be going UP, UP, RIGHT, UP, DOWN, RIGHT, DOWN. All I could find so far were algorithms getting paths for mazes without counter. Do you have any tips for a algorithm that can decide, if the current maze if solvable or not and maybe even get the correct path? Thanks in advance!


Finding equivalent axial coordinates for a wrapping hexagonal map of radius n I'm creating a wrap around hexagonal map that will potentially render infinatly. With the method I'm using, I have an x y coordinate I use to find it's equivalent axial coordinate with the equations Q (sqrt(3) 3 x 1. 3 y) hexSize R (2. 3 y) hexSize the problem is, my map is of radius n and it's possible for the Q R coordinate to be far outside that radius. How can I find the equivalent Q R coordinate within the radius n? I know methods for a single radius outside, but I'm talking the potential of having a radius of 15 but a Q R something like (9999999,99999999). What would that coordinate be in relation to the center of the 15 radius hex region it'd be in?


How do I produce "enjoyably" random, as opposed to pseudo random? I'm making a game which presents a number of different kinds of puzzles in sequence. I choose each puzzle with a pseudorandom number. For each puzzle, there are a number of variations. I choose the variation with another pseudorandom number. And so on. The thing is, while this produces near true randomness, this isn't what the player really wants. The player typically wants what they perceive to be and identify as random, but only if it doesn't tend to repeat puzzles. So, not really random. Just unpredictable. Giving it some thought, I can imagine hacky ways of doing it. For example, temporarily eliminating the most recent N choices from the set of possibilities when selecting a new choice. Or assigning every choice an equal probability, reducing a choice's probability to zero on selection, and then increasing all probabilities slowly with each selection. I assume there's an established way of doing this, but I just don't know the terminology so I can't find it. Anyone know? Or has anyone solved this in a pleasing way?


Is there an algorithm to detect the "mainland" on a 2D map? On this map, the "mainland" is all the land that can be connected to the center of the map in the four cardinal directions (north, south, east, west not diagonally). I would like to detect the mainland and fill the holes in it. I thought of three things Search in every non water (dark cells) cell if can be connected to the center of the map using a path finding algorithm. Too expensive! But this could work for the islands. The mainland is filled with a bucket of green paint. Each hole is surrounded by paint... now what? If i check every water point inside the mainland for adjacency i'll delete some peninsulas and other geographical features displayed on the shoreline. Some kind of edge detection to figure out the mainland. Keep whatever is inside, fill it if it's water, remove what's outside. Complex? Perhaps some game experienced developer can help me out with this, possibly giving me the name of some known algorithm or technique?


AI discover algorithm I am curious as to what algorithm logic game AI NPCs would use when discovering information about their environment. There are two scenarios that I could envision. The NPCs are all knowing in regards to elements in the environment, but choose to ignore them unless certain conditions are met (e.g. the guard will not "find" his fallen comrade's body unless he is x feet from the body) The NPCs really do discover the environment by scanning it or something... (maybe similar to path finding?) Maybe these are both used in conjunction... Could anyone point me in the right direction towards any preferred methods? I tried googling for this information, but could not find anything that seemed relevant.


How do I make hit damage a Gaussian distribution centered around a value? I'd like my character's attacks to on average 10 damage, but to vary anywhere from 0 to 20. Instead of a linear spread, I would like a normal distribution, so most of their hits are between 10 15, but they can still hit between 0 20. How can I do this? I am using PHP.


Networking for Real Time Strategy games I'm developing a real time strategy game for a computer science course I'm taking. One of the harder aspects of it seems to be client server networking and synchronization. I've read up on this topic (including 1500 archers), but I've decided to take a client server approach as opposed to other models (over LAN, for instance). This real time strategy game comes with some problems. Thankfully, every action the player takes is deterministic. However, there are events that happen on scheduled intervals. For instance, the game is made up of tiles, and when a player takes a tile, the 'energy level', a value on that tile, should grow by one every second after it's taken. This is a very quick explanation that should justify my use case. Right now I'm doing thin clients, which just send packets to the server and wait for a response. However, there are several problems. When games between players develop into endgame, there are often over 50 events per second (due to the scheduled events, explained earlier, piling up), and synchronization errors start to show up then. My biggest problem is that even a small deviation in state between clients could mean different decisions the clients take, which snowball into entirely separate games. Another problem (which isn't as important right now) is that there is latency and one has to wait a few milliseconds, even seconds after they make their move to see the result. I'm wondering what strategies and algorithms I could use to make this easier, faster, and more enjoyable for the end user. This is especially interesting given the high amount of events per second, along with several players per game. TL DR making an RTS with 50 events per second, how do I synchronize clients?


Algo for given an amount of XP, find a character's level In a RPG context, what are the ways to quickly find a character's level, given his XP? There are two cases which I am looking at For when a formula is defined, like in the case of D amp D, which is N N (N 1) 500, where N is the desired level. When no formula is defined, each level has an amount of XP require which is defined by a table. I guess the easiest way is to do a for loop and subtracting the XP required for that level from the character's XP pool, till he reaches a point where you can't attain the next level. What other ways are there to, given a character's XP, to find his level? Edit The language is PHP


How to highlight non rectangular hotspots? So my question is highly related to Creating non rectangular hotspots and detecting clicks. Yet again, I've irregular hot spots (think the game Risk). So basically, we can detect clicks on these hot spots easily using color key mapping as discussed in above question which I don't have any problems implementing (which is also covered here in details). The problem is about highlighting these irreguar hotspots. So let me explain the question a bit more the above color key mapping guide uses this as a world map Then the author color maps the imaginary countries Now we can now detect the country the pointer is over. In the same article author mentions outlining countries on mouse over. Though to get the effect, he creates unique border assets for each country like For the game I'm working on I'm using the same color key mapping idea to detect hot spots, but I didn't like the way of highlighting hot spots. Coloring all the hot spots is already a time consuming job for me as I have 25 hot spots for each map. Further, the need to have 25 unique border highlight asset per hot spot doesn't sound right. Anyone have a better idea suggestion on highlighting these hot spots?


Representing a high resolution deformable solid in 3D I am currently working on a design that will incorporate an object that can change size and shape. For an example, I'll use a brick of clay. It starts out with normal dimensions of 1"x3"x6", but that can be changed because it is a soft material that can be molded. I'm looking for a way to represent the size and shape of that object, no matter what changes have been made to it. For example, if you push your thumb down into the clay causing a hole, how could I keep track of that (from a programmatic point of view). I thought about going all the way down to a semi molecular level, where each "molecule" (I'm not talking actual molecules, but units that are small enough that they can always be considered the same size regardless of the shape of the object the resolution if you will) is represented, but the amount of data that could generate for a decent sized object seems to be staggering. Even if the units were always the same size, the location of every unit would constantly need updating, along with algorithms to determine where each unit would go in the case of a force. The problem seems to get out of hand at this point, which is why I'm looking for any suggestions.


How do I know when a player has crossed a point threshold? I m needing help figuring out logic when adding a time bonus to my game. I only want to reward the player with extra time if they level up. Currently when the player s score is less than 100 no bonus is given. If the player s score reaches 200 I want to reward the player with some bonus time. My issue is if the score is 190 and then jumps to 210, the 200 level mark is passed and the player isn't rewarded. If I turn on the logic to say if the score is between 190 and 210, it could reward the player at the 190, 200, 210 mark or skip from 180 to 220, bypassing the reward altogether. I have tinkered with the idea of setting a bool BonusFlag, but the same issue arises, when I set the flag. Can anyone help provide some logic on how to overcome this obstacle?


Algorithm that cover one mesh by another mesh Suppose I have two meshes (Let call me first MeshShirt and second MeshBody) Meshes are aligned (if i render both MeshShirt "covers" MeshBody). But some parts of the body are not "under" the MeshShirt (because MeshShirt shape differs from MeshBody) How can i "pull up" parts of MeshShirt which are under MeshBody and hold other parts in their places? Of course i want save shape of MeshShirt if it possible I think about following algorithm mark all points of MeshShire which under MehsBody by tracing intersection of its normals and MeshBody. But if MeshShirt "hidden" parts have complex shape normal tracing will not work. So some way to detect bad points is needed move every marked point to the plane of its nearest triangle of MeshBody. But i afraid that these algoritm may produce significant deformation of MeshShirt. So some shape preserved deformation is needed too. Sorry for my poor English and fuzzy problem definition


Implementation of finding an index in a 1D array for a triangular grid Am using a while loop to find an index within a 1D array, is there an easier, less time consuming and or mathmatical way to find the index? Consider the next grid 4 o 3 o o 2 o o o 1 o o o o 0 o o o o o 0 1 2 3 4 To find an index in the triangular grid within a 1D array I have the next function int size 5 int getindex( int x, int y ) int columnCount size while( y gt 0 ) x columnCount return x The array (The numbers within the parenthesis are the coordinates and to simplify your view, in reality the (x,y) is in its whole the data) pointdata data 15 (0,0), (1,0), (2,0), (3,0), (4,0), (0,1), (1,1), (2,1), (3,1), (0,2), (1,2), (2,2), (0,3), (1,3), (0,4),


Algorithm for creating tree like network structures I'm trying to procedurally model tree like network structures with the following properties A root with variable number of nodes A variable depth of nodes When graphically laid out, edges or nodes must never intersect or overlap I don't have a background in maths or programming, so I am not sure that I am using the correct terminology. Maybe a picture would better explain what I am after I know my way around Ruby pretty well, so I think I should be able to implement a basic algorithm that generates these models. Any pointers or recommendations?


How to make score points based on time So the idea is simple. a) Players why finish the level faster, should get higher score. b) The levels (1 to N) where every next becomes more difficult should impact the score. So it's kind of mix of quot time to complete quot and quot level number quot . If would know the fastest possible time the user can complete the level, I would do the fallowing a) If player completes the level in fastest time, it gets max score 100. b) If it takes, for example, twice as long I divide by 2 and get 50. c) Then I multiple by the level number assuming that every next level is twice as difficult. Example Player completes level N two times slower than fastest time, so Score 100 2 N 50N But the problem is that I can't really figure out the this fastest time for each level, because my game is a complex randomized 4d maze and I have no idea how fast a pro gamer can complete it to define the max score. And without that I have no idea how to calculate the score. This question is all about quot Can we figure out the score without knowing the fastest time quot Any help appreciated.


Efficient visualization of a large voxelized volume Lets consider a large voxelized volume stored in an oct tree or any other convenient structure. This volume represents, for instance, a landscape, where each block is either empty (air), or it has an specific material that will be later used to apply a texture. Voxels that are next to each other represent connected sections of the surface. What I need is an algorithm to generate a mesh from this voxels that represents the volume, with the following caracteristics All the "holes" in the voxelized volume are correct. All the connections are correct, i.e. seamless. The surface appears smooth. In a broad sense, I want to somehow preserve the surface topology, meaning that connected sections remain connected in the resulting mesh and that the surface has a curvature that responds to the voxels topology. Imagine trying to render the Minecraft world but getting the mountain ladders to be smooth instead of blocky.


Algorithm to make an entity follow tile edges in a tilemap I'm implementing something like the electric balls seen in this video https www.youtube.com watch?v MWyB56AlAWw (skip to 1 55 and you will see this electrical balls follow tile edges in the tilemap). I have an algorithm working but I feel like it is a bit of a mess. I could summarize it as 1) Setup The ball starts always falling I have an enum holding what side the ball is engaged to (side of tile it is traveling. It could be Top,Bottom,Left, Right and None). This var is inited to "None" at start. 2) While the ball is falling, as soon as it touches a tile we set the engaged var to bottom (the ball is engaged to a tile that is at the bottom) and we make it move to the left. 3) Now we have 2 cases the ball collides with another tile while moving to the left. In this case we set the engaged var to Left and start moving it upwards. the ball gets into a situation where there's no tile at the bottom to continue going to the left. In this situation we use the engaged var to know what edge of the tile we were moving along. In this particular case as we where engaged to a bottom tile we fix the ball position to be right at the left of the last valid tile and start moving it down. This applied to all possibilities makes the ball run across all the tilemap. I would like to know if there's a more clean way to do this without all this "mini cases" or a better way to accomplish this. Cheers


Tiled tilemapper isometric I'm attempting to move from oblique mapping (45 degree angles) to isometric (30 degree angles) in Tiled. I made a test tile in Photoshop Made an isometric map But my tile appears completely distorted, and the 'isometric' map just appears as a top down grid rotated 45 degrees How do I create a proper isometric scene using tiled? Hi, in your example (here), your Tiled grid is angled down. As you can see, mine appears Top down. How do I configure this?


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.


Rendering mountains around a tile layer When making a 2D Pok mon game, I just faked elevation by putting mountain tiles underneath the land. Now my tiles are 3D models, so I'm using layer properties to define their elevation. What I don't know though is how to generate a 'mountain' around them. The tilemap is kinda' like this Layer 1 Layer 2 Layer 3 .... .... .. . .... .. .... Layer 2 has y offset set to 1, and Layer 3 has y offset set to 2. All they do right now is float in the air. What I'm trying to do is render a mountain around them.


Hexagonal Game Board Modal? Tile based games like Chess have a simple modal an array of arrays, each coordinate with an X and a Y value. This is easy to implement, and it is easy to figure out what is going on. Chess Board http www.chesscentral.com EasyEditor assets chess board blank.gif However, when I see games like Civilization 5, I am not sure how hexagonal worlds are implemented. I have a couple ideas, but cannot confirm them. Each row of hexagons is represented in the modal by an array of tiles. This would be much like the first chess board, but would require more effort to figure out adjacent tiles. Each tile only know what tiles border it. When the game renders one tile, that tile loads the 6 around it, which repeats until the screen is filled with tiles. Are either of these guesses correct? If not, how do developers implement these hexagonal maps?


How to implement different shapes for an area of affect spell? Let W wizard Let 0 Cast range of spell, or AOE Here is the problem I have a 2D tile map of squares. Let's say I want to have a wizard cast a spell that surrounds his body equally. For this, it would be as simple as using a flood fill or Dijkstra's algorithm, and it would look like this 0 00000 000W000 00000 0 No problem! However, how will I implement a spell, that, for whatever reason, looks like a plus sign? 0 0 000W000 0 0 Or the spell goes longer in the direction the wizard is facing? 00000 00000 0W0 000 Or two different locations? 00 W 00 Or, even more awkward, its a ranged splash spell where the player can choose where they want to cast it? W 0 00 One way would be to have a list of all the locations relative to the wizard beforehand, and add them to the wizards location later. (E.g, for the affect to be 2 tiles north of the wizard, it would store (x 0, y 2), and later add them to the wizard's position, which could be at x 30, y 19, so the affect would be at x 30, y 21.) A limitation to this, unfortunately, is that it doesn't take into account where the wizard is facing, and it feels inelegant to manually typing in all the locations that the AOE will affect. Bottom line How should I approach this problem and create a good, easily adjustable AOE system for a tile based map, that takes into account different AOE shapes and cast positions?


Is it bad practice to use the entire map image as a tilemap? I made a map in photoshop which I want to use as a map in my game. The question is should I try to cut it up to pieces, or is it bad (performance wise) if I use the way I made it. The picture itself is really specific without any repeatable part so I'm not sure if I can cut it up to smaller parts. I'm kinda new to game developement, so pls forgive me if I asked something stupid here.


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


Hexagonal tilemap is being distorted So I made a hexagonal tilemap of ocean tiles and then picked a few tiles to be land. When I pick all adjacent tiles to the hexagon it usually works, but for tiles that are on certain columns it does not. Also, on these columns the tops and bottoms of tiles are missing. It's hard to explain but here's a screenshot that should clear it up As you can see, on every other column the top and bottom of hexagons are missing, when all adjacent tiles are filled in to the centre tile it works fine for those columns without a bottom and top on hex, but when it's on the other column one of the adjacent tiles is displaced. Any suggestions? Code baseLayer.setCell((int)islands currentTile .x , (int)islands currentTile .y, landCell) baseLayer.setCell((int)islands currentTile .x 1, (int)islands currentTile .y 1, landCell) baseLayer.setCell((int)islands currentTile .x 1, (int)islands currentTile .y, landCell) baseLayer.setCell((int)islands currentTile .x , (int)islands currentTile .y 1, landCell) baseLayer.setCell((int)islands currentTile .x 1, (int)islands currentTile .y, landCell) baseLayer.setCell((int)islands currentTile .x , (int)islands currentTile .y 1, landCell) baseLayer.setCell((int)islands currentTile .x 1, (int)islands currentTile .y 1, landCell)


server coordinate to client coordinate I've a really quick and maybe dump question and I don't really know how it is handled generaly. I want to make a tile base multiplayer game. Player doesn't teleport from a tile to another but just walks pixel by pixel. So my client position will be two floats based on the actual position of the sprite on the screen. But on the server, should the position of the player be based on the texture as well, or it must be clientPosition textureSize ? Imagine a player being on position x 150 y 100 on his screen, and a tile texture size of 32px, should the position of the same player on the server be 150 100 or 4.6875 3.125 ? Thank you in advance )


How to handle tiles on top of players I am creating an 2d bird view tile game using the pixijs render framework. Like pokemon or oldtime zelda. In those games you sometimes walk behind buildings where the tile would be drawn on top of the player. I am using an multidimensional array for each tile properties. Where you can set ground level images and level on top of ground level images. The 'z index' can be changed. Should I create an new property to flag it as an tile that can be on top of the player? Where all those tiles with that property are drawn on top of the player. But there is an possibility that you can climb walk on the building and the player should than be drawn on top of the tiles. You should take the following into consideration the game is an multiplayer game. This could be an conflict if all the players characters (the player,npc, cpu) are one layer and the tiles that can be drawn on top of the player are one layer. Because for example one player is walking on top of the building and one is behind the building. You cant change the z index of the player one lower. Because the player behind the building wil look like he is on top of it because the player is drawn on top of it by the changed z index. you can be drawn on top of the tile level (like walking om top of the building or mountain) tiles can change (a building that is going to be destroyed for example) thus are not fixed So how can I handle tiles on top of a player which can be also beneath one player but not the other?


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?


L ve2D Making a random map city generator So I'm making a game using love2d where the player will find himself in an zombie infested city but I don't want the city map to be just the same all the time, so I want to create a random map city generator, but I don't know where to start, I maybe can make my own but the result would probably be not what I wanted, as I don't want tiles getting placed all over the place messily(it won't look like a city then), I want random set of tiles getting placed in the world map like buildings get placed randomly throughout the world map, I hope someone can help me with this as this is really hard for me...


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.


Interactive map designer I've made a simple game in pygame pymunk. Currently my maps consists of lists with functions, e.g ground segments ground(position, size, shape...), ... I have equally built up lists for planks, stones, trees etc. And althoug it works, it is a bit tideous to work with. I tried first tried making a tile based map editor and .txt files to read write to, but having a grid of letter felt limiting to wha I could add. Since I had a working concept of importing lists with the information I tried to build on that, but stopped once I realised I couldn't edit the contents of map.py fromlevel editor.py. Is there a workaround for that or do I need anothter concept? If so, any suggestions?


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


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.


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 I make my foreground tiles stand out more from the background? (the background implemented in the game) In the game that I work on, the background and the map tiles are pretty indistinguishable for new players, probably because they have similar colors and theme. Are there any tips or tricks to make the background more like a background and be distinguishable from the map tiles? The game has motion blur which kinda helps, when the player is running the background gets blurry therefore making it more distinguishable from the map tiles. However, that is clearly not enough. Any suggestions, tips or tricks will be greatly appreciated! (purely the background) EDIT Thank you for the suggestions and the ideas! here are some variations of this background that I came with. (darker and way more blurry) (dawn colors and some blur) (one of the coolest things I've done blur) (one of the coolest things combined with dawn colors blur)


UNITY How do I use SetTile() with a tile asset scriptable tile? How do I use Tilemap.SetTile() with a tile asset? I want to use it for scriptable tiles in the 2d extras package, such as rule tiles, weighted random tiles, and animated tiles. How would I 1. get inspector reference of this scriptable tile, and then 2. use SetTile() with it? Thanks for your attention.


Top down tile based game render order I'm making a simple top down (like this) tile based game (using JavaScript, for reference) I use Tiled for making maps. I have sprites that are more than one tile high, and so whenever they are in front or behind of some objects more than one tile high tiles will be displayed in front of the player. I am looking for a way to give certain tiles 'height' such that only characters of that height could appear in front of those tiles. Here is a screenshot showing my problem (the sprite is doge because it was the first image I found) The same tiles don't always equate to the same height, so I can't give tiles set height. I've thought of one way to give tiles height, and that is to have a (hidden) layer that describes the height level certain tiles are at. However, that solution would be slow and painful to implement. I'm wondering if there's a better way to do it. A few other potential ideas I've had Have a tile layer for each height, hackily guess the height of a tile at runtime based on tiles below (would be buggy) but I think that there would surely be a better way to do it.


How can I generate a TileSet from an existing image of a level? Let say I have this level from Zelda ALTTP. I know that each tiles are 16x16. How can I generate a tileset and map from part of the original image? (Image source)


Are there definitive, unambiguous terms for hexagon tile orientations? I have been working on a tile map editor and plan to support two orientations for hexagons. I have seen various terms used, but these all seem ambiguous to me. Horizontal, Vertical (ambiguous does this mean they line up horizontally, or stack horizontally?) Flat, Pointed (ambiguous Are they flat on the sides or top and bottom?) I would like to find unambiguous terms for the following two orientations for hexagons ideally, these would be definitive and succinct (I could refer to these as "Flat on Top" and "Pointed on Top" but would prefer something more technical and authoritative). Edit I was holding out for something more technical, but it's hard to argue with Amit. For me, "pointed" sounds more formal than "pointy," so I am going to use the following (a decision reinforced by DMGregory's answer) Flat top and Pointed Top.


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?


What behaviors should go into making a "non perfect" AI combatant? When making an npc combatant, it's easy obvious what to do to get a robot deathmachine by optimizing combat tactics, timing and attack types, but harder (and more interesting in a fight) to get an idiosyncratic, inpredictable enemy. What behaviors (algorithms?) are useful for creating a more organic, unconventional enemy? Edit My specific use case is with MMO like enemies, e.g. World of Warcraft, although with less graphics involved. Note that that means both human and inhuman enemies (animals, monsters, etc)


Dealing with AI in a simple strategy game Hi I am currently working on a small real time strategy game. The game consists in discovering and exploring planets to get knowledge and resource points. Every Unit of Time (UoT) in the game those points are adjusted based on a various factors. Basically the more planets you have explored the more points are generated, yet the more planets you get the greater the expenses per UoT, so it is a balance. There are a variety of planet types, some which allow to discover planets in a greater area, but produce little points, whilst others produce a lot of points. The longer the players lasts before running out of resource points and the more planets they explore the higher their score is. I kind of got a decent game at the moment, but I wanted to add an AI to have other explorers competing against the player. I don't really know how to handle it. So far my thoughts are to add weights to various parameters (like the number of points provided by each planet, the cost in points to explore it, the fact that it has been already explored, etc...). Those weights would be adjusted based on a variety of conditions, say if the player resource points drop below x then the weight attributed to the number of resource points provided would be greater than that of knowledge points. I was wondering if anyone had any thoughts on this, is it likely that I'm going to get myself tangled in all of it if I do it this way. Also one important thing to note is that the game space is randomly generated, i.e every time a UoT passes or an explorer explores a planet there is a chance that 2 new planets are being randomly generated. Which means I can't really use methods which are based on calculating a few turns ahead to make the best decision. Finally, the game is relatively peaceful, I don't have a combat system, and the only risk of exploring a planet already explored by another explorer would be that, if that explorer is nearby, he might just re explore it as soon as you have left meaning you have spent valuable resource points for no benefits, since all the point generation will go to the most recent explorer.


Moving an object around the the circle to the specific location in circumference Well I have run out of ideas how to approach this particular problem.See the picture below So the idea is that the object (dot in black) has to get to a point mark X (red X mark).However the limitation is that it has to get there without crossing the circle (i.e going in the straight line the the X mark).I was reading on some steering algorithsm but seems rather too complicated for this problem.Also I should mention that the object has the speed and velocity and position attributes which controls how its moving. Now I was reading some ideas on how to move an object around a circumference here Here However this doesn't entirely answer my question.The thing is I first need to get to the circle in order to be able to move around it.What I was thinking,was to allow the object to move towards the position in a straight line until it hits the circle and then start moving along the circumference of the circle.Also the "X" mark can be anywhere on the circle even right in front of it (not behind on the other side of the as in this example shown in the image) I am not a game developer and thus never came across issues like so.The idea is that there will be more than one black object trying to get to their own "X" mark on the circle from random positions.(They idea is that they will be surrounding some objects in the middle). Here is an image to show what I mean,where each black object has an X position that they need to attend to without directly going through the circle.(Sorry for my bad drawings,was using laptop track pad to do these images) Anyway I am kinda lost with this and would to see different on tackling this particular problem.


How can I efficiently update only the entities that matter in a given frame? I'm making a RTS, which can potentially have lots of units in one map (think Age of Empires). I'm looking for a way to update my units. I want to avoid calling a virtual Update() method every frame on every entity. On the other hand, units that are not in view should still be updated and behave "normally." I'm assuming this is a fairly standard question what would be a way to handle this situation?


what is the best way to add avoidance behaviour to an AI framework? I have a small AI framework for a shooting based game. Although this is rarely needed, as when agents are close to each other they are usually fighting, I would none the less like some way of implementing avoidance behaviour. For example, if in the future I wanted to take away their weapons and have many of them wonder around in a crowd, how would I make them not hit pass through each other, but instead avoid each other? while still following their calculated paths that is. two ideas I had would be to add steering behaviour and allow that to deviate from their path, or to use a dynamic pathfinding technique. Are these valid solutions? If yes how, in theory, would I implement them? Are there better ways? What is the more respected practice?


How to program an enemy to attack when someone gets near it? Like in free roam RPGs, like Skyrim, I want to make a super rudimentary screen with just two objects player and enemy. The enemy will walk around randomly through AI algorithms, and will only fight back gracefully when the player gets near them, and when the player runs away past a certain distance it will continue its AI walking cycle. How do I do this? Any guidance would be nice.


Is there any popular AI game engine? Is there any sophisticated game AI engine that can save time on AI implimentation and provides strong and clever AI? The game genre is strategy, so AI should be strong. The game in some aspects is similar to the starcraft. So we can use it as good example. As for me SC2 game AI is is very weak. When I played it, I quickly found very simple strategy line with help of it which could win in 100 of cases for any race. After that it was not interesting to play. So I want stronger AI, and AI that can learn. I don't like deterministic algorithms. I can accept some good end state machine algorithm, but good implimentation of such algos requare long time and testing. And all of such algos in stratgies are week and not interesting once the player has found weaknesses. I can try to impliment AI by myself using neural networks, genetic algo or something like that.. but that will requare even more time. So I am interesting in some ready sophisticated game engine, that would be easy to train and adjust under myself. I looked and found only http alive.sourceforge.net ... it not looks very populat, fast and sophisticated. (The game is openGL C . I have enaph free processor resources for AI)


Implementing an automatic navigation mesh generation for 2d top down map? I am currently in the middle of implementing an A pathfinding for enemies. In order to implement the actual A logic, I need a navigation mesh for my map. I am working on a 2D top down rpg map. The world is static, meaning there is no requirement for dynamic runtime mesh generation. My world objects are freely placed (not snapped to grid), rotated and scaled, which means that using a grid based A is going to be a little complicated. For example, how would I know a grid tile contains a collidable object? Lets say that object is actually located on the tile next to this, but is rotated and scaled such that it is still blocking the way? I could check for the middle pixel of the grid tile to see if it contains any of the nearby objects color data, but it still wouldn't be all that accurate and occasionally enemies could get stuck in between objects.


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?


3D Side Scrolling Shooter to use or not to use Lua scripting? I'm programming a Side Scroller, and I've reached the point where I need to program the enemy behaviour. I don't know what I should choose between hard coding the enemy ships' behaviour or using a scripting language. Going with the hardcoded way, all different kind of enemies would be different classes derived from an abstract EnemyShip class with a virtual function redefined for each of them. Going with the scripting instead I could do just a base class and a script manager which moves the ships as needed. What should I do?


from where do i start to learn game ai Possible Duplicate New to creating AI where to start? i have been programming 2 3 games till now. but i have not used ai in any of them...so can u please suggest good ebooks or net articles or tutorials on game ai...problems featuring shortest path, pathfinding etc... Thankyou


Behaviour Trees with irregular updates I'm interested in behaviour trees that aren't iterated every game tick, but every so often. (Edit the tree could specify how many frames within the main game loop to wait before running its tick function again). Every theoretical implementation I have seen of behaviour trees talks of the tree search being carried out every game update which seems necessary, because a leaf node (eg a behaviour, like 'return to base') needs to be constantly checked to see if is still running, failed or completed. Can anyone suggest how I might start implementing a tree that isnt run every tick, or point me in the direction of good material specific to this case (I am struggling to find anything)? My thoughts so far action leaf nodes (when they start) must only push some kind of action object onto a list for an entity, rather than directly calling any code that makes the entity do something. The list of actions for the entity would be run every frame (update any that need to run, pop any that have completed from the list). the return state from a given action must be fed back into the tree, so that when we run the tree iteration again (and reach the same action leaf node so the tree has so far determined that we ought to still be trying this action) that the action has completed, or is still running etc. If my actual action code is running from an action list on an entity, then I possibly need to cancel previously running actions in the list i am thinking that I can just delete the entire stack of queued up actions. I've seen the idea of ActionLists which block lower priority actions when a higher priority one is added, but this seems like very close logic to behaviour trees, and I dont want to be duplicating behaviour. This leaves me with some questions 1) How would I feed the action return state back into the tree? Its obvious I need to store some information relating to 'currently executing actions' on the entity, and check that in the tree tick, but I can't imagine how. 2) Does having a seperate behaviour tree (for deciding behaviour) and action list (for carrying out actual queued up actions) sound like a reasonable approach? 3) Is the approach of updating a behaviour tree irregularly actually used by anyone? It seems like a nice idea for budgeting ai search time when you have a lot of ai entities to process. (Edit) I am also thinking about storing a single instance of a given behaviour tree in memory, and providing it by reference to any entity that uses it. So any information about what action was last selected for execution on an entity must be stored in a data context relative to the entity (which the tree can check). (I am probably answering my own questions as i go!) I hope I have expressed my questions adequately! Thanks in advance for any help )


How to calculate move while avoiding deep copy Suppose in a turn based game, I have an object holding the current status of the game (like players, board information, positions of pawns, things like that). Now I want my AI to calculate the best move (or at least a good move). My first try was to determine all allowed actions and generate a new game object for each action the player or computer could do. Then I would repeat the process for all resulting game objects. This would yield a form of tree with all the future possibilities, from which the AI simply could select the optimum. But it turns out that this approach is cruelly slow, mostly to me deep copying the game object thousands of times and holding thousands of copies of the game object in the memory. I am now searching for a better approach to calculate a good move. Are there technics for this type of problem. I am aware that this probably depends on the kind of choices the player or AI has to make in the game. But I am more interested in general technics used to tackle this kind of problem. Any help is appreciated. If this question is more appropriate for somewhere else (for example StackOverflow), please move it there. Thanks!


Situational awareness in path finding Assume you had to find the shortest path through a dungeon, where certain passages are only opened to you after certain items were collected, like locked doors and keys, for instance. The normal gut reaction to the words "shortest path" would obviously be A . But A would fail in such an environment, since I see many problems defining a reliable heuristic and, additionally, it is very likely, that a node has to be visited multiple times, which is also not possible in conventional A and would also make the heuristic harder. What I thought about is simply looking for a path from the start of the dungeon to the end, ignoring any blocked doors. After this path is found, for each of the doors blocking our way, an additional path looking for the appropriate key and back to the door would be sought and traversed before the door is even reached. The very same system would be used to handle a situation, where the path to a key needed to open a door is again blocked by another door, which needs to be opened first. A big problem I see with my solution is that after all the paths including the ones for item acquisition are found, the total distance travelled by the agent might not be the smallest possible, since there might be other blocked doors that are farther from the goal but have their appropriate key much more easily available. A would have neglected these doors on the first pass where blocked doors are simply ignored. I'm sure I'm not the first one to try to solve this and I would appreciate some input on the problem.


Fuzzy State Logic or Finite State Machine for AI My question is regarding the use of fuzzy state logic and finite state machine with AI. What I would like to know is what the key benefits are for both and also some examples of situations where you might want to use a particular state machine. My main areas of interest are the questions the follow. Which is better for group AI? Which is better for individual AI? Which is more efficient? Also some links to any demos of each that exist would be really cool! Thank you all who answer comment!


Grid pathfinding with a lot of entities I'd like to explain this problem with a screenshot from a released game, DROD Gunthro's Epic Blunder, by Caravel Games. The game is turn based and tile based. I'm trying to create something very similar (a clone of the game), and I've got most of the fundamentals done, but I'm having trouble implementing pathfinding. Look at the screenshot. The guys in yellow are friendly, and want to kill the roaches. Every turn, every guy in yellow pathfinds to the closest roach, and every roach pathfinds to the closest guy in yellow. By closest I mean the target with the shortest path, not a simple distance calculation. All of this without any kind of slowdown when loading the level or when passing turns. And all of the entities change position every turn. Also (not shown in screenshot), there can be doors that open and close and change the level's layout. Impressive. I've tried implementing pathfinding in my clone. First attempt was making every roach find a path to a yellow guy every turn, using a breadth first search algorithm. Obviously incredibly slow with more than a single roach, and would get exponentially slower with more than a single yellow guy. Second attempt was mas making every yellow guy generate a pathmap (still breadth first search) every time he moved. Worked perfectly with multiple roaches and a single yellow guy, but adding more yellow guys made the game slow and unplayable. Last attempt was implementing JPS (jump point search). Every entity would individually calculate a path to its target. Fast, but with a limited number of entities. Having less than half the entities in the screenshot would make the game slow. And also, I had to get the "closest" enemy by calculating distance, not shortest path. I've asked on the DROD forums how they did it, and a user replied that it was breadth first search. The game is open source, and I took a look at the source code, but it's C (I'm using C ) and I found it confusing. I don't know how to do it. Every approach I tried isn't good enough. And I believe that DROD generates global pathmaps, somehow, but I can't understand how every entity find the best individual path to other entities that move every turn. What's the trick? This is a reply I just got on the DROD forums Without having looked at the code I'd wager it's two (or so) pathmaps for the whole room One to the nearest enemy, and one to the nearest friendly for every tile. There's no need to make a separate pathmap for every entity when the overall goal is "move towards nearest enemy friendly"... just mark every tile with the number of moves it takes to the nearest target and have the entity chose the move that takes it to the tile with the lowest number. To be honest, I don't understand it that well.


Making the AI take different paths to each other I have a top down 2d game where the AI spawn at the edges of the map and run towards the center. I'm using A and a node mesh to do the pathfinding. Right now, the AI spawn at a point on the edge of the map and all take the same path which is the shortest route to the center. Now I want them to be more surprising and interesting and take different paths to each other. I can immediately think of two ideas for doing this but wanted to know if there are other ways or better ways that people often use? When one enemy spawns and generates a path to the center, temporarily increase the cost of all the nodes on that path, then slowly decrease them back down over time. Then the enemy AI that spawn later will be forced to take a wider path. The above approach will lead to AI just taking a wider and wider path though and still be very predictable. So I thought I'd also introduce a number of intermediate goal nodes around the map. When the AI spawn they randomly pick one of the intermediate goals and head there first before heading to the center of the map. Combining this with the above approach of increasing the costs might look pretty good? What approaches have people found work best to getting the AI to vary the paths they take, look convincing and surprising?


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?


Logic that can traverse all possible layouts, but not checking every combination of identical pieces? Suppose we have a grid of arbitrary size, which is filled by blocks of various widths and heights. There are many 2x2 blocks (meaning they take a total of 4 cells in the grid) and many 3x3 blocks, as well as some 5x4, 4x5, 2x3, etc. I was hoping I could set up a program that would look at all possible layouts, and rank them, and find the best one. Simply it would look at all possible positions of these blocks, and see what setup is the best rank. (the rank based on how many of these can be connected by a roadway system of 1x1 road blocks, and how many squares can be left empty after this is done. wanting to fit the most blocks as possible with the least roads.) My question, is how should I traverse all the possibilities? I could take all the blocks and try them one at a time, but since all 2x2 blocks are equal, and there are a couple dozen of them, there is no point in trying every combination there, as in the following AA BBB AA BBB CCBBB CCEEE DD EEE DD EEE is exactly the same as CC EEE CC EEE AAEEE AABBB DD BBB DD BBB You notice that there are 2 3x3 blocks and 3 2x2 blocks in my two examples. Based on the model I have now, the computer would try both of these combinations, as well as many others. The problem is that it is going to try every single possible variation of my couple dozen 2x2 blocks. And that is sorely inefficient. Is there a reasonable way to take out this duplicated work, somehow getting the computer program to treat all 2x2 blocks as equal identical, instead of one requiring rearranging swapping of these identical blocks? Can this be done? My current pseudo code blocks array of all blocks 2x2, 2x2, 2x2, 3x3, 3x3 iterate(0) function iterate(i) currentblock blocks i for each possible position of currentblocks see if there are any more blocks to place, and if there are iterate(i 1) else all blocks are placed, so get the rank if the rank is better than thebestrank thebestrank rank thebestposition position at this point, we proceed with thebestposition.


AI system recommendations for a Hive mind system Im currently starting to work on a game project where a player will be faced against an enemy which has a hive mind. I was wondering if anyone could recommend an A.I system which I could use as at the moment I am thinking about using Finite State Machines(FSM) and I think that if I use FSM's that it will get messy. Just to clear up what will be part of the "Hive Mind" if anyone was wondering will be Hive Leader Soldiers Workers Under each of these categories there will be roughly 2 3 different sub categories which will have to have slightly modified FSM's dependent on their abilities. Thanks for any response


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.


How should a hive AI distribute tasks between worker drones? I've been studying AI design mdash things like behavior trees and FSMs. They make sense from the perspective of deciding a specific entity's goal and action. However, the AI in my game is very hive like multiple drones share the same knowledge and desires. What a particular drone can do is unimportant, as each can do any task. Instead, it's a question of which drone would be the best choice for a particular task, given the list of tasks to be done. For example The AI decides it wants a particular resource type gathered. Different resource types are available at various locations across the map. Which drone should it send to gather the resource? All are capable, but some might be further away from the resource. Some might already be gathering a different resource. Some might be performing tasks that the player is actively waiting on, or that strongly affect the player's success. To decide, the AI would need to evaluate various factors and continually re evaluate as the game progresses, without stepping on it's own toes and continually reassigning jobs to the same drones. Is there a field of AI suited to this sort of task distribution that I can look into?


Should enemies still attack if they cannot see the player? This may seem like a silly question, but let me explain this further. Consider a common stealth situation where the player is hidden from the enemy AI. The AI has vision and hearing and if they either see or hear the player they will move towards the player's last known position. However if the player is behind cover (therefore the enemy cannot see them) and they attack with a silent weapon (therefore the enemy cannot hear them either), how should the enemy react? Realistically, the enemy should have an idea of the direction from which the attack struck them and therefore start moving in that direction. But I am wondering if this then would be detrimental to taking a stealth as oppose to offensive approach. If the enemy turns around when hit irrespective of whether they were hit with a loud or silent weapon, there is little benefit to using a silent weapon, since the loud ones will have more power anyway. On the other hand, if the enemy simply stands their while being hit several times by a silent pistol, it may make the AI seem a little stupid. I suppose it comes down to balancing between rewarding stealth gameplay in a stealth game, but not making the AI seem silly at the same time. What should I do to balance this?


Behavior Trees Actions That Take Longer Than One Tick From what I understand on Behavior Trees, each Behavior should be a short goal oriented Action that could be done in a few iterations. So for example, below is an image of a Behavior Tree Now let us assume that the Drive To Enemy behavior takes more than a few iterations in the tree. So on each pass Drive To Enemy is called because it is now in the running state. The problem is I want to call Evade Enemy if an Enemy is nearby. And considering that Drive To Enemy is always called I never get a chance to call Evade Enemy (Should probably be called Avoid Enemy). Should I traverse the Tree EACH pass no matter what Action is currently running? Am I going about this the right way? What is the proper way of handling such a behavior? Originally asked on Stackoverflow. Thought here would be a more appropriate place to ask this question.


Space Invaders type game Keeping the enemies aligned with each other as they turn around? OK, so here's the lowdown of the problem I'm trying to solve. I'm developing a game in PyGame that's a cross between Space Invaders and Columns. I'm trying to make the motion of the enemies similar to that of the aliens in Space Invaders that is, they're all clustered in a grid, and if even one hits the side of the screen, the entire formation moves down and turns around. However, the motion of these aliens is continuous (as continuous as a monitor can be, anyway), not on a discrete grid like in the original. The enemies are instances of an Enemy class, and in turn they're held by a 2D array in a enemysquadron module (which, if you don't use Python, is in this case essentially a singleton due to the way Python modules work). Inside the Enemy class I have a class scope velocity vector that is reversed every time an Enemy object touches the edge of the screen. This won't do, though, because as time goes on the enemies just become disorganized and jumbled (i.e. not in a grid as planned). I haven't implemented the Enemies going downward yet, so let's not worry about that right now. Any tips?


Strategies for monster targeting AI in a turn based combat system I am making a Final Fantasy style battle system. I have a random generator that select the monsters move when it is their turn different moves have different chances to be performed. I also have reactions and conditional actions for the monster to create simulated intelligence... but what I can't figure out is targeting. I could just choose randomly between the five player characters, but I was looking for something that would make the game more challenging by adding some kind of strategy to the monsters' actions. I code in C . Does anyone have an idea how to implement a system for the monster to choose who to attack besides completely random?


Component Entity based design Behavior Trees how to integrate? For my current project I implemented a component entity based system, basically following most of the best practice there is in this rather undefined area. So I got (slightly extended) Entities, which are basically an int ID, a human readable Name, a std map of components and a long "type indicator" which is used to show what components are present (I have an power of two enum for all the components types and whenever a component is added to the Entity, I automatically alter that long via bitwise operations, compare this answer). Then there are the Components, also rather simple int ID, enum as component type, parent Entity pointer and a std map of all properties this component holds. Lastly some Systems Managers that handle the actual logic processing. They first check if the currently processed Entity has a matching long "type indicator" all necessary components for that system are present. It then accesses some properties if needed and either directly calls some functions in the respective component or send some messages (via a message dispatcher). Bottom line Until here, a rather standard event driven component entity based system combined with a data driven approach (compare, components do not have hard coded data variables, but instead a generic map, as (some) components archetypes of components will later be read from files with the option to add additional data, that is not part of the actual component code. Now I would like to also introduce Behavior Trees (based on AiGameDev BTSK) into that project, but I am not sure if and how they should be linked to the already existing components or how to integrate those design in general. Several related ideas points questions come to mind My BTs will be read from files (again). I currently have a hard time seeing how I would however best make the connection between an BT Action in that tree and the actual coding in my application. Should I build up some sort of map between the action names used in the BT files and a function pointer to the actual logic implementation? What is the usual approach to solve that? I assume that I will have to create BTs for all my different Entity types (so for each game logic AI relevant combination of components as indicated by my multiple times mentioned long "type indicator"). As a result it doesn't make sense to put the BT Action implementations in the components as most likely many components will be involved per action, does it? So should the BT Action logic sit in a multiple separate systems (to whose methods the map from idea 1 points to)? The system would then check per my long "type indicator" whether the Entity for which the BT is currently checked and that was told to execute a certain action ( method in the system) is actually allowed to do so ( has the necessary components). But then, if not (because for example the BT creator did overlook a specific situation, where a necessary component might not be attached to the Entity at runtime anymore), nothing would happen. Questions Are there proven concepts for that kind of integration? What is your take on my 3 points above? Any other things that come to mind, also regarding my component entity based design in general?


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.


Strategic AI in turnbased games? I'm interested in how strategic AI engines work, e.g. how to evaluate where to place troops in a turnbased strategy game etc. I do get how goal based AI works, and I guess that is a good approach to decide what to build or research in a game like Civilization. But tactical strategical positioning of troops units. What algorithms strategies are used to evaluate those things? any reference papers articles?


Can I speed up "potential fields" pathfinding when it's working on a large grid? I'm looking to implement a pathfinding algorithm that will allow me to throw hundreds of spiders at the players in my grid based game. I can implement this with A , but I'm worried that that algorithm has too high of a "per spider" performance cost. The "potential fields" approach looks really good to me, but my map is quite large and rebuilding the entire potential field sounds expensive (even on a background thread). Unfortunately, there's no logical divisions on my map where I could separate the grid into smaller grids. And the map is quite dynamic (walls bridges can be destroyed, which could have huge impacts on pathing). Are there any options other than reducing the size of the map?


Monster's AI in an Action RPG I'm developing an action rpg with some University colleagues. We've gotton to the monsters' AI design and we would like to implement a sort of "utility based AI" so we have a "thinker" that assigns a numeric value on all the monster's decisions and we choose the highest (or the most appropriate, depending on monster's iq) and assign it in the monster's collection of decisions (like a goal driven design pattern) . One solution we found is to write a mathematical formula for each decision, with all the important parameters for evaluation (so for a spell decision we might have mp,distance from player, player's hp etc). This formula also has coefficients representing some of monster's behaviour (in this way we can alterate formulas by changing coefficients). I've also read how "fuzzy logic" works I was fascinated by it and by the many ways of expansion it has. I was wondering how we could use this technique to give our AI more semplicity, as in create evaluations with fuzzy rules such as IF player far AND mp high AND hp high THEN very Desiderable (for a spell having an high casting time and consume high mp) and then 'defuzz' it. In this way it's also simple to create a monster behaviour by creating ad hoc rules for every monster's IQ category. But is it correct using fuzzy logic in a game with many parameters like an rpg? Is there a way of merging these two techniques? Are there better AI design techniques for evaluating monster's chooses?


Most efficient way to recalculate enemy A path on the fly? I'm working on implementing a more robust pathfinding algorithm for the enemies in my top down shooter game, and I have the A algorithm working, but now I need to decide when to calculate the path. There are a couple situations where the path will be calculated already The enemy sees the player. The enemy hears a sound. I figure that I'll have the enemy continually recalculate their path to make sure they're aiming at the player and not just wandering off to the last path goal even after the player has moved. I also plan to have them initially only head to the last sound they heard or the last place they sighted the player if the player is no longer visible, and only continue pathing if they sight the player again or hear a new noise. However, while they actively have the player in their sights and are charging toward him, how should I determine when to recalculate their path? I have a couple ideas already, but I'm not sure which would be most efficient, or if there's a better way. Using grid coordinates corresponding to the map tiles, if the player moves 1 or more grid squares away from his initial position, determined by calculating (x2 x1) 2 (y2 y1) 2. If this way is efficient enough, should each enemy be doing this calculation in their update step? Or should there be some sort of "notify" implementation (this would be a good amount more work because I don't have any kind of signal slot pattern set up). If the sum of the X and Y offsets of the enemy's grid coordinates compared to the player's coordinates are getting bigger, recalculate. Anyone have any ideas? A isn't exactly a cheap operation, so I want to limit the amount of recalculating I'm doing, especially if there are a good deal of enemies in the map.


Pattern for performing game actions Is there a generally accepted pattern for performing various actions within a game? A way a player can perform actions and also that an AI might perform actions, such as move, attack, self destruct, etc. I currently have an abstract BaseAction which uses .NET generics to specify the different objects that get returned by the various actions. This is all implemented in a pattern similar to the Command, where each action is responsible for itself and does all that it needs. My reasoning for being abstract is so that I may have a single ActionHandler, and AI can just queue up different action implementing the baseAction. And the reason it is generic is so that the different actions can return result information relevant to the action (as different actions can have totally different outcomes in the game), along with some common beforeAction and afterAction implementations. So... is there a more accepted way of doing this, or does this sound alright?


Efficient way of training a chabot AI I am currently working on a chatbot game using Python 2.7.10. I use the Chatterbot library. This library seems to do all I need but the training data (or corpora) are very very limited. I haven't quite decided what the game is going to be like. I was thinking of doing something where the bot contacts you on behalf of a assassinated police inspector and asks you to help it solve the case. But I am still at the stage where I am experimenting what can and can't be done using a chatbot. An alternative to this game would be a simple "guess who" kind of game. I had a look online expecting to find a lot of every day conversation chat logs especially made for training chat bots. But I could only find a few logs of quiet random conversion (mostly on programming). I thought of using plays and film scripts but that requires a lot of editing. What recommendations would you have. I basically need strings lists in which each string is a response to the previous one. I can also train pairs of question answer.


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?