_id
int64
0
49
text
stringlengths
71
4.19k
28
Is A efficient even when the obstacles are moving? I'm just starting to learn about path finding and have been looking into the A algorithm and my main concern is that it all of the examples I have seen show static obstacles that it computes around. If I have moving obstacles, say other characters for example, moving around as well that the character must find their way around, I'm assuming I'll have to run the algorithm each frame, but I'm worried that will become rather expensive for the hardware to process each frame for each moving actor. So is A still efficient enough to use whenever the obstacles are moving too, or is there another method of path finding that handles moving obstacles more eloquently?
28
Is there an equation to determine when to invoke extrapolation in response to lag? I've implemented interpolation to smooth character drawing in my networked game. But now I want to fall back on extrapolation if too much time has passed from a user sending an update and the interpolation buffer has been used up. I'm just wondering if there is an equation that suites the following If it has been X since this user's last update, extrapolate the user position using the current time. That determines the optimal amount of time for X. I could try lots of different things like "we have surpassed the standard deviation of the last 100 moves a constant", but I'm convinced there has to be an optimal strategy for deciding when we need to extrapolate. Surely this is a solved problem, is my thinking. I've searched thoroughly but have found nothing. Also, for reference, I'm interpolating and extrapolating on the client.
28
How do I generate a smooth random horizontal 2D tunnel? I'd like to create a smoother version of the navigable and quite natural looking random tunnel found in this classic helicopter game. It should ideally be... infinite, so more can be generated as the player progresses parametrised, allowing control of its thickness over time made of smooth curves, not rectangles as in the above game precomputable, as knowing its bounds in advance allows collision detection for e.g. positioning powerups inside the tunnel. I'm looking for a generic method I could implement myself. Further parameters and optimizations are welcome. Asking here was suggested on StackOverflow. I think this fits in both places, as it's as much about the algorithm as about gamedev.
28
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.
28
Issue with implemented Minesweeper algorithm So I'm attempting to learn Python by way of Minesweeper. I've got experience with SDL, so I figured playing around with PyGame sounded like a fun way to learn the syntax of the language. Anywho, I'm having an issue in uncovering adjacent open squares as you would in a normal game of Minesweeper. I click on a cell with 0 neighboring mines, and attempt to scan the top, left, right, and bottom to see if those also have 0 neighboring mines, and I do this recursively. Here is the error that I receive RuntimeError maximum recursion depth exceeded in cmp And here is my algorithm open up blank mines def open blank cells(mines, cr, cc) top if (cr gt 0) t mine mines cr 1 cc t mine.switch state(3) if (t mine.neighbor mines 0) open blank cells(mines, cr 1, cc) right if (cc lt 9) r mine mines cr cc 1 r mine.switch state(3) if (r mine.neighbor mines 0) open blank cells(mines, cr, cc 1) bottom if (cr lt 9) r mine mines cr 1 cc r mine.switch state(3) if (r mine.neighbor mines 0) open blank cells(mines, cr 1, cc) left if (cc gt 0) l mine mines cr cc 1 l mine.switch state(3) if (l mine.neighbor mines 0) open blank cells(mines, cr, cc 1) return where mines is my 2D array of cells, cr is the index of the current row (first array index), and cc is the index of the current column (second array index). I thought that my algorithm was decently solid (but please tell me if I'm wrong there!!!), so I turned to the Internet and found that the default Python recursion limit of 1000 could be to blame. However, when I bump it higher with the call to sys.setrecursionlimit the game either exhibits the same behavior, or simply crashes as the system kills it. When I comment out 2 of the 4 recursive checks in the function, it will open up blank cells without any problem. 3 or more however breaks the algorithm. Edit As requested.... Calculation of neighbor mines if not a mine, figure out how many surround it for i in xrange(10) for j in xrange(10) if (mines i j .is mine False) check top 3 if (i gt 0) if (j gt 0) if (mines i 1 j 1 .is mine True) mines i j .neighbor mines 1 if (mines i 1 j .is mine True) mines i j .neighbor mines 1 if (j lt 9) if (mines i 1 j 1 .is mine True) mines i j .neighbor mines 1 check left and right if (j gt 0) if (mines i j 1 .is mine True) mines i j .neighbor mines 1 if (j lt 9) if (mines i j 1 .is mine True) mines i j .neighbor mines 1 check bottom 3 if (i lt 9) if (j gt 0) if (mines i 1 j 1 .is mine True) mines i j .neighbor mines 1 if (mines i 1 j .is mine True) mines i j .neighbor mines 1 if (j lt 9) if (mines i 1 j 1 .is mine True) mines i j .neighbor mines 1 Switch state def switch state(self, newstate) self.state newstate marked as mine if (newstate 1) nf "sq mine marked.png" elif (newstate 2) nf "sq mine question.png" elif (newstate 3) nf "sq mine open.png" elif (newstate 4) nf "sq mine mine.png" else nf "sq mine.png" oldrect self.rect save old rect as load image overwrites it self.image, self.rect load image(nf, (255,0,255)) self.rect oldrect
28
How can I create a random "world" in a tile engine? I am designing a game that is working on a classic tile engine, but whose world is generated randomly. Are there existing games or algorithms that do this? The procedural generation algorithms I have found are never using a tile system... What would be the best way to generate a whole "world" using a tile system? I am not talking about mazes of blocks, but an overall "world map" thanks
28
How to do score systems, combos, multipliers, chains, etc I am designing a game, but I am having some trouble implementing a decent score system. Basically I have nodes with two different possible characteristics color and shape. Since the player click from node to node, I want to award more points to the players which hit the same shape, same color or both, like (SAME SHAPE x 3! AWESOME!, SAME SHAPE AND COLOR x 5! ARE YOU A WIZARD?!). However I am having a lot of trouble implementing this. Can someone point me in the right direction or show me algorithms that can do this?
28
Creating random path in grid I need to find a path with required length in the NxN matrix without loops and deadlocks. For example We Have a grid 7x7 (49 blocks in total) with START (orange) point. We need to build random path length of 25 cells. etc My problem is I don't know how to create the path with required length fast and avoid loops and deadlocks.
28
How to correct shooting in touch screen shooting games? Assume a shooting game for iPhone that the character shoot toward where player has touched. But as we know, There may be fault in touching screen by player and it conclude to bad game play and low fun. So, How can I correct shooting method ?
28
Path finding avoid being surrounded by enemies I'm building a bot that plays a simplified version of Pac Man. The bot does a pretty good job, but sometimes it chooses a path where it ends up surrounded by enemies. Here is an example XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX Legend xxxxO1 E1 xxxxPE1 XXXX XXXXXXXXXXX XXXX XXXXXXXXXXX O Objective E2 P O2 E2 E3 O2 P Player XXXXXXXX XXXXXXX XXXXXXXX XXXXXXX E Enemy XXXXXXXX XXXXXXX XXXXXXXX XXXXXXX X Wall XXXXXXXXE3XXXXXX XXXXXXXX XXXXXXX x Wall In this situation, my bot is at the point of no return. It will choose to move to and pick up objective one (O1), as it is the closest objective in sight, and in theory is still a safe path. However, in doing so, enemies will surround him and he will die. (Map on the right). I'm trying to come up with ideas on how to make my bot avoid that path, and go for a safer one. The bot should determine if completing the current path (to O1) is a good idea or not, in advance, and make a decision. How would I go about this? I'm using a simple A for path finding over a grid.
28
The best algorithm enhancing alpha beta? I'm studying AI. My teacher gave us source code of a chess like game and asked us to enhance it. My exercise is to improve the alpha beta algorithm implementing in that game. The programmer already uses transposition tables, MTD(f) with alpha beta memory (MTD(f) is the best algorithm I know by far). So is there any better algorithm to enhance alpha beta search or a good way to implement MTD(f) in coding a game?
28
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?
28
What is the fastest way to know if the current coordinate in screen space is odd or even in GLSL GLES2 frag shader? I want to make a post effect where every second column of pixels is colored differently, and I want to implement this as a GLSL fragment shader on GLES2. The question is what is the most effective way to know if a fragment is indeed odd or even in the x direction? My current ideas revolve around the following three approaches 1. Integer bit wise operator Pseudo code bool even w ((int)(viewport pixels width screenspace x)) amp 1 gt 0 2. Sinus Pseudo code float evenness w (sin(viewport pixels width screenspace x M PI) 1.0) 0.5 3. Texture Pseudo code bool even w lookupFromMyRepeating2x1CheckerTexture(viewport pixels width screenspace x) All ideas and feedback are welcome!
28
Backtracking in A Star Hello, can anyone tell me how can i implement backtracking in a a star search algorithm? I've implemented the a star search according to wiki, but it does not backtrack, what i mean by backtrack is that if the open list(green cells) contains 2,0 and 3,3 as shown in the picture, upon reaching 2,0 the current node would "jump" to 3,3 since the cost is now more than 3,3 and continue the search from there, how can it be done so that it would backtrack from 2,0 2,1 2,2... all the way back to 3,3 and continue?
28
How do I make something I flash blink more frequently as it gets closer to disappearing? In my game when you kill an enemy they may drop something like a health pack or gold. I want this to have a time limit so that it eventually disappears if you don't pick it up. I want the item to flash more frequently the closer the drop gets to "death". How do you do the "more frequently flashing" algorithm?
28
Algorithm for generating levels for shooting game I have a shooting game made in Java. It's based on time, i.e you have to shoot the objects before the time runs out. Everything is working fine, except that I'm trying to implement an algorithm to generate levels. I implemented one that increases the number of game objects and increase their speed, but I don't know how to give the player an appropriate time based on these factors to provide an appropriate challenge for the player.
28
Retro game development how did 8 bit computers store large level maps and build a screen from them? Not sure whether this would be better in the retro computing exchange, but I'm trying in game development first. During the 80s I played a lot of what would now be called "arcade adventures" on the BBC Micro games like Citadel, Camelot, Jet Set Willy, etc. Jet Set Willy could support 64 rooms, Citadel had over 100. Presumably, some form of encoding was used to compress the maps to fit in the limited storage space that these machines had, but does anyone have any information on how these games actually managed to cram screen layout and object types and locations into this limited space, then decode these into a tilemap and game objects?
28
What kind of hardware would be required to render an Earth sized minecraft like map? I have been thinking about this problem. Is it possible with current technology to create a 1 1 replica of the earth in voxel based game? What's the best data structure to store this giant map? Which algorithm should be used to render this data structure in real time? These questions make these assumptions Each voxel has a resolution of 1 cubic meter. For simplicity sake, each voxel requires only 1 byte of metadata information. This information will be used to store the identify the "type" of the voxel (earth, water, rock, etc). The earth volume is 1 10 21 cubic meters. By "current technology" I include anything that is commercially available, but not super computers. Only the Earth topography and bathymetry will be used to generate the map. Human building, plants or caves are excluded. The underground blocks will be chosen based on geological studies e.g. if depth is greater than 3000km render a 'magma' voxel. Just like in Minecraft, the map is not static, it can be modified in game. A 'infinite' draw distance is a big plus, what's the point of having the whole earth in a map if you can't fly up and watch the whole planet? The first conclusion that I came when I thought about this problem is that storing the Earth data in a linear way is infeasible, assuming that each voxel occupies only 1 byte of memory this would still require 1 zettabyte to store the map. So some kind of compression is required. I think that a voxel octree could compress the map, but I am not sure by how much. The entropy of this voxel map is probably very low, so I guess that a very high level of compression can be achieved. Disclaimer This is a theoretical question, I have no intentions of writing a voxel earth EDIT The ESA GOCE has already mapped the Earth geoid with a 1cm 2cm precision. I believe that this information could be used to generate a very precise heightmap of the Earth. This would exclude the need to use an algorithm to fill gaps in the Earth topography.
28
Given a grid system where some coordinates are marked as impassable, how to find natural looking car driving path between two locations? I can compute an A path, but I get only cardinal directions from that. A 45 path would look like "up 1 left 1 up 1 left 1 up 1 left 1..." My specific question is, given a grid with a pathing solution involving non 90 paths, how do you figure out those paths? I have curves working as described here https gamedev.stackexchange.com a 121016 66189 but I just don't know how to combine it with areas that block the path. I've seen a little bit about "pulling the string", but very little detail. Another issue I have is that A will suggest that I immediately go "backwards" for the facing of my car or take way too sharp of a turn. edit How do I make sure I get the blue line, not the red line, which is unusable, even though A loves it The issue I'm seeing here is that a block that isn't usable on the red path is usable for the blue path but A would mark it as unusable or as having a very bad score when checking the red path.
28
Algorithm for making sets in a Rummikub game I'm developing an Okey game (a Turkish version of Rummikub Rummy). In it, each players has a bunch of tiles. Tiles have a colour and a number, like playing cards. Now, the player needs to make sets of these tiles, with three options Groups Same number, different colours (Red 1, Blue 1, Black 1) Straights Same colour, sequence of numbers (Red 1, Red 2, Red 3) Doubles Two identical tiles I'm now trying to create a simple AI for the game. I want it to be able to find and create sets in from its own tiles. I already have a TileSet class. Feed it a list of tiles and it will say whether it's a valid set and of what type. Using this, what kind of algorithm can I use to find the sets in an unordered heap of tiles?
28
Comparing two tree structures I'm having a hard time trying to describe this in correct terms so I will just give as much detail as possible and hopefully someone knows what I'm trying to do ) I am trying to compare two node trees to determine how similar different they are structure wise. In my diagrams below, both examples have the same number of children, grandchildren, etc. In example 1, Root has a child with two children, but in example two, root does not. I could probably figure out how to recursively loop through and count how many of each level there are and compare that, giving me an idea of how similar the trees are, but only doing it that way, it will look like they are identical, but in fact they aren't. Anyone happen to know about this? Or even what the technical term for what this is? Edit Also, this is in C and I am using Lists to store these objects and their children. Example 1 Example 2
28
GA Genetic Algorithm for Enemy So I'm starting a project which aims to make a good AI for my game monsters. So far I have set up the GA and got some results. There's two genes, with one chromosome each. The monster either 'attacks on sight' or 'flee on sight' depending on the gene it got. The fitness function is based upon time alive and the crossover is just eliminating the worst gene. As expected the 'flee on sight' gene got better result. What I'm here to ask is what are some good uses of GA in developing AI. Which genes chromosome fitnessfunction crossover should I implement in order to have a challenging AI. The game is a rogue like, it's still pretty simple, not much added, so I can make the game around the GA instead of the other way around. This may be a too broad question, but bear in mind that I don't have any experience in gamedev and AI as a whole. EDIT To make this question a bit more narrow. Since my fitness function is just 'survive' it's quite obvious that all the enemy generations would get better at fleeing. So, What should I put in consideration to a good fitness function. Damage to the player is also quite one way solver, a monster healer which doesn't have any attack power would drop his staff and punch the player. The perfect fitness function for me should translate to 'make the player struggle', but I don't know what that would mean in the game terms, and specially code terms.
28
Locate the shortest path through obstacles when all normal paths are blocked I'm making a Tower Defense and I have basic pathfinding working, but I got a problem. I want to make the path blockable, and when a block occurs the runners will attack the blocking towers. So what I need is a way to find the shortest path that, more importantly, has the lowest number of towers in the way. How do I do that?
28
Integrating specular, diffuse reflection and refraction I am implementing an MLT bidirectional path tracer. I have a problem integrating diffuse, specular reflection and refraction. 1) The first problem is diffuse and specular reflection. Diffuse reflection is done by sampling ray in a hemishere. But specular reflection is done by finding the ray that have an angle to the normal equal to the incident ray with the normal. However, an object can have both diffuse and specular reflection. When to use specular reflection or diffuse reflection for a ray? 2) Same as the first question but this time integrating reflection with refraction. I've seen a few research papers and websites online where the scene have specular, diffuse reflection and refraction, but they have no tutorial on how to do this.
28
Smooth path direct movement I have a tile based isometric map and an A algorithm that returns a path. I am looking to smooth this path efficiently but with good aesthetics. Basically i am using my grid for building the map and pathfinding but i want the player, enemies and certain types of objects to be detached from this grid. I can think of a line of sight implementation where i start at the first tile of the path, from there check each further tile if i have a clear path straight to it. And repeat from there.
28
Implementing recoil in a realistic and balanced way? To clarify, I've seen this post already I really like the idea that the chosen answer suggests, yet when I go to implement it the recoil still doesn't "feel" right. The problem is mainly the fact that I'm moving the crosshair instantly to a new location and it feels quite jerky when playing around with it. I think that in order to properly implement recoil I need to move the crosshair more than once over multiple game ticks. I think the main issue is that many games with realistic recoil "auto re aim" (if you will) the gun as part of the recoil algorithm. This is from my experiences with various Source Engine games like Garry's Mod and Counter Strike. My best way of describing what I see and thinking about how it is implemented is that a point is chosen with a variance (usually up and slightly right) from the fire coordinates. The gun follows a sort of parabolic path (height depending on velocity of recoil) and eventually gets to the new point. I'm getting kind of long winded but I hope most of what I said makes sense. Should I attempt to model the recoil implementation in the Source Engine? How would you go about implementing a realistic recoil algorithm? Are there any open source fps game engines that may be able to provide some inspiration?
28
How to optimize against wealth loss? The wealth system in d20 Modern always gives me a slight headache at character creation, because I know there's a better way to buy things, but I don't know exactly how, so I'm coming up with an algorithm to automatically buy things in the correct order to minimize losses, sticking it in a program, and just stop thinking about the whole thing. Help if you can, pls. Algorithm Wealth is your Wealth Bonus, and DC is the Purchase DC of the item on the list. is greater than, lt is less than, is greater than or equal to, and lt is less than or equal to Wealth is a random value generated at the beginning (let's say 1 to 100), and the list of items purchased can contain up to 25 items of equally random purchase DCs. Just in case that's relevant. In the link above, it mentions things like 1d6 and 2d6. In the format xdy, x number of dice rolled, and y number of sides each dice have. So 2d6 would generate a number from 2 to 12. 1d6 would generate one from 1 to 6. Run the following through all items in the list first, since if the following conditions are met, the item is free, but might not remain free if you lose wealth If DC lt 15 and (Wealth DC) 0 Purchase item Then, determine if there are items on the list that would jump up a tier if you lost 1 wealth (So, if Wealth DC 10 or 15) Don't check for Wealth DC 0, because it should have already been bought if it was. If there isn't, then purchase an item with DC 15 and (Wealth DC) 0 Repeat that until there are either no more items fitting the conditions, or until you are on the verge of jumping up a tier. (I haven't figured out how to optimize against tier jumping. I'm inclined to immediately buy anything that might tip over in to 16 territory, and abandon anything that ends up there. If there are none, then prioritize any in the threat of going over a tier, and abandon any that might go in to the 16 territory. There's some way to better formulate around these tiers, but it's rather mind racking, and frustrating that I can't seem to figure it out!.) Repeat the last process (that I actually outlined), but determining if items would jump up a tier if you lost 2 wealth If there isn't, then purchase an item with DC 15 and (Wealth DC) lt 0 and (Wealth DC) 11 (I have no idea where in the queue I should put this, but I just felt like this would be the lowest priority purchase.) If an item comes with a restriction of 2 or greater (and you only care about the wealth you have at the end), then, unless the black market adjustment pushes the item over a tier, take the black market because you don't lose as much wealth that way. If it's only 1, then take the license unless you have 9 wealth or less, in which case obey the previous rule on restriction.
28
How to do placeable electricity cables that work like the ones in "Prison Architect" I would like to know one (of the probably many) ways to code a (sort of) Prison Architect ish electricity cable building system. Here's a picture of what I mean How can I detect that cables are connected? How can I detect if the block it's connected to is a power source? And these 2 (above) will all be placed inside a dictionary when they are placed. That dictionary does not yet have a key type, but the second type is a sprite. How should I do this?
28
Trying to understand the range of Improved Perlin noise I've been implementing Improved Perlin Noise for a small library I'm writing. Everything was hunky dory when it was just in the 3rd dimension, but I recently expanded to the 1st, 2nd, and 4th dimension, which is where things started get weird. I originally thought that the range of Improved Perlin was 1.0. When I implemented the 1st dimension version, I noticed that the unmodified range was 0.5, ie, you had to multiply the result by 2, but figured nothing of it. 2nd dimension worked just like 3rd, with both working within the 1.0 range. Then when I got to 4th, I ran a large number of samples and saw that I was getting results outside the 1.0 to 1.0 range. I started Googling, and apparently the 1.0 range is a common misconception? The solution I've read in a couple places, which is 1 2(sqrt(N)), where N is the number of dimensions, implies the following ranges for dimensions 1 through 4 0.5, 0.71, 0.87, 1, respectively However, the only version I have which matches this is the 1st dimension, which as I said, works out to 0.5 before multiplying by 2. For dimensions 2 and 3, I get 1.0 without any need to modify the result, and for the 4th dimension, I believe my results are actually in the range of the 6th dimension according to that solution. The following is my code https pastebin.com CpAi3PUF And for those who aren't familiar, it's Cython, so yes, a weird Frankenstein of Python and C. I use the following code to test the ranges of each dimension https pastebin.com yUpw1Z00 Since my method involves just running tons of random inputs over and over, I did run this test a few times to make sure the results are consistent, which they are, and here is an example of the output DIM1 Minimum 0.999999999999943 Maximum 0.9999999999871175 Average 0.0003455999808678627 DIM2 Minimum 0.9999515602331069 Maximum 0.999900249691747 Average 0.00011840974404335401 DIM3 Minimum 0.9932063986908607 Maximum 0.9931959744642007 Average 0.00010701170753012655 DIM4 Minimum 1.0576886515898196 Maximum 1.123720946368049 Average 0.00022555631399532482 You can clearly see that as my code is written, dimensions 1 through 3 have a limit of 1.0, and then with the 4So clearly there is some contradiction between the alleged result ranges, and the code I'm implementing. The 3rd and 4th dimensions were implemented straight from Perlin's own example code. 3rd Dimension https mrl.nyu.edu perlin noise 4th dimension https mrl.nyu.edu perlin noise ImprovedNoise4D.java The only major changes I've made to the implementation are in the grad functions, where I use what is essentially a switch case, rather than Perlin's fancy pants (but extremely expensive) bitshifting method. But afaik doing so is functionally equivalent. Can anyone provide some insight as to what is going on? What is causing the difference between the supposed expected ranges, and my actual results? And what can I do to get the 4th dimension "in shape", like how modifying the 1st dimension is required? Thanks so much for any help.
28
Smart terrain generation to avoid unconnected tiles To make this clear from the get go I'm not looking for HOW To randomly generate a terrain (I know I can use Perlins noise for that). I'm looking for an algorithm that can help with the terrain generation. Example Me and my friend are working on a flash game to be use as advertisement for an upcoming game (And to see if theres actually interest for the base game). And I've been working on randomly making terrains, however! When i generate the map, i have no idea how to make it so it connects properly. The map is isometric and tilebased and after its been generated we're going to litter chest traps and other gameplay elements on the map. However, theres no reason to put an item on a piece of that map thats not connected to the rest of the map.. Or worse yet, spawn a player on a tile thats unconnected to anything. Does anyone know of a algorithm that helps with stuff like this? Thanks in advance people. Etarnalazure EDIT What I'm looking for is an algorithm that makes sure theres no unconnected tiles, thus no items or players may by accident get seperated from the rest of the walk able tiles. Hopefully this clears up what i mean.
28
Weighted random events with conditions I'm building a system for distributing ingame events for a strategy game. The game is heavily driven by the events and each country player should receive one or more per time unit. The algorithm is similar to the "The Soft coded Probabilities Solution" from this question How do I create a weighted collection and then pick a random element from it? The main differences are I need conditions for if events can happen or not, like only triggers if unrest is above 2 or if you are at war etc. Maybe half the events will have conditions (but this may change over time as more are added while the algorithm probably won't). I need a mechanism to prevent the same event repeating for the same player in too short a time period. This applies to some events but not all. It seems that no matter how I go about this I have to do either a lot of condition checking in advance to maintain my list(s) or a lot of iteration over events that are anyway not selectable. So is this algorithm still a good choice to build upon in this case or should I be looking elsewhere?
28
How can I divide a grid map into clusters for path finding algorithm? I am trying to implement HPA algorithm for finding the shortest path between two point. I came across the paper Near Optimal Path Finding Algorithm (by Botea, M ller amp Schaeffer) but I am stuck at the clustering part. I have a 2 dimensional array and each index in the array is a node. Could anyone help me clustering my 2 dimensional array into clusters?
28
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.
28
Is a recursive game object update better than a linear one? I have a tree of gameobjects, so every node contains a list of children. In update function Is it better to do recursive or linear walking through game objects. update() update self foreach child call update recursive call or array of children root.getAllChildrenRecursive foreach child in array of children call update linear walking through gameobjects.
28
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?
28
Looking for a square to hex pixel coords algorithm So as the headline suggests, I am looking for an algorithm algorithms used for square to hex and hex to square pixel coordinates convertion. I have an image which looks kinda "interpolated", meaning some pixels are of one colour, while some have a slightly different shade etc. So pixel colour kinda stores offset or whatever. If you're interested, it's here It has to do with pathfinding, the logical part of map is made of hexmap while the visual part of map is made of squares. Here, size of the square 1 pixel, same hex size is equal to 1 pixel. So basically I will be trying to convert an image with hex pixel coords to image with square pixel coords and vise versa. I'm sorry if this was answered already somewhere, I couldn't find it anywhere. P.S. I reverse engineered the image, so in binary it was only X and Y coords stored plus a third byte value which I took as a greyscale colour (later compared with another image and it matched) Image
28
Giving a Bomberman AI intelligent bomb placement I'm trying to implement an AI algorithm for Bomberman. Currently I have a working but not very smart rudimentary implementation (the current AI is overzealous in placing bombs). This is the first AI I've ever tried implementing and I'm a bit stuck. The more sophisticated algorithms I have in mind (the ones that I expect to make better decisions) are too convoluted to be good solutions. What general tips do you have for implementing a Bomberman AI? Are there radically different approaches for making the bot either more defensive or offensive? Edit Current algorithm My current algorithm goes something like this (pseudo code) 1) Try to place a bomb and then find a cell that is safe from all the bombs, including the one that you just placed. To find that cell, iterate over the four directions if you can find any safe divergent cell and reach it in time (eg. if the direction is up or down, look for a cell that is found to the left or right of this path), then it's safe to place a bomb and move in that direction. 2) If you can't find and safe divergent cells, try NOT placing a bomb and look again. This time you'll only need to look for a safe cell in only one direction (you don't have to diverge from it). 3) If you still can't find a safe cell, don't do anything. for (direction) in (up, down, left, right) place bomb at current location if (can find and reach divergent safe cell in current (direction)) bomb true move (direction) return for (direction) in (up, down, left, right) do not place bomb at current location if (any safe cell in the current (direction)) bomb false move (direction) return else bomb false move stay put This algorithm makes the bot very trigger happy (it'll place bombs very frequently). It doesn't kill itself, but it does have a habit of making itself vulnerable by going into dead ends where it can be blocked and killed by the other players. Do you have any suggestions on how I might improve this algorithm? Or maybe I should try something completely different? One of the problems with this algorithm is that it tends to leave the bot with very few (frequently just one) safe cells on which it can stand. This is because the bot leaves a trail of bombs behind it, as long as it doesn't kill itself. However, leaving a trail of bombs behind leaves few places where you can hide. If one of the other players or bots decide to place a bomb somewhere near you, it often happens that you have no place to hide and you die. I need a better way to decide when to place bombs.
28
Determine if a set of tiles on a grid forms an enclosed shape Given a set of tiles on a grid, I want to determine If the tiles make an enclosed figure If the tiles make an enclosed figure when you count the sides of the board as an edge of the figure If either of the previous two statements are true, which additional tiles fall inside the enclosed figure the initial tiles form. The player will begin by pressing down on one tile, then dragging their finger to other tiles to create a chain of same colored tiles. I will check as I go to see if the next tile is valid. Ex. If the player begins on a red tile, their only next valid move is to an adjacent red tile (diagonals do count). When the user lifts their finger, I need to be able to check for the 3 items above. So my initial thought was that, since I was checking for the validity of the chain each time I went, when the player lifted their finger I could check if the first and last tiles were adjacent. (I already know they're the same color.) If they were adjacent I had a hunch that I'd made an enclosed figure, and I was going to come here to try and see if I was missing something big, and to get some kind of logical mathematical proof that my hunch was correct (or an example proving it incorrect.) But that's when I thought of item number 2 I also have to account for chains which use an edge of the board as a side of the enclosed figure. In that case, the first and last items in the chain would not be adjacent, but I would still have an enclosed figure. So now I'm back to square one, a bit. What can I do with this chain of grid coordinates to figure out if they make an enclosed figure or not? And once I do know I have an enclosed figure, what's the best way to get an additional list of all tiles that fall inside its bounds? Above I've drawn pictures of what I expect the 4 possible results of this test can be. The chain does not make an enclosed figure. The chain does make an enclosed figure. If you count the sides of the board as an edge (or more than one edge) of the figure, the chain does make an enclosed figure. The chain does make an enclosed figure, but there are extra data points (validly selected by the user as part of the chain) which are not a part of the figure that is created. Case 4 is the trickiest, because you'd have to extract the "extra" chain links to find the enclosed figure and the pieces that fall inside it (but not around the "unenclosed" area). So... Anyone have an idea of a good way to solve this, or just a starting point for me? I'm kind of going in circles at this point and could use another set of eyes.
28
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?
28
Realistic slow falling snow algorithm? Is there a good algorithm that simulates falling snow? I'm particularly interested in snow that falls slowly, so it doesn't quite fall in a straight line but deviates a bit. Maybe even including simulation of flurries (drafts of wind), variable size, etc. Are there any papers or articles on an algorithm that mimics real life snow movements or simulates it in the context of a game? I'm particularly interested in a 2D algorithm, but I imagine any algorithm can be taken to 3D easily.
28
Find a line that connects the outer most points in a set of points Does anyone know an efficient algorithm to find the edge of a point cloud? Hopefully the picture in the link can illustrate what I mean. It's a plus if the algorithm can handle point clouds that are distinctly separated in space. The algorithm only needs to work in 2D. Many thanks!! http uploadpic.org storage 2011 4n68m1OYLSYIGt8vfuJrK1LnA.png
28
Performance issues with visibility detection and object transparency I'm working on a 3d game that has a view similar to classic isometric games (diablo, etc.). One of the things I'm trying to implement is the effect of turning walls transparent when the player walks behind them. By itself this is not a huge issue, but I'm having trouble determining which walls should be transparent exactly. I can't use a circle or square mask. There are a lot of cases where the wall piece at the same (relative) position has different visibility depending on the surrounding area. With the help of a friend I came up with this algorithm Create a grid around the player that contains a lot of "visibility points" (my game is semi tile based so I create one point for every tile on the grid) the size of the square's side is close to the radius where I make objects transparent. I found 6x6 to be a good value, so that's 36 visibility points total. For every visibility point on the grid, check if that point is in the player's line of sight. For every visibility point that is in the LOS, cast a ray from the camera to that point and mark all objects the ray hits as transparent. This algorithm works not perfectly, but only requires some tuning however this is very slow. As you can see, it requries 36 ray casts minimum, but most of the time 60 70 depending on the position. That's simply too much for the CPU. Is there a better way to do this? I'm using Unity 3D but I'm not looking for an engine specific solution.
28
How do I map a 2D grid to my game object coordinates? I'm using Gameplay3d as a game engine to develop a simple board game, PEG Solitaire. I've come to the part where I've created a 2D grid for all the movable object, empty locations and also where it's not movable. I'm now trying to somehow map that 2D grid to my actual game coordinates, translations of my pieces. Using Gameplay I can select my objects. What I'm trying to figure out is how to solve this actual problem to map my grid to the actual movement of the game pieces? I was maybe thinking of using an std map lt char , int gt where "char " is the NodeID and "int" is the index in the 2D grid list so that I can identify each Node and where they are in my 2D grid. The problem I'm having now is how can I solve the problem if the user select places on my board that doesn't have moveable piece. Let's say the user clicks on an empty hole on the PEG Solitaire board. How can I map that location to my 2D Grid? I've created my board model and Sphere using Blender. I can using Gameplay use raypicking and select the differente Sphere Nodes and the whole Board Node. The problem is that I can't pick the individual holes on the Board as Nodes. I know the center position of each hole on the board. So my solution was to somehow first figure out the Spheres world size maybe translate it to the screen size. When the user then clicks on the screen I can check if the position of x and y is inside the selection area of that hole so to say. I'm probably just wondering away in my own thought. But any detailed help here would be appreciated. Get object world size and translate to screen size of possible. The 2D grid looks like this 0022200 0022200 2222222 2221222 2222222 0022200 0022200
28
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.
28
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?
28
How can I make A finish faster when the destination is impassable? I am making a simple tile based 2D game, which uses the A ("A star") pathfinding algorithm. I've got all working right, but I have a performance problem with the search. Simply put, when I click an impassable tile, the algorithm apparently goes through the entire map to find a route to the impassable tile even if I'm standing next to it. How can I circumvent this? I guess I could reduce the pathfinding to the screen area, but maybe I am missing something obvious here?
28
Which is faster raycasting or shadowcasting? I'm looking to create an FoV implementation and I was wondering which algorithm is faster raycasting or shadowcasting?
28
Action oriented AI evasion algorithm takes much time Evasion, the process of evading, is the opposite of chasing. Instead of trying to decrease the distance to the target we try to maximize it. It takes much time while evading multiple objects simultaneously. I use BFS here. To make it faster what algorithms should I use?
28
In a grid based system, where users can build their own walls to create buildings, how do you determine which parts are indoors? I've looked around for an algorithm to solve this problem, but I can't seem to find anything. In a game I am working on, data is held in a grid. Certain squares within that grid can be set as walls, so that the user can create buildings. What I am wondering is how could I write an algorithm to determine which parts of the grid were indoors, that is to say, within a building, and which parts are outdoors. Thank you in advance for any advice.
28
How to generate point based on a map I am making a multiplayer game in Unity, with a socket.io server in NodeJS. I am using a globe, with a texture to represent the world in Unity. Let's say something similar do this. Now, there I am stuck with some algorithm. I would like to generate equally distant point, on the lands, where user can build stuff. Something similar to this I saw this post here post and I would like to generate the map in the server, create from the generate map a mongoDB collection of point. When a user connect, he get back a list of point (that are already generated and can interact with those). I get stuck on the generation. How do I make the server generate point based on a map that I will show to client, but that the server do not have idea of ? How would I store the coordinate position, so that the server generate them, and the client no matter the scale of the map would be able to display them at the good point ? Basically, I don't know where to start to make this algorithm. I just would like some idea on how you would achieve this, so I can inspire myself to find my solution.
28
Make character following another What's a solid way to have a character stuck to another one? I have a moving character (say followed) and I want a second one (say follower) to follow the first without chance of getting stuck into obstacles. I thought that I could save every delta velocity vector of the followed and having the follower consuming one each frame after it reached its target's starting position. More to say, dynamic obstacles could be an issue. Since this sounds to me like a common topic (despite the fact that I'm having difficulties in finding answers), is there anyone who could enlighten me on a proper way of facing the issue? Edit Since I'd like to describe something more like to an edge case of a pathfinding algorithm, consider the following follower should always be at a fixed position related to followed follower must not necessarily interact with the environment the way followed does
28
How can I optimize this flood fill algorithm? I'm creating a sprite and animation editor like this one. I'm having performance issues with my flood fill algorithm. Basically, I open an image with the different modules that are part of a frame of an animation. When I double click a module I run a depth first search algorithm that checks all the pixels of that part of the image that are surrounded by transparency. From that I get the rectangle of said module (the position and size). With large images, when I double click that part of the image the application freezes. How can I improve my algorithm? Right now what I do is maintain an array of already checked pixels and a list of pixels to check. I start with the pixel that I double clicked and check if the surrounding pixels have transparency. If they do not, I check for the surrounding pixels of those pixels and so on until all the surrounding pixels are transparent. Then I can get the minimum and maximum position in the X axis and Y axis and use that to construct the bounding rectangle of the frame. This is my code private Rectangle widthSearch(int posX, int posY) Rectangle result new Rectangle() int leftX, topY, rightX, botY leftX rightX posX topY botY posY List lt Point gt closedList new List lt Point gt () List lt Point gt toProcessList new List lt Point gt () Point processingNode Color colorAux int alphaAux int offsetX 0 int offsetY 0 toProcessList.Add(new Point(posX, posY)) int dx 1, 1, 0, 1, 1, 1, 0, 1 int dy 0, 1, 1, 1, 0, 1, 1, 1 while (toProcessList.Count gt 0) processingNode toProcessList.ElementAt(0) closedList.Add(processingNode) toProcessList.Remove(toProcessList.ElementAt(0)) for (int i 0 i lt dx.Count() i ) offsetX dx i offsetY dy i try if (!closedListContains(closedList, processingNode.X offsetX, processingNode.Y offsetY) amp amp !closedListContains(toProcessList, processingNode.X offsetX, processingNode.Y offsetY)) colorAux bmp.GetPixel(processingNode.X offsetX, processingNode.Y offsetY) alphaAux (colorAux.ToArgb() gt gt 24) amp 0xFF if (alphaAux gt 0) toProcessList.Add(new Point(processingNode.X offsetX, processingNode.Y offsetY)) catch (Exception e) Console.Write(" gt gt gt gt gt gt gt gt n" e " n gt gt gt gt gt gt gt gt gt ") for (int i 0 i lt closedList.Count() i ) if (closedList.ElementAt(i).X gt rightX) rightX (int)closedList.ElementAt(i).X if (closedList.ElementAt(i).X lt leftX) leftX (int)closedList.ElementAt(i).X if (closedList.ElementAt(i).Y lt topY) topY (int)closedList.ElementAt(i).Y if (closedList.ElementAt(i).Y gt botY) botY (int)closedList.ElementAt(i).Y result.X leftX result.Y topY result.Width rightX leftX result.Height botY topY return result private Boolean closedListContains(List lt Point gt closedList, int posX, int posY) Point pointer new Point(posX, posY) for (int i 0 i lt closedList.Count() i ) if (closedList.ElementAt(i).Equals(pointer)) return true return false I only call the widthSearch() method when I double click a PictureBox. It is not inside a loop.
28
3D pathing finding with flying Does anyone know of a (free or paid) solution that enables 3D path finding? Basically something like CalculateRoute(input geometry, start pos, end pos, variance) I found a good paper on the topic, but I haven't found any solutions via Google or even searching sites like odesk, etc... I know recast detour is great for ground navigation, but I can't find anything that involves flying 3D space. Any suggestions would be great to existing solutions.
28
Square collision Detect which side of the wall it collided I'm using a standard square collision in my 2D game. The player shoots little balls, and when they hit any wall it should bounce. The problem is that I know when it hits a wall but I don't know if the collision happened on the side or top bottom of the wall. Here's my collision algorithm (pseudo code) If A.x lt (B.x B.width) AND B.x lt (A.x A.width) AND A.y lt (B.y B.height) AND B.y lt (A.y A.height) Then a collision happened Is it easy to detect if the collision happened on a side or top bottom? If yes how should I do it?
28
How are loot box labels positioned? Take this screenshot for example How exactly are they positioned perfectly adjacent to each other? Do they already create the label positions based upon the world map first, and then when the player drops an item it fills the space? Or do they use a simple padded array function server side and some custom algorithm to position them right next to each other. I have a feeling I'm totally overthinking this. I am using nodejs w the Phaser framework for my web based game and am stuck at how they accomplish this server side. (Since all players in game see the same exact position)
28
Procedurally generating dungeons using predefined rooms Most attempts at procedurally generating dungeons I have stumbled upon do space out areas that will be rooms and connect them will corridors and hallways but what about instances where you have a collection of possible rooms in various dimensions and want to generate a dungeon that uses some of these specific rooms without those corridors and connections? To answer this question I found this particular video on the topic of generating levels in Path of Exile ( 5 20 7 20 about the dungeon part I am referring to) which left questions open on how to technically implement the algorithm described. In general I understand the idea but I am struggling to figure out how this would be translated into code (most efficiently) and therefore here are a few questions When he shows how the entire level is sliced up I could not come up with a graph that would allow to represent this structure. My naive approach would be to have the entire level consist of 1x1 rooms and arbitrarily merge nodes in the graph to form rooms of valid dimensions (valid there is a predefined room that can be inserted there later on). What would be a suggested approach to this? Coloring the rooms should be just assigning random distances (in a given interval) to edges of connected nodes and just applying Dijkstra to find the sequence of rooms from start to finish I presume? When he adds branching rooms I noticed that they do not allow another alternative path to the exit (which could be random of course) but how would one implement the branching? Just a recursive traversal with diminishing chances of continuing deeper into the graph? Description of the algorithm in the video Step 1. Place a start and end room arbitrarily into the level (presumably with a given minimum distance to prevent degenerate layouts) Step 2. Slice the entire level into areas that have exactly the sizes of your predefined rooms Step 3. Assign each room a random weighting distance which is depicted with colors in this example Step 4. Find a shortest path to get a nonlinear path from start to end Step 5. You have your basic layout with a single successful path in which you can place random rooms of corresponding sizes that have to be connected with appropriate doors Step 6. Finally, add some branching rooms
28
Car (or other "object") acceleration and braking how to? I'm not good in math so I'm here to ask you how to manage, in a simple 2d game, the car acceleration and braking. I'm trying to develop it (as a hobby) in c and sdl.net.
28
Smoothing found path on grid I implemented several approaches such as A and Potential fields for my tower defense game. But I want smooth paths, first I tried to find path on very small grid ( 5x5 pixels per tile) but it is extremly slow. I found nice video showing an RTS demo where paths are found on big grid but units dont move from each cell's center to center. How do I implement such behavior? Some examples would be great.
28
Pathfinding with portals? I'm not making a game with portals in it (one way or bidirectional). These portals instantly teleport characters from one location to another. How would I implement pathfinding? Here's an animation showing the portals in action, and different paths taken http www.makeitshareit.com animation 86137 How do I perform pathfinding whilst taking in the possibility of using the portals as shortcuts? If I just use A , the portals may wreak havoc with the admissibility requirement. How can I also make it reasonably efficient, such as avoiding quadratic complexity with respect to the number of portals?
28
How do I optimize searching for the nearest point? For a little project of mine I'm trying to implement a space colonization algorithm in order to grow trees. The current implementation of this algorithm works fine. But I have to optimize the whole thing in order to make it generate faster. I work with 1 to 300K of random attraction points to generate one tree, and it takes a lot of time to compute and compare distances between attraction points and tree node in order to keep only the closest treenode for an attraction point. So I was wondering if some solutions exist (I know they must exist) in order to avoid the time loss looping on each tree node for each attraction point to find the closest... and so on until the tree is finished.
28
Pathfinding with inertia I'm currently working for pathfinding for a game where units are moving, but they have inertia. Most typical pathfinding algorithms (A , Djikastra, etc.) are simply designed to minimize the length of the path. However, these techniques do not apply, as far as I know, to instances where the unit has inertia. If the unit has inertia, then there is a significant difference in the cost to leave a tile in a particular direction based on the direction you want to go. For example, the cost of leaving a tile proceeding North is significantly higher if you entered the tile from the East than if you entered from the South. (In the former example, you would have to slow down to halt you East West velocity, while in the latter, you could go straight through.) The fact that the system has inertia means that in order to make a turn, you may have to slow down well in advance of making the turn. My best thought to date is that you calculate the additional time it would take to slow down, and then add it to the heuristic cost of moving. However, this would seem to imply that you could never add a tile to the closed list, as entering from another direction could fundamentally change the cost of moving. In addition, the concept of using a grid is an abstraction anyway, because both position and velocity are floating point concepts. Is there some algorithm that could handle pathfinding on an open plane with inertia better than A , or what modifications could I make to a pre existing algorithm to make it suitable to this kind of motion?
28
Movement algorithm for Pocket Civ game I am developing a Pocket Civ game engine. (You can check the process at www.pocketciv.com). Basically there is maximum of 8 Areas (round nodes in the pic) that have Tribes (number inside the node). So area 3 has three tribes and area 5 has two tribes. There is basic movement rules see page 7 and then the movement rules change after new advances are acquired. There is only one movement phase and you can move the tribes in any order you want. Basic A single tribe can cross a border once (by land) Advancement You can move a stack of tribes across the sea at the cost of 1 tribe (so every tribe in the stack then crosses a border) Advancement A single tribe can cross a border two times Advancement A single tribe can cross any number of borders (crossing the sea still costs one tribe) Advancement When you move the stack across the sea, it doesn't cost anything Essentially, if you have the last two advancements you can move any tribes anywhere you like. The naive way to implement this would be to track what tribes are moved where when user moves them. But this is hard for the user (for example if you move one tribe 3 5 and one tribe 5 3 you have not moved anything. My approach is to let the user move tribes around and always check if the given situation is valid. For example valid end situations from above starting point are (shown as list area1, area2, area3, area4, area5 0, 0, 3, 0, 2 (no movement at all, also the starting point) 0, 0, 3, 1, 1 (5 4) 0, 0, 0, 5, 0 (5 4, 3 4) 0, 0, 5, 0, 0 (5 3) 0, 0, 2, 2, 1 (5 4, 3 4) ... etc I have implemented some kind of way to check if the proposed situation is valid. It gets hard when we take the sea movement cost into account. We would need to know what is the cheapest way to make the movement and recognize when tribes moved over the sea. For this I would need all the permutations about what tribes moved where. For example if we have starting position 0, 0, 3, 2, 0 3, 0, 2, 0, 0 (3 s 1, 4 3) would cost 1 tribe at minimum 2, 2, 1, 0, 0 (3 s 1, 3 s 2) would cost 2 tribes at minimum Can anyone help me phrase this problem or say what would be the correct algorithm to find that the proposed situation is valid and what is the minimum cost. Is this a graph problem? Can this be solved with matrices? I have studied Prolog a little but haven't managed to get anything usable out of it. I can tell my implementation later but I would like a "clean table" view of this problem.
28
How do I find out if this particular puzzle can still be solved? A while ago, I made a simple game that involved swapping birds to combine them and release them to create points. The idea is that eventually, the birds would get stuck and your game is over, but I found it tremendously hard to think of a way to detect a game over, so I published it without such an algorithm and just hoped people would see it for themselves. However, I'm still very interested in a solution and hoped someone could help me. The game works as follows 6 different kinds of birds are distributed over an n x n (usually 4 x 4) grid. For every two birds of the same type, if they would form a perfect rectangle together, they merge into one bigger bird of the same type. This means you can have birds that are, for example, 4 x 1 or 3 x 2. Birds that are big enough can be removed from the grid, generating points. What's 'big enough' depends on the type of bird, some only need to cover 1 square on the grid, others 2 or 3. Empty squares on the grid will get filled up with new, random birds falling from above. That is, of course, as long as other birds don't block the way. All birds always fall down when they can, and moving a bird upwards is therefore impossible (though, swapping upwards is allowed). Two birds can swap places if they are of the same width when swapping vertically, or of the same height when swapping horizontally, but only when they are aligned perfectly. A bird can always move to an empty spot, given that its new position would be large enough to contain it and that the new spot wouldn't deny gravity. Eventually, groups of 2 tall wide birds will prevent anymore progress. Some birds can still be swapped, and maybe some would even become big enough to be removed when combined with certain others, but they will never get near each other, resulting in a game over. I'm not too sure whether this is clear enough. I don't really want to post a link to the game here because I'm really only interested in the algorithm, not new downloads. Also I'm not too sure if I'm allowed to, as it could be seen as an advertisement. But please request more clarity where needed!
28
Smoothing found path on grid I implemented several approaches such as A and Potential fields for my tower defense game. But I want smooth paths, first I tried to find path on very small grid ( 5x5 pixels per tile) but it is extremly slow. I found nice video showing an RTS demo where paths are found on big grid but units dont move from each cell's center to center. How do I implement such behavior? Some examples would be great.
28
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?
28
Algorithm for game difficulty pacing curve generation in single player RPG I'm looking at this article about pacing in entertainment and games. It suggests that all good entertainment roughly follows a pacing engagement curve like Star Wars(below). I'm interested in how I can procedurally generate random looking curve that would conform to the Star Wars engagement intensity pattern (linear increase and oscillating peaks valleys). The simplest implementation I can think of is a rectified sine wave and a sloped line, but that would be very predictable. I have an algorithm for perlin noise already in the game and am interested if I can leverage perlin noise algorithm to procedurally generate a varying sequence of peaks and valleys on an increasing slope. Here's my attempt so far Once I have an algorithm, I can reference it to get engagement difficulty in relation to game turn or progress through some level. I will add my thoughts to this question in hopes that someone can correct or point out flaws in my approach below I get the basic XP system in place (previous level 1000 to advance to next level) Decide on the level cap (lets say 20 levels) Plot available equipment tiers vs 20 levels (regular at lvl 1, magical at lvl 10, epic at lvl 20) Using the peak valley graph decide how many fights are in each peak valley cycle (5 to reach lvl 2, 12 to reach lvl 20). estimate number of turns per fight, let's say 5 turns per fight calculate xp needed and turns needed to reach to each new level Plot turn number and hypothetical xp the party has at each level. Now for each peak I have a number of turns and the amount of XP that the curve should have between two valleys. Using whatever formula the curve follows at that peak (let's assume a bell curve), I can get the xp value of monsters I have to spawn during that turn. These monsters have their equipment adjusted according to the equipment vs tier turn number that was calculated above. Now I need to adjust monster XP and test it at different levels. A simple sanity check a party of 6 players must kill 750 xp of monsters in first fight in 5 turns, that is 30 actions. 1500 in second fight 1800 in third fight 1350 in fourth 555 in fifth
28
How can I adapt "random walk" generation to very large maps? The random (or drunkard's) walk is a great, simple algorithm that can generate very organic looking maps, such as this Unfortunately it seems to have poor scalability, making it unsuitable for generating large maps in a reasonable amount of time. For example, a test I performed looking at how many iterations are required to generate a desired range for a 1D random walk yielded what looked like quadratic complexity Range Iterations 10 81 100 7309 1000 585352 10000 30656784 For higher dimension walks I imagine this would be even worse. How can improve the efficiency of random walk, whilst preserving the overall look of the result, for large maps? I'm hoping for a solution with sub quadratic complexity.
28
Decomposing a collision grid into a set of boxes I'm looking for a decent algorithm to decompose a collision grid (e.g. bool w,h )... ...into a non overlapping set of boxes (e.g. List lt Rectangle gt ). The solution does not have to be the best all the time, as long as it is simplified enough (otherwise I would just create one box per tile).
28
Render rivers in a grid I have created a random height map and now i want to create rivers. I've made an algorithm based on a to make rivers flow from peaks to sea and now i'm in the quest of figuring out an elegant algorithm to render them. It's a 2D, square, mapgrid. The cells which the river pases has a simple integer value with this form rivernumber amp amp pointOrder. Ie 10, 11, 12, 13, 14, 15, 16...1 N for the first river, 20,21,22,23...2 N for the second, etc. This is created in the map grid generation time and it's executed just once, when the world is generated. I wanted to treat each river as a vector, but there is a problem, if the same river has branches (because i put some noise to generate branches), i can not just connect the points in order. The second alternative is to generate a complex algorithm where analizes each point, checks if the next is not a branch, if so trigger another algorithm that take care of the branch then returns to the main river, etc. Very complex and inelegant. Perhaps there is a solution in the world generation algorithm or in the river rendering algorithm that is commonly used in these cases and i'm not aware of. Any tips? Thanks!!
28
Algorithm for random flight of a fly I'm new to game development. What is a good algorithm to model the random flight of a fly? I've been looking at path finding algorithms, but they don't give any interesting random behaviour.
28
How can I fill the interior of a closed loop on a tile map? In my game the player can dynamically modify terrain. The map is stored within a 2D array of prefabricated 3D objects. This is working well for now. The player modifies terrain by selecting what sort of tile they'd like to create (like cliff going up or down), and then clicking individual tiles, or "painting" over multiple by holding down mouse button and scrolling. I don't want the player to have to manually click every tile they want to rise or fall in elevation. The most elegant solution I can conceive, is for the player to "paint" a loop of cliff tiles, which is then filled in automatically when the loop closes. Imagine, perhaps, someone drawing a line using MS Paint or Photoshop, until that line closes into a shape which then autofills. Let's say the player wants a plateau, and so they select cliff going up, and then click and drag the desired shape. Upon closing the loop, when the last cliff tile is created beside the first cliff tile, witchcraft is invoked which fills the inside. I have no idea how this can be done, never mind elegantly or optimally. There are obvious possible solutions (find the average vector of all tiles in the loop, and then dijkstra algorithm from the average until the space is filled with the correct elevation), but these assume the shape generated is blobby or boxy. An irregular shape where the mid point falls outside of the shape is possible and would probably ruin that solution! How can I fill the inside of a closed loop? I'd like a theoretical solution I can go away and implement in C . At this point it seems like there is probably conceptual overlap between raster graphics and procedural maps!
28
How to model irregular boundary of a 2D map in Game? I am creating a map in a game, the map contains different countries, my question Q. How to model the irregular boundary of each countries? How to do quick country searching if I click on the map (given x,y values)?
28
AI parameters for Tetris like game I am building an AI to play a variation of Tetris. The rules are changed in that there are 19 different types of pieces, rotation is not allowed, and the pieces can be placed anywhere in a 10X10 grid. Also, a line is removed once it is full (all 10 cells contain some block). I was trying to figure out which parameters I might choose in order to optimise how the game is played. Some obvious parameters which I thought of a) A piece should be placed in a position where it forms the maximum number of full lines, as they can be removed in the next step. b) A piece should be placed to minimise the 'bumpiness' or roughness of the topmost surface, i.e, it should be as level as possible. c) This is arguable, but the AI should try to keep as minimum height as possible. d) The number of columns containing atleast one block should be minimised. But the AI is still not playing good enough and keeps getting stuck. I would like to know if there are some other important parameters which I may be missing?
28
How do modern game engines handle many shadow casting lights? This is a very general question, and not aimed at any particular language or graphics API I am more interested in the theories amp algorithms behind the solutions. I'm reasonably familiar with the basic idea behind shadow mapping Each spotlight and directional light requires a rendering pass to generate it's shadow map, and each point light requires 6 such passes, prior to any lighting calculations. Such a potentially large number of rendering passes could quite easily have a substantial negative impact on performance and texture bandwidth, so how do modern game engines deal with this problem, especially in the case with deferred rendering systems, where many lights are involved? Consider the following scenario A scene contains a reasonable amount of geometry, spread out over a "level". That level has a certain number (let's say 20, for brevity) stationary point lights dotted around the level. The player can place lights around the level too, and carries a torch (spotlight). The rendering system uses the deferred shading model, given the potentially high number of lights in the scene. How does the renderer decide which lights to render shadowmaps for? Of those lights, during the "light pass", how is that variable number of shadow maps handled dynamically, bearing in mind that they could be 2d textures (spots and directional), or cube maps (points)? Do graphics API's have the capability to support shaders with arrays of maps lights, or would the shadow maps require a single discrete lighting pass for each individual light?
28
Dynamic Tilemap size changer I have started coding this project using the library SFML a few months ago. I have implemented a random map generation everytime I load the game thanks to Biome and the Perlin noise Algorithm. I wish i could increase the TileMap size on the border of the map according to the player position (Chunk system in minecraft) . I have managed to do it on the bottom and the right of the map But this isn't dynamic. There is a snap of my code where i add a new "chunck" void TileMap AddChunckToTileSet(sf Vector2i PlayerTile, char direction) int previousWidth width int previousHeight height height height 24 width width 24 m vertices.resize( width height 4) int tileNumber 384 ToDO on en d duit sa position dans la texture du tileset int tu tileNumber (m tileset.getSize().x tileSize.x) int tv tileNumber (m tileset.getSize().x tileSize.x) if (direction "Down") for (int i previousWidth i lt width i) for (int j previousHeight j lt height j) on r cup re un pointeur vers le quad d finir dans le tableau de vertex sf Vertex quad amp m vertices (i j width) 4 on d finit ses quatre coins quad 0 .position sf Vector2f((i previousWidth) PlayerTile.x tileSize.x, j tileSize.y) quad 1 .position sf Vector2f(((i previousWidth) PlayerTile.x 1) tileSize.x, j tileSize.y) quad 2 .position sf Vector2f(((i previousWidth) PlayerTile.x 1) tileSize.x, (j 1) tileSize.y) quad 3 .position sf Vector2f((i previousWidth) PlayerTile.x tileSize.x, (j 1) tileSize.y) on d finit ses quatre coordonn es de texture quad 0 .texCoords sf Vector2f(tu tileSize.x, tv tileSize.y) quad 1 .texCoords sf Vector2f((tu 1) tileSize.x, tv tileSize.y) quad 2 .texCoords sf Vector2f((tu 1) tileSize.x, (tv 1) tileSize.y) quad 3 .texCoords sf Vector2f(tu tileSize.x, (tv 1) tileSize.y) I call the function AddChunckToTileSet like this void TileMap Update(sf Vector2i PlayerTile) if (PlayerTile.y 15 gt height) Increase map on Down according to our X printf("Add Chunck Down n") AddChunckToTileSet(PlayerTile, "Down") Do you have any hints on how I could achieve this correctly ?
28
How to implement A.I. for checkers draughts? I saw this checkers game and I wondered how the A.I. was implemented. How should I implement an A.I. for checkers (draughts, dama, dame)? Are there any known algorithms? Very thnaks full to all. I m very wonder to see this Tic Tac Toe game tutorial blog post. So, i want dama game algorithm open source code and blog post.. Is there any helpful link or any doc file..? please let me know..
28
How do I determine the draw order in an isometric view flash game? This is for a flash game, with isometric view. I need to know how to sort object so that there is no need for z buffer checking when drawing. This might seem easy but there is another restriction, a scene can have 10,000 objects so the algorithm needs to be run in less than O(n 2). All objects are rectangular boxes, and there are 3 4 objects moving in the scene. What's the best way to do this? UPDATE in each tile there is only object (I mean objects can not stack on top of each other). and we access to both map of Objects and Objects have their own position. UPDATE2 see these figures in first one first blue object should be drawn then green then red. while in second one you have to draw them in reverse order. you need to draw red first and then green and finally blue object. as you can see there is no difference in position of blue and red objects ,they both have different distance from camera and so on. but because of their relative position to green box, you need to change their draw order between two images. that's what makes this problem a mess. side note since all objects are rectangular prism, it's mathematically provable that there is at least one draw order to satisfy problem needs.
28
How do I calculate hex coordinates from a ring and index? I am trying to implement field of view (FOV) in a hex grid. I am using the cube coordinate system from here. Then, I am using shadow casting to find FOV as from here. I have a system like in the image, below. The numbers at the corners are coordinates. The numbers in the center are formatted as Ring index , Hex Index . I need to used both ring index and hex index to calculate angles used for shadow casting. I spent several days on it, but I still cannot find a way to make these two sets of numbers convertible. How do I calculate hex coordinates from a ring and index?
28
Is there a repository of game logic algorithms? I'm writing my first 2D game, and I'm writing some tracking logic for the computer enemies. Basic follow the player tracking was easy, but ineffectual. Too easy to escape. So I'm trying to implement some more sophisticated flanking and other tactics, and (as expected) it's pretty tricky. This is a topic I know nothing about. I'm going to keep trying, but it'd be awesome to have some examples or tips to work off of. Is there any place that has a decent set of pseudocode AI algorithms, or tips or advice on the subject, e.g. for 2D tracking?
28
Smooth path direct movement I have a tile based isometric map and an A algorithm that returns a path. I am looking to smooth this path efficiently but with good aesthetics. Basically i am using my grid for building the map and pathfinding but i want the player, enemies and certain types of objects to be detached from this grid. I can think of a line of sight implementation where i start at the first tile of the path, from there check each further tile if i have a clear path straight to it. And repeat from there.
28
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!
28
Where can I find info on grid based algorithms for stateless AI? There seems to be an overwhelming amount of info out there on AI of all kinds, and it's kind hard to digest at once. For my testing purposes, I'm creating a "typical stateless AI", as described in this article, and now I need to implement the following functions for a 2D square based game board (void)runAway (void)attackPlayer (void)moveTowardsPlayer (void)tacticalMoveAwayFromPlayer (void)waitOrStationaryAction For example, I can run my own run away function like this (void)runAway DLog( "runAway") self debugMessage int bestTileIndex 0 int largestDistance 0 int distance 0 if(validMoves.count gt 0) for(NSNumber tileNumber in validMoves) distance self distanceToTargetFromTile tileNumber.intValue if(distance gt largestDistance) largestDistance distance bestTileIndex tileNumber.intValue move to best tile but this method only checks the distance from 1 target, which may not be the best if there are multiple enemies on the game board. Where can I find good efficient implementations of algorithms for searching a 2D grid for these functions? For example finding a point that is furthest away from multiple opponents and is accessible within a certain number of moves. Other functions that come to mind is picking the best weakest target, moving towards a specific target while accounting for variable terrain cost, etc I'm certain someone has already done this before.
28
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.
28
What algorithm can I use to distribute energy between connected nodes? I'm creating a game where every user has a network of connected nodes that each have a specific amount of energy. The nodes will try to distribute energy evenly amongst themselves. If a node has more energy than the average, it should deliver to the network. If a node has less than the average, it should receive from the network. An example network would be this, where means more than average and means less than average Now the one question I've been trying to solve for a while now how can I calculate the cumulative amount of energy that flows through every edge until all nodes have the same amount of energy? For example we know that the node in the top left will in the end distribute 7 energy to the network, but will it give 5 down and 2 to the right? Or something else? Is there any algorithm we could use to solve that problem? Could we potentially represent this problem as an electric circuit and solve it like that?
28
Algorithm for creating adjacent triangles I have a system where you can click once to place a node in a scene. When you place 3 nodes, it forms a triangle. When you place any future nodes, it creates a new triangle by joining that node to the 2 nearest existing nodes. This works fine most of the time but is flawed when used near triangles with very acute angles, because one of the 2 nearest nodes is often not one that should be used. For example, see the image below. The magenta triangle is the first one placed. If I then click at the position marked X, what I get is a new triangle where the blue overlay is. What I want is a new triangle where the green overlay is. (ie. symmetrical to the magenta one, in this example. Clarification The green and magenta triangles don't overlap the green one extends under the blue one to the left most node) How can I determine which 2 existing vertices to use when creating new triangles so that triangles are not superimposed like this? EDIT Searching for the nearest edge gives better results, but not perfect ones. Consider this situation The 'nearest edge' test is ambiguous, and can return AB or AC (as the nearest point to X for both is at A). The desired result would be AC, to form the ACX triangle with no edges overlapping. How could I ensure this result? (I'd rather not have to perform individual edge overlap tests as a tie breaker if possible as I'm concerned that the nearest edge test won't necessarily spot the 2 are exactly equidistant, given floating point precision issues.)
28
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?
28
Algorithm to modify a color to make it less similar than background I'm creating a demo of 20 balls bouncing each other, with a background filled with a solid color. Color for each ball is chosen randomly with randint(0, 255) for each R, G, B tuple component. Problem is some balls end up with a color that is very similar to background, making them hard to see. I would like to avoid that, either by rolling another color if the chosen one is too similar (within a given threshold), or by moving it away from the background color. How to calculate a similarity index to use as a threshold? Or how to transform a color to make it, say, less blue ish? Obvious disclaimer I know nothing about color theory, so I don't know if the above concepts even exists! I'm coding in python, but I'm looking for concepts and strategies, so pseudo code is fine (or just the theory). EDIT To clarify a few points Each ball have its own random color. I'd like them to remain as random as possible, and to explore as much as possible of the color space (be it RGB or HSV, pygame accepts both formats for defining color) I'd just like to avoid each color of being "too close" to background. Problem is not just about hue I'm perfectly OK with a light blue ball against a dark blue background (or a "full blue" against a "white ish" blue, etc) For now, I don't care if a ball ends up with a color similar (or even identical) to another ball. Avoiding that is a bonus, but it's a minor issue. Background color is a constant, single RGB color. For now I'm using "basic" blue (0, 0, 255), but I'm not settled with that. So consider the background to be of an arbitrary color (with arbitrary hue, brightness, saturation, etc). EDIT2 TL,DR version Just give a way to create X random colors so that none "fades in too much" against a background of arbitrary (but single and constant) color
28
Algorithm to make entities closely follow one another? I have a group of entities that I want to follow a leader very closely. A good example would be how the player's soldiers move in Cannon Fodder. Any suggestions for achieving movement like this?
28
What is an efficient packing algorithm for packing rectangles into a polygon? I need to put as many rectangle of same size as possible inside a polygon. The algorithm can put rectangles in different orientation(angle). But they cannot overlap. This is image is an example of the end result
28
Finding shapes in 2D Array, then optimising I've just been allowed an image...The image below from my game shows some darkened blocks, which have been recognised as being part of a "T" shape. As can be seen, the code has darkened the blocks with the red spots, and not seen the "T" shapes with the green outlines. My code loops through x y, marks blocks as used, rotates the shape, repeats, changes colour, repeats. I have started trying to fix this checking with great trepidation. The current idea is to loop through the grid and make note of all pattern occurrences (NOT marking blocks as used), and putting these to an array loop through the grid again, this time noting which blocks are occupied by which patterns, and therefore which are occupied by multiple patterns. looping through the grid again, this time noting which patterns obstruct which patterns That much feels right... What do I do now? I think I would have to try various combinations of conflicting shapes, starting with those that obstruct the most other patterns first.How do I approach this one? use the rational that says I have 3 conflicting shapes occupying 8 blocks, and the shapes are 4 blocks each, therefore I can only have a maximum of two shapes. (I also intend to incorporate other shapes, and there will probably be score weighting which will need to be considered when going through the conflicting shapes, but that can be another day) I don't think it's a bin packing problem, but I'm not sure what to look for. Hope that makes sense, thanks for your help EDIT Despite clarity of question, everyone seems to have understood, yes, I want to find the maximum "T" shapes within each colour (because if I gave you points for two and you had made three, you'd be a bit annoyed)
28
How to do score systems, combos, multipliers, chains, etc I am designing a game, but I am having some trouble implementing a decent score system. Basically I have nodes with two different possible characteristics color and shape. Since the player click from node to node, I want to award more points to the players which hit the same shape, same color or both, like (SAME SHAPE x 3! AWESOME!, SAME SHAPE AND COLOR x 5! ARE YOU A WIZARD?!). However I am having a lot of trouble implementing this. Can someone point me in the right direction or show me algorithms that can do this?
28
Server side random selection of players Assuming I have a simple client server game, where the server picks random players on a very frequent base, I was wondering what is the best way to select a random player (According to the following constraints) Solution must be high performance and highly scalable Random spread should be relatively even (meaning if I have 3 players and pick 99 times, they will all be picked 33 times more or less) Should only pick players who were active in the past X days (optional, but a big bonus) The actual DB or data model used to store players isn't an issue here, as we'll select the technology in accordance to our needs. However, high performance and scalability is (at the moment we have over 60,000 unique daily active players, and we plan on growing even more). Thanks!
28
Match three puzzle games algorithm I am trying to write a match three puzzle game like 'call of Atlantis' myself. The most important algorithm is to find out all possible match three possibilities. Is there any open source projects that can be referenced? Or any keywords to the algorithm? I am trying to look for a faster algorithm to calculate all possibilities. Rules Diagonals don't count. The size is 8x8 Thanks.
28
How do I avoid "too" lucky unlucky streaks in random number generation? I'm currently dealing with a multiplayer combat system where the damage dealt by the players is always multiplied by a random factor between 0.8 and 1.2. In theory, a truly random RNG may eventually yield the same number many times (see the Tetris dilemma). This could result in a match where player is always making very high damage while the other always makes very low damage. What can I do to make sure this doesn't happen? Are some RNGs better than others at avoiding repetition?
28
Calculation Is a sphere square plane visible from a certain point? I'm searching for a way to detect if a form (shape can be changed if algorithm requires it) is visible from a single point in a 3D tile based world. This should be used as some kind of wall hack protection to hide players from the client if they are fully covered behind a wall. This does not have to be extremely precise. The only condition is that the algorithm never returns a false negative. Therefore I thought it might be the easiest choice to create a rather large sphere around each other player and peform visibly operations from the viewpoint to that that imaginary sphere. I'm planning to use this on larger maps and only if players are far away from each other. It wouldn't be a problem if you could see players that a behind a wall right next to you. Since I have no clue how the solution may look like I'm searching for a very abstract description of how such an algorithm works. I found this very similiar question Precomputing Visibility But I think this led me into the wrong direction since my main aspect ist speed rather than accurancy.
28
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!
28
How to make my Diamond Square algorithm less 'random'? I'm currently writing a world generator for a Tilemap Engine in C . But there is a little problem concerning the Water to Land ratio. My DiamondSquare class returns a field of random float values between 0 and 1, and my condition to let my tilemap class generate a Land Tile on the given spot, is that the returned value is bigger than 0.5. The problem is, that the amount of values bigger or smaller than 0.5 fluctuates with every call of my float field generation function, so that i often only have a few little Islands a few little lakes on my map. How could i manipulate my code, so that a 50 50 distibution is more likeley to happen? include "DiamondSquare.h" include lt Windows.h gt pragma comment (lib, "winmm.lib") floatfield typedef floatfield is std vector lt std vector lt float gt gt DiamondSquare generate(int n, float randomness) Initializing stuff srand(timeGetTime()) fieldSize pow(2,n) 1 randField.resize(fieldSize) for (int i 0 i lt fieldSize i ) randField i .resize(fieldSize) for (int j 0 j lt fieldSize j ) randField i j 0 stepDist pow(2, n 1) m randomness randomness Setting corner point values randField 0 0 (float)(rand() 1001) 1000 randField fieldSize 1 0 (float)(rand() 1001) 1000 randField 0 fieldSize 1 (float)(rand() 1001) 1000 randField fieldSize 1 fieldSize 1 (float)(rand() 1001) 1000 Core Algorithm for (int i 0 i lt n i ) for (int k 0 k lt pow(2,i) k ) for (int l 0 l lt pow(2,i) l ) Getting position of current tile int xPos k 2 stepDist stepDist int yPos l 2 stepDist stepDist Getting Average of sorrounding tiles randField xPos yPos (randField xPos stepDist yPos stepDist randField xPos stepDist yPos stepDist randField xPos stepDist yPos stepDist randField xPos stepDist yPos stepDist ) 4 Random displacement if (rand() 2 1) randField xPos yPos (float)(rand() 1001) 1000 pow(randomness,i 1) else randField xPos yPos (float)(rand() 1001) 1000 pow(randomness,i 1) Doing the same for the Square Step tiles left of and above the current tile squareAvg(xPos stepDist, yPos, i) squareAvg(xPos, yPos stepDist, i) If diamond step tile is part of the right side row if (k pow(2,i) 1) squareAvg(xPos stepDist, yPos, i) If diamond step tile is part of the bottom row if (l pow(2,i) 1) squareAvg(xPos, yPos stepDist, i) stepDist 2 Self explanatory return randField Return random field. ! Often, insted of maps like this, there is stuff like 10 water or 10 land 1 1 void DiamondSquare squareAvg(int x, int y, int i) Testing if square Tile lies at on of the sides of the map, if so, adding 0 (i tried implementing wrapping, but this option generated better looking landscapes) randField x y (x! 0) ? randField x stepDist y 0 randField x y (x! fieldSize 1) ? randField x stepDist y 0 randField x y (y! 0) ? randField x y stepDist 0 randField x y (y! fieldSize 1) ? randField x y stepDist 0 If 4 values were added 4, otherwise 3. if (x! 0 amp amp x! fieldSize 1 amp amp y! 0 amp amp y! fieldSize 1) randField x y 4 else randField x y 3 Displacement if (rand() 2 1) randField x y (float)(rand() 1001) 1000 pow(m randomness,i 1) else randField x y (float)(rand() 1001) 1000 pow(m randomness,i 1) Is it maybe even possible to preciseley control n lt 0.5 to n 0.5 ratio ? That would be ideal. I just don't know how and where to manipulate the code. That's about it.
28
Implementing recoil in a realistic and balanced way? To clarify, I've seen this post already I really like the idea that the chosen answer suggests, yet when I go to implement it the recoil still doesn't "feel" right. The problem is mainly the fact that I'm moving the crosshair instantly to a new location and it feels quite jerky when playing around with it. I think that in order to properly implement recoil I need to move the crosshair more than once over multiple game ticks. I think the main issue is that many games with realistic recoil "auto re aim" (if you will) the gun as part of the recoil algorithm. This is from my experiences with various Source Engine games like Garry's Mod and Counter Strike. My best way of describing what I see and thinking about how it is implemented is that a point is chosen with a variance (usually up and slightly right) from the fire coordinates. The gun follows a sort of parabolic path (height depending on velocity of recoil) and eventually gets to the new point. I'm getting kind of long winded but I hope most of what I said makes sense. Should I attempt to model the recoil implementation in the Source Engine? How would you go about implementing a realistic recoil algorithm? Are there any open source fps game engines that may be able to provide some inspiration?
28
Triangulating a partially triangulated mesh (2D) Referring to the above exhibits, this is the scenario I am working with starting with a planar graph (in my case, a 2D mesh) with a given triangulation, based on a certain criterion, the graph nodes are labeled as RED and BLACK. (A) a subgraph containing all the RED nodes (with edges between only the directly connected neighbours) is formed (note although this figure shows a tree forming, it may well happen that the subgraph contain loops) (B) Problem I need to quickly build a triangulation around the subgraph (e.g. as shown in figure C), but under the constraint that I have to keep the already present edges in the final result. Question Is there a fast way of achieving this given a partially triangulated mesh? Ideally, the complexity should be in the O(n) class. Some side remarks it would be nice for the triangulation algorithm to take into account a certain vertex priority when adding edges (e.g. it should always try to build a "1 ring" structure around the most important nodes first I can implement iteratively such a routine, but it's O(n 2) ). it would also be nice to reflect somehow the "hop distance" when adding edges add edges first between the nodes that were "closer" to each other given the start topology. Nevertheless, disregarding the remarks, is there an already known scenario similar to this one where a triangulation is built upon a partially given set of triangles edges?
28
Detect which object conceals another one I've searched for a while for a good solution and if I'd have found one I wouldn't be here. So there are the details I have been working on my 2D game using XNA, and I'm aware of the way XNA renders objects(If "a" was drawn after "b", it will draw "a" above "b"). In the game I'm making there's a character that is able to move left, right, up and down. I'm, using Rectangle's "Intersects" method, when the rectangle on the character is placed on his feet, to detect collision detection. I would also like the character to be able to move behind a house(Just like you can in real life, and the house will hide a part of the character that is hidden behind the house). So far, all the things that I've mentioned are accomplished. Now, I would like to hear how would you recommend detecting whether the character is standing in front of the house, and hiding the part of the house that his standing in front of, or whether the character is standing behind the house. I understand it might be a little hard to understand, therefore I added a picture that will simulate the situation. (No I'm not the one doing the drawing) Any help, advices, or criticism would be appreciated. Thanks ahead!