|
Post by Danjal on Jul 15, 2014 11:38:39 GMT
TNT is a lot better nowadays compared to in the early days of minecraft, the biggest problem was with some optimization issue or something. But even TNT only triggers block updates around it - triggering new block updates. Effectively like having a floating layer of gravel or sand, only instead of falling its the TNT igniting.
Passives/Neutrals aren't "Always loaded". While there are certain criteria that prevent entities from despawning (such as named creatures or creatures holding items or even passives like villagers), they aren't loaded unless there is a player nearby. The thing with Minecraft is that it only actively loads anything around a player (chunkloaders from mods "mimic" this as if there'd be a player there). But basicly, even though those villagers will be there even if you've gone far away, they aren't loaded unless you are actually there.
The last point is really simple. Peter doesn't measure his vision against what is possible. But instead goes off of what he'd like to happen. As such the promises he makes aren't tempered by practical knowledge of whether something is actually going to be easily achieved. And he'll make promises of things that *he* believes shouldn't be that hard to accomplish, but in reality are much more problematic. Its the very thing he keeps doing and joking about - he knows he does it, but he just laughs it off and keeps holding his creative vision as reality and truth. As if its merely a matter of time for them to get there.
|
|
|
Post by rubgish on Jul 15, 2014 13:59:13 GMT
With minecraft, it depends an awful lot on what kind of mods and things you are running. With some mods, chunks & NPCs will stay permanently loaded and always active.
Also it's not really the best idea to use minecraft as a comparison for performance, because it (at least in the past I haven't played/checked recently) was really pretty badly coded/optimised.
|
|
splitterwind
Master
Posts: 149
I don't like: Ignoring a unpleasant question or answering with something that is only loosely related or way to vague to actually answer something. Mods that Cherry-pick in discussions. Banning people for minor offenses.
|
Post by splitterwind on Jul 15, 2014 19:16:43 GMT
Yes, there are NPCs that stay at their position, but thats basically all they do. They do not actively do anything while you are far away. The game only has to remember the position of the NPCs (that doesn't really affect performance) and spawn them once you are next to them or in the same chunk. The NPCs do not interact with the world while you are far away. In a classic RTS or simulation however NPCs are constantly interacting with each other and the world. (for example shooting at close enemies, collecting resources, path-finding, transporting or building something, capturing something, getting hungry, patrolling ...) which also requires path-finding and scanning the nearby area which means that the computer/server has to be fully aware of it (keep it in memory). I think the TNT block might disagree with you Yes, there are a few exceptions. Complex redstone circuits would be another example but as you said yourself they and TNT can easily kill performance because of being such exceptions. You would never want such exceptions in a MMO. It would be terrible if player structures or actions could easily kill the server and there being only official servers (they would surely never allow player hosted servers as they want to make money via ingame-items). Also it's not really the best idea to use minecraft as a comparison for performance, because it (at least in the past I haven't played/checked recently) was really pretty badly coded/optimised. Well, endless voxel words that can be completely manipulated and have NPCs are performance heavy. I don't know many games that fulfill the criteria while at the same do much better in terms of performance than the current minecraft and more importantly aren't affected by the same compromises. Actually I can't think of any. But even if there are games with a 3D (voxel) world that offer endless or at least planet-sized worlds that are procedurally generated and can be completely manipulated by the player while at the same time being more performant than the current minecraft, they in all likelihood have the same compromises as minecraft. Or let's take a different approach. What were the biggest maps, player limit and unit limit in a realtime strategy/simulation game that wasn't like a browser game (NPCs could interact with each other or the world like collecting resources)? I think the most ambitious would be the currently developed planetary annihilation which offers planets however each planet is more like a map in a classic RTS and not even barely comparable to minecraft proportions / real planets. Yet alone massive multiplayer with thousands of players (I think PA only supports 8 or maybe even 16) or terraforming which affects wind and weather on top of that. And even more crazy erosion and dynamic water. And as if that wasn't ridiculous enough cross-plattform development with a mobile tablet. The claims peter made were absolutely lunatic, no matter which game you compare it with.
|
|
|
Post by rubgish on Jul 16, 2014 17:00:41 GMT
There is a significant difference between having a server that simply runs a large-scale world, and one that does the calculations for that world. Let us say for example, that with the Jupiter scale world, you download the portion that is local to you at any given point in time (and if you moved you continue to download as you go, this should be simple enough). Any action you then perform on this downloaded section is calculated entirely on your end, and any updates to the landscape or people or buildings or whatever is then uploaded to the main server.
What this means, is that all the server needs to be capable of is: A) Storing the entire world (easy, just needs a big hard-drive) B) Sending portions of the world to a player when it is requested (High bandwidth cost, but that's also totally fine) C) Receiving updates from each player & storing it in it's database (again, high bandwidth, but really fairly easy).
It means you don't actually need a server with the computational power to calculate the actions of each NPC, it only needs to store the current state of those NPC's and upload/download them as applicable. All the heavy computational lifting will occur on the part of the players side, as it does at the moment, and those updates are then sent to the server.
|
|
splitterwind
Master
Posts: 149
I don't like: Ignoring a unpleasant question or answering with something that is only loosely related or way to vague to actually answer something. Mods that Cherry-pick in discussions. Banning people for minor offenses.
|
Post by splitterwind on Jul 16, 2014 23:40:03 GMT
There is a significant difference between having a server that simply runs a large-scale world, and one that does the calculations for that world. [...] It means you don't actually need a server with the computational power to calculate the actions of each NPC, it only needs to store the current state of those NPC's and upload/download them as applicable. All the heavy computational lifting will occur on the part of the players side, as it does at the moment, and those updates are then sent to the server. Exactly. That is the point I try to make, that is exactly the reason why having such a world and having realistic erosion over time or complex wind and weather simulation or "simulating every grain of sand and every drop of water" was absolute nonsense by peter. Having a "browser game" with a jupiter sized word - no problem. Having "from dust" and "banished" with a jupiter sized world - technically impossible. Having a lumberjack that produces X logs per hour without affecting the world - possible. Having a lumberjack that actually goes out and chops trees down (requires pathfinding) - impossible with that scale. Persistent multiplayer means that Godus plays forcedly like a browser game as every calculation has to be simple (for example doesn't require path-finding). Either that or it freezes like Sim City did (which wouldn't be true persistent multiplayer). And apparently even the singleplayer is meant to be persistent. 22cans imposed heavy limitations upon themselves with their design decisions.
|
|
Lord Ba'al
Supreme Deity
Posts: 6,260
Pledge level: Half a Partner
I like: Cats; single malt Scotch; Stargate; Amiga; fried potatoes; retro gaming; cheese; snickers; sticky tape.
I don't like: Dimples in the bottom of scotch bottles; Facebook games masquerading as godgames.
Steam: stonelesscutter
GOG: stonelesscutter
|
Post by Lord Ba'al on Jul 18, 2014 2:13:17 GMT
Having a lumberjack that actually goes out and chops trees down (requires pathfinding) - impossible with that scale. Why impossible?
|
|
|
Post by Danjal on Jul 18, 2014 8:34:28 GMT
Having a lumberjack that actually goes out and chops trees down (requires pathfinding) - impossible with that scale. Why impossible? Without relying on resource nodes or infinite trees - the need to continually expand and have each individual lumberjack needing to pathfind to find a tree every time it goes out to work. Multiply that times a dozen or more lumberjacks per player. Add in a forester or other method to regrow trees (or infinitely expand outwards). Then multiply that times hundreds/thousands/millions of players. The main reason most browserbased games work off of buildings and nodes producing their resources is because then its simple calculations. Every hour you get X wood. There's no further processing needed. If every single woodcutter would also need to have its pathfinding calculated, the trees have their full animation done, perhaps add in some physics to make it look fancy as it falls down. Every additional step gets exponentially larger consequences. Then figure out which parts have to be done server-sided, which can be done clientsided and what degree of communication and cross-checking is needed. The infrastructure required would be insane. While it is *technically* possible. It isn't very likely to happen and would be ridiculously expensive to achieve. If they can even scale that up to the supposed 50 million+ players they claim to be able to support. (I suspect part of the reason they're holding off on so many things isn't just because they don't want to scare of new players, but also because they just wouldn't be able to run it on large scale.)
|
|
splitterwind
Master
Posts: 149
I don't like: Ignoring a unpleasant question or answering with something that is only loosely related or way to vague to actually answer something. Mods that Cherry-pick in discussions. Banning people for minor offenses.
|
Post by splitterwind on Jul 18, 2014 13:10:09 GMT
Danjal described it very well.
Its also worth mentioning that in a browsergame where you produce X amount of wood per hour it is not actually updated every hour or even minute.
If a server would constantly calculate "wood = wood + 1" for every village (which conforms to updating a database entry for each village on the server) the server would probably lit fire after a few thousand players and stop responding.
What instead happens is that your amount of wood gets only updated when the amount is actually prompted, for example you or another player viewing the screen of a planet or village. The server calculates something like "(Timepast / 60 minutes) * production_per_hour" and no matter how big the numbers gets it always takes equal amount of time to calculate.
In order to create the illusion that the server actually does increase your amount of wood every minute they use javascript which updates the number of wood clientside (not in the database, only on your computer). So for you it seems like your amount of wood is constantly increasing while the number stored in the database is actually left untouched. Only if you reload the page (F5) the server does actually calculate the correct number and saves it in the database.
Doing that little trick with a lumberjack that actually performs pathfinding and interacts with the world would be technically impossible.
A computer can easily calculate the function above in a micro second and no matter how much time pasts it would always require the same time to calculate.
The calculation costs of pathfinding however would increase rather drastically if the server attempted to calculate it retrospectively. If the server tried to retrospectively calculate the pathfindings of 24 hours (because last time you logged in was yesterday) it would freeze for quite some time. Add multiple lumberjacks and other villagers as well as multiple players and it would probably decide to explode instead.
Trying to calculate that in realtime on a map of theoretically unlimited size would be way to expensive. If you play banished you might notice that it already starts to lag after a few hundred of villagers...
|
|
Lord Ba'al
Supreme Deity
Posts: 6,260
Pledge level: Half a Partner
I like: Cats; single malt Scotch; Stargate; Amiga; fried potatoes; retro gaming; cheese; snickers; sticky tape.
I don't like: Dimples in the bottom of scotch bottles; Facebook games masquerading as godgames.
Steam: stonelesscutter
GOG: stonelesscutter
|
Post by Lord Ba'al on Jul 18, 2014 14:39:26 GMT
Doing that little trick with a lumberjack that actually performs pathfinding and interacts with the world would be technically impossible. I don't see why. You can apply the same trick to the locations and types of trees and have it stored locally and then every once in a while perform synchronisation. The calculation costs of pathfinding however would increase rather drastically if the server attempted to calculate it retrospectively. If the server tried to retrospectively calculate the pathfindings of 24 hours (because last time you logged in was yesterday) it would freeze for quite some time. Add multiple lumberjacks and other villagers as well as multiple players and it would probably decide to explode instead. Why would a server ever have to handle pathfinding? Trying to calculate that in realtime on a map of theoretically unlimited size would be way to expensive. If you play banished you might notice that it already starts to lag after a few hundred of villagers... I don't think Banished uses a server.
|
|
|
Post by Danjal on Jul 18, 2014 15:28:38 GMT
Doing that little trick with a lumberjack that actually performs pathfinding and interacts with the world would be technically impossible. I don't see why. You can apply the same trick to the locations and types of trees and have it stored locally and then every once in a while perform synchronisation. The calculation costs of pathfinding however would increase rather drastically if the server attempted to calculate it retrospectively. If the server tried to retrospectively calculate the pathfindings of 24 hours (because last time you logged in was yesterday) it would freeze for quite some time. Add multiple lumberjacks and other villagers as well as multiple players and it would probably decide to explode instead. Why would a server ever have to handle pathfinding? Trying to calculate that in realtime on a map of theoretically unlimited size would be way to expensive. If you play banished you might notice that it already starts to lag after a few hundred of villagers... I don't think Banished uses a server. Imagine for a second someone playing a game like Banished, reaching a population of 100~200+ you are noticing performance issues. Go even higher and it gets worse. Godus encounters much the same locally when you reach into the thousands of population (but Godus is much less complex compared to banished.) Now extrapolate this, you want to calculate 24 hours worth of running banished after the fact. Since the resource flow isn't fixed, but instead based on a variety of factors like distance between the gatherer and his resources, food available in town, sickness and other variables you'd have to calculate it. You can't just say "its 200 wood per hour" because its not. This gets multiplied for every gathering unit (in our example woodcutters) each player has. It would be a very large thing to calculate. If both Godus and Banished already have problems running their respective 2000/200 people in realtime, imagine having to run what effectively amounts to 24 hours of gameplay *instantly*. The computations required would be tremendous - but such is the nature of wanting to make a game like Godus persistant. You might notice that the current game avoids all of these elements, instead running with fixed X/hour models instead. The addition of actually having them go out and gather the resource? And I mean actually gathering it, not just have the animation "simulate" and have a fixed X/hour income in the background. (Which would be the easiest midway solution IMO) The idea here is that Banished (as a local, singleplayergame) has problems - Godus wants to be what effectively amounts to an MMORTS (in as much as citybuilders and such are 'RTS'). With the concept of actual resource gathering, and thus pathfinding being the core point here. You'd need to run the worlds in real-time. While this is possible for a handful of players, the claim is that they want to be able to run millions of players at once. Calculating it after the fact wouldn't be plausible without resorting to basic formula's and static values, yet the inclusion of pathfinding and actual gathering removes those static values. On the other hand running what effectively amounts to millions of games of Banished at once wouldn't work either because the server needed would be insane. And that is why it would be impossible (or at the very least improbable and extremely expensive) to run any resource collection with realtime pathfinding in the game. You'd *have to* resort to tricks such as static X/hour values, resource nodes (effectively amounting to static values) or similar such illusions. So unless you had that in mind, having forests work as fixed nodes rather than individual trees spreading (or being planted) 'randomly' across a certain area. Its just not every plausible to see it work like that in Godus. Because you'd effectively have to run hours of gameplay in a matter of seconds (or risk long loading times to calculate) if you do it locally, or alternately running numerous versions of the game simulation at once on a server. Neither of which seem like a valid possibility. And as such, its pretty obvious (to me atleast) that the likelyhood of Godus ever getting anything even remotely as complex isn't going to happen. Though as I pointed out above, there are tricks that can be used to give the illusion.
|
|
splitterwind
Master
Posts: 149
I don't like: Ignoring a unpleasant question or answering with something that is only loosely related or way to vague to actually answer something. Mods that Cherry-pick in discussions. Banning people for minor offenses.
|
Post by splitterwind on Jul 18, 2014 17:09:27 GMT
The calculation costs of pathfinding however would increase rather drastically if the server attempted to calculate it retrospectively. If the server tried to retrospectively calculate the pathfindings of 24 hours (because last time you logged in was yesterday) it would freeze for quite some time. Add multiple lumberjacks and other villagers as well as multiple players and it would probably decide to explode instead. Why would a server ever have to handle pathfinding? Your original question was why it would be impossible to have a lumberjack that actually goes out to chop trees, like in banished where a lumberjack actually cuts trees and they require some time to regrow etc. and the further away the tree is from your lumberjack and his storage the more time it would require to get to that tree and carry it back. So actual resource management like in black and white, command and conquer and banished. So instead of just placing a building and having X resources generated every hour you have to make strategic decisions about roads, storages, terrain, exhaustion of resources and efficiency. Danjal already answered that question. Also if you distribute important calculations to the client you have to somehow validate them afterwards, what if the client manipulates memory to make his lumberjack go through buildings or other cheats? Generally nothing that is calculated or sent by the client can be trusted as it could be easily manipulated by said client and it should either be avoided or properly validated. I don't think Banished uses a server. Yes, if it would use a server the performance would most likely be worse. Online gaming requires more "trickery" (estimations) and compromises than you might expect. If they don't workout you experience things like rubberbanding (when you're running in an online game and after a minute you're warped back to an earlier position - what happens is that server and client are out of synchronization and after a minute your client gets updated to his real position) or rollbacks (your progress wasn't saved and is lost). Its unlikely that 22cans will set up a server infrastructure that exceeds battle.net or EA and as far as I know the latest Sim City already had multiple problems (you couldn't log in at times, progress wasn't proberly saved etc.) with very small and limited maps and it was actually more a singleplayer experience than multiplayer (everyone played on a server but everyone played for themselves, your city wasn't active if you weren't active etc.) If EA had difficulties the company that required 5 months to implement dragging with your mouse and more than 1 year to get a working exit button will not perform better than that.
|
|
Lord Ba'al
Supreme Deity
Posts: 6,260
Pledge level: Half a Partner
I like: Cats; single malt Scotch; Stargate; Amiga; fried potatoes; retro gaming; cheese; snickers; sticky tape.
I don't like: Dimples in the bottom of scotch bottles; Facebook games masquerading as godgames.
Steam: stonelesscutter
GOG: stonelesscutter
|
Post by Lord Ba'al on Jul 19, 2014 0:05:54 GMT
Aha, now I see you guys were talking about a continuous simulation. It makes more sense to me now. Still, I think you could handle a lot of the problems on the client side. I was going to suggest having the client calculate the changes whenever the game is loaded, sort of like what Danjal just said I guess. It might take a couple of minutes sometimes to do this, but I don't think it would have to be as bad as Danjal suggests. For example. Let's consider a lumberjack that travels into a forest to chop down a specific tree. If you are actively playing the game and follow the guy around it might take minutes (or possibly dozens of minutes) for him to go out, find the tree, chop it and take it back home. What is actually happening is that your computer is constantly pausing and waiting. Depending on how the code is implemented it could for example be that every time the lumberjack takes a step that part of the simulation is put on hold for an X amount of milliseconds. These pauses have to be built in somehow because if they weren't there the game would run at different speeds according to how fast the computer it is ran on is. (this effect can sometimes be seen when playing really old games) If the simulation didn't pause constantly, that lumberjack might have chopped down thousands of trees when you blinked your eyes, because computers these days run billions of instructions per second. The same is true for all aspects of the simulation. When you perform these calculations at startup you can take out all the pauses that were deliberately put in to keep the simulation running at a specific speed. You might run into some issues with dependencies so you might have to be real careful about the order in which you run calculations, but that's a different matter. Think about it, billions of instructions per second. How many instructions would you need to simulate a lumberjack taking home a tree?
|
|
Lord Ba'al
Supreme Deity
Posts: 6,260
Pledge level: Half a Partner
I like: Cats; single malt Scotch; Stargate; Amiga; fried potatoes; retro gaming; cheese; snickers; sticky tape.
I don't like: Dimples in the bottom of scotch bottles; Facebook games masquerading as godgames.
Steam: stonelesscutter
GOG: stonelesscutter
|
Post by Lord Ba'al on Jul 19, 2014 0:19:56 GMT
Perhaps we should migrate this to another topic? You are totally right, see here the new topic. Feel free to make suggestions for a name for it coz I don't have the foggiest. By the way, I realize I haven't been around much lately. I sort of have more important stuff to attend to at the moment. This topic could have been split sooner. Sorry for not being around. I blame Qetesh for not keeping an eye out for me while I was off doing important stuff she wanted me to do.
|
|
splitterwind
Master
Posts: 149
I don't like: Ignoring a unpleasant question or answering with something that is only loosely related or way to vague to actually answer something. Mods that Cherry-pick in discussions. Banning people for minor offenses.
|
Post by splitterwind on Jul 19, 2014 4:45:32 GMT
It might take a couple of minutes sometimes to do this, but I don't think it would have to be as bad as Danjal suggests. Danjal is spot on, pathfinding is expensive. When you perform these calculations at startup you can take out all the pauses that were deliberately put in to keep the simulation running at a specific speed. True. But even in realtime with that pauses pathfinding can easily stress your computer. If you play a game that performs a lot of pathfinding on a bigger map while the number of units increase over time (like banished) it will eventually reach the point of being unplayable. Pathfinding is rather expensive. Its faster to search something in a huge database (google can search the internet for you within microseconds...) than performing pathfinding at unfavorable conditions. I was going to suggest having the client calculate the changes whenever the game is loaded, sort of like what Danjal just said I guess. You would not only need to calculate your own pathfindings once you come back online but also the pathfindings of your neighbours if they are offline (for example because you want to kill their lumberjack and thus need to know where that lumberjack is). Now imagine that your neighbour likes to build mazes (because they look cool or because they slow down attackers), if the pathfinding algorithm has to run in complex mazes things could easily become worse. Pathfinding is also a algorithm that scales poorly. Let's assume a tiled map for simplicty. Running a pathfinding algorithm on a 10x10 map would mean that there would only be 100 fields to consider. Run it on a 512 x 512 map and there would already be over 6000 fields to consider. A 2048*2048 map (very old isometric games already offered maps of that size) equals to 4.194.304 fields! Now imagine that a player decides to build the biggest maze you've ever seen in the world of Godus, a world that is theoretically endless and a lumberjack wants to chop trees from a forest on the other side of the maze... And now imagine 100 lumberjacks instead of 1 lumberjack. All numbers are multiplying each other, even if you forget about the maze it can easily require an eternity for you to retrospectively calculate all that pathfinding. Horizontal Map Size * Vertical Map Size * Units * Time. (where map size conforms to the biggest area units are willing to examine). Let's say you would let run 100 lumberjacks around a map size that 10 year old simulation games could already offer at their higher settings (2048*2048 - transport tycoon as reference). And every lumberjack is running 2.000 times completely across that. 2048*2048*100*2000 = 838.860.800.000 And on top of that imagine that you and your neighbor were both offline for the weekend, 3 days. Or add 200 Archers you set on a patrol around your entire patch of ground. Don't forget that this theoretical Godus isn't like a normal simulation game where you encounter natural limits (map size) or get bored but a massive multiplayer online game, unit sized could get bigger than the "few" hundreds you can encounter in banished. And I can already easily reach the point in Banished were it gets so slow that time acceleration doesn't do anything. Even in Sim City 4 you can encounter problems with path finding. Sim City 4 doesn't slow down like banished but it can take multiple ingame days before commuting updates after you build a new road or demolished old ones. On a Server/MMO you would really want to run functions that always take about the same time to perform or scale linear, not exponential, and that do not not have such extreme worst case scenarios.
|
|
|
Post by 13thGeneral on Jul 19, 2014 4:59:49 GMT
No harm. I totally understand. No idea about the thread title. Something that eludes to the discussion being about the reality of the Jupiter sized world.
|
|
Lord Ba'al
Supreme Deity
Posts: 6,260
Pledge level: Half a Partner
I like: Cats; single malt Scotch; Stargate; Amiga; fried potatoes; retro gaming; cheese; snickers; sticky tape.
I don't like: Dimples in the bottom of scotch bottles; Facebook games masquerading as godgames.
Steam: stonelesscutter
GOG: stonelesscutter
|
Post by Lord Ba'al on Jul 19, 2014 5:47:09 GMT
No harm. I totally understand. No idea about the thread title. Something that eludes to the discussion being about the reality of the Jupiter sized world. Done. Thanks.
|
|
Lord Ba'al
Supreme Deity
Posts: 6,260
Pledge level: Half a Partner
I like: Cats; single malt Scotch; Stargate; Amiga; fried potatoes; retro gaming; cheese; snickers; sticky tape.
I don't like: Dimples in the bottom of scotch bottles; Facebook games masquerading as godgames.
Steam: stonelesscutter
GOG: stonelesscutter
|
Post by Lord Ba'al on Jul 19, 2014 5:49:10 GMT
There must be some amazing path finding algorithm that nobody has yet thought of.
|
|
|
Post by 13thGeneral on Jul 19, 2014 6:50:41 GMT
There must be some amazing path finding algorithm that nobody has yet thought of. I don't really know much about game coding or programming, but there's a really great insightful blog post on Gamasutra titled "Behavior trees for AI: How they work" by Chris Simpson of Indie Stone Studios (Project Zomboid) And in thier weekly update (called Mondoids) they briefly touch on the crazy awesome things they're trying to do with the NPC's and Zombie AI.
|
|
Lord Ba'al
Supreme Deity
Posts: 6,260
Pledge level: Half a Partner
I like: Cats; single malt Scotch; Stargate; Amiga; fried potatoes; retro gaming; cheese; snickers; sticky tape.
I don't like: Dimples in the bottom of scotch bottles; Facebook games masquerading as godgames.
Steam: stonelesscutter
GOG: stonelesscutter
|
Post by Lord Ba'al on Jul 19, 2014 6:58:41 GMT
Okay, here's an idea. (perhaps) Say you consider a mapsize of 256 * 256. Now you write a function that discards all the areas of the map that can not possibly be reached and stores the remaining coordinates in an array of some sort. Then you write another function that calculates every possible route there is from every coordinate in the array to every other coordinate. A route consists of a list of all the coordinates on that particular route. You store all these routes in a database. Then you write a function that goes through all the routes in the database and removes all those that don't make any sense. (or you find a way to remove them before they go into the database) For each route you calculate the total distance or perhaps rather the total time it would take to travel along the entire route. (perhaps taking slopes into consideration or something like that) Then you go through all the remaining routes and iterate over each coordinate in each route. While doing that you create a new database (or table) that has an entry for each valid coordinate and as values it will have a list of all the routes that have that coordinate in them. This basically gives you a large database that has all the information you might want to have already pre-calculated. Now when you need some path finding from coordinate A to coordinate Z all you need to do is query the database and retrieve the shortest route (or one of the shortest ones if you would want some type of randomization) and it will give all the coordinates the character needs to be able to travel along that route. No calculation required on either the client or server side. Now let's add in some landscaping. Whenever the map is changed by the player the affected coordinates are sent to a server. (I think it's probably best to calculate server-side in this case) The server runs a calculation from every affected coordinate to any other reachable coordinate. (I skipped the data cleaning step, I know) These new routes are written into the database while the previous routes pertaining to those coordinates are removed from it. Thus the route database is completely up to date again and any character requiring path finding can simply query it to find a suitable route. Now I don't know a lot about optimizing databases for speedy data retrieval, but as pointed out by splitterwind Google can retrieve data from the internet in microseconds. (of course Google also has loads of gigantic warehouses full of servers and data storage) I don't know if applying this structure will be fast enough but there is probably plenty of room to cut some corners to make it faster. This leaves of course the issue of multiple 256 * 256 maps that are stitched together. I haven't really thought about this yet, but let's say you want to move from point A on map 1 to point Z on map 2. You could try "drawing" a direct line between the two points and finding the coordinates of both maps where that line intersects with the map edges. Then you look up the route from point A on map 1 to that coordinate on the edge of the map. Then you look up the route from the coordinate at the edge of map 2 to point Z. Presto, you have found a path. I'm sure it's not ideal but I can picture it working fairly okay. As for everything written above there are likely many kinks to work out along the way but I have a feeling this could work. What do you think?
|
|
Lord Ba'al
Supreme Deity
Posts: 6,260
Pledge level: Half a Partner
I like: Cats; single malt Scotch; Stargate; Amiga; fried potatoes; retro gaming; cheese; snickers; sticky tape.
I don't like: Dimples in the bottom of scotch bottles; Facebook games masquerading as godgames.
Steam: stonelesscutter
GOG: stonelesscutter
|
Post by Lord Ba'al on Jul 19, 2014 7:01:08 GMT
There must be some amazing path finding algorithm that nobody has yet thought of. I don't really know much about game coding or programming, but there's a really great insightful blog post on Gamasutra titled "Behavior trees for AI: How they work" by Chris Simpson of Indie Stone Studios (Project Zomboid) Awesome, thanks!
|
|