Jump to content

  • Log In with Google      Sign In   
  • Create Account

Build plan draft

Posted by polyfrag, 01 June 2014 · 905 views

This is what appears after a player chooses a spot to place a building or selects one under construction.

Posted Image

Just off the top of my head, there are some problems. Theoretically, what if in the future I use a 256x256 map or something and there's no way for a single truck to transport it without running out of fuel. I have to add a check to see if a truck would run out of fuel on the way to or from a supplier and whether it needs to fuel up somewhere. This complicates the data structures. Let's say there's an "errand" (job) structure that holds "trip" structures, each with a path. An errand would consist of several trips. First might be a trip to gas station, then to the supplier, then to the demander. There shouldn't be any unusual cases that would require extra considerations to get the cheapest fuel cost. Like, if a certain gas station has really cheap fuel but only a limited amount, so all combinations of gas stations, demanders, and suppliers would be required for a truck to figure out which is the most profitable errand/job it should take up.

And I haven't even mentioned overseas transport. An errand might require resources to be picked up from one building on one island, transported by truck to a harbour, by ship to another island, where another truck transports it to its final destination.

And I was thinking of actually running the simulation, as it would normally run, only in an instant, to do the cost estimates. That would require a lot of restructuring. I would have to duplicate the unit, building, road, etc. structures. And pass everything as arguments instead of using globals. Maybe it's better to use heuristics (cheap guesses) or leave it all up to the player to choose the supplier, transporters, etc. But I'm making an AI opponent, so there will already be some kind of heuristic. Or will there be? AI opponents don't necessarily have to compare choices and estimate costs because they can just "cheat" and figure out what to build and where. But maybe that's another topic: what to build and where, as opposed to how much it will cost.

Maybe this is all too complicated. Maybe I should go back to an earlier design again and just let the player choose the supplier for each building. I didn't have the problem of land-sea-land transport before though.

I've had a similar issue in working out whether my player can enter a walking or running state recently. The movement code is quite complex and I found there was no way to test whether a move would be possible reliably without doing similar to what you say and running a fake move step and then testing for intersection.


Much as you describe, I refactored the move code to work on parameters passed to it rather than the character controller members directly, then could use the same method to move the actual character, or to pass dummy values in to just test what the end result of the move would be.


Bit different in a large scale simulation like you are working on though. I'd imagine a long errand could take quite a lot of time/resources to simulate all the way through in the background?

Yeah, probably. 

May 2016 »

1234 5 67

Recent Entries