Jump to content

Jonny

Community Newbie
  • Posts

    3
  • Joined

  • Last visited

Jonny's Achievements

Tiro

Tiro (1/14)

0

Reputation

  1. I think it could be useful to add a very simple (and extremely quick) 3D approximation to each unit by representing them as a small bunch of spheres. Projectiles and even melee attacks could then be done on a more 3D basis, preventing arrows from flying through buildings and allowing some very believable hit detection. Each individual sphere would have different combat system attributes, so that a hit to a shield would do little damage but a hit to an unprotected head would instantly kill. An infantry unit could be made up of 4 spheres: legs, body, shield (offset to the front of the unit), head. This should allow far faster collision detection than using a polygonal collision mesh, and could be comparable to the cost of using trig functions to determine attack direction. This might allow for the best of both randomised and predictable combat systems, as the predictable part chosen during the positioning of each unit would depend on the orientations of each unit whilst the effects of arrows would be far more random due to their deviation and would depend entirely on where they hit. Moving the positions of the spheres would allow certain formations to gain extra protection from archers by interlocking shields or raising them above their heads. A similar system could be used for buildings, where a flaming arrow to a thatched roof would start a fire but a flaming arrow to a stone wall on the same building wouldn't. A full polygonal collision system might be more suitable there due to their flat surfaces, though.
  2. Yes, n is the number of trees on the entire map. I wouldn't expect it to change much about the strategies used, either. It's benefits are limited to a small number of scenarios during the game, but I see a possible benefit in that a map designer (or a random map script) could set various parameters (rainfall intensity, the heightmap, type of ground, etc) which change over the map and mark which regions of the map are seeded with which kinds of trees, then this algorithm would use those parameters to automatically generate an old growth forest that looks more interesting than a forest generated by randomly placing trees or by 'painting' each tile by hand. The key part of this is that the forest would automatically stop advancing over the map once it reaches terrain which it cannot grow on, allowing you to quickly set deciduous trees to be seeded over the entire map and then producing a forest which follows rivers and streams but doesn't grow in the middle of a desert and which has a very complex appearance and non-linear boundaries. Personally, I would like to see a default behaviour that maximises immediate gather rates (which is pretty much what the game does now), but allow that to be selectively changed to be more sustainable after researching some kind of technology that would unlock that option. I could see the more sustainable method being applied only near a few lumber camps (possibly allow areas to be chosen by painting sustainable forestry indicators from a lumber camp based interface?), to ensure that the land you control is being used productively after being clear cut instead of being left devoid of life. This would give players the option, but not require a decision to be explicitly selected to begin playing. I would like to see buildings 'repel' trees by having the building produce an exclusion radius around it that is based on the cut off value of a sum of potential fields generated by each nearby building. This would allow units to walk around the buildings quite easily and would simulate the forest being cut back regularly. Roads and paths would be terrain types with the same effect. I could see fish being modelled as small shoals of 10 to 20 fish that must eat plankton to survive and will grow to a maximum size if they eat enough of it, at which point they would split into separate shoals and go their own way. Each shoal would flock (under a small wandering behavioural influence to avoid them going in straight lines) with nearby shoals to produce much larger groups representing shoals of hundreds of fish with only tens of objects. The plankton they eat should be generated by deep enough waters and stored as an array of densities, the gradient of plankton densities would feed into the fish flocking behaviour to drive them to locate better feeding grounds. Fish stocks need considerable time to recover IRL, so the same should be expected in the game. Whales would essentially be finite resources. This page: http://www.red3d.com/cwr/steer/gdc99/ explains the steering behaviours quite nicely, but I am sure you already know about it. Fishing would be done either by sitting in one place and causing the plankton gradient to guide nearby fish towards you, or could be done with a seek behaviour that has boats chasing down and catching fish with large nets in another instance where the behaviour could be changed to allow more sustainable use of resources later in the game.
  3. I have been studying realistic tree growth patterns for implementation in a different game, and it is possible to have a single kernel which runs over the whole of the domain to generate realistic forests. You don't need different methods for different tree types, and with a bin-lattice optimisation I have managed to get an algorithm that runs in O(n) time in MATLAB. It exhibits competition, regrowth dependant on the locations and types of the trees remaining, and the tree age and location distributions of mature forests. In your case, the algorithm would need to do the following for each 'tick': Each tree would grow a seed over a period of about 1 minute. I use a test on the tree's parametric size to determine if it is old enough to release seeds, and this seems to work fairly well.The trees with ripe seeds would scatter them to locations within a parameterised distance (by picking a random point in R-theta space in my implementation, then doing a coordinate transform that includes an offset from the current tree to avoid it being placed too close. The exact reason for this will become apparent later).There are two cases to consider once the seed's location is known:The seed lands some place it cant germinate, ie sand, rock, water, very high terrain, a building, a road, fields that are being tended, etc. In this case it is simply forgotten about, the tree starts growing a new seed and the next 'ripe' tree is considered.The seed lands some place it can germinate. This is more complex, as you need to determine if that location is currently being 'smothered' by an existing tree (I will call the area around a tree within which seeds cannot germinate the 'exclusion radius'). This is done by comparing the distance to each nearby tree (this is where the bin-lattice optimisation helps) with some function of that tree's parametric size. If they are too close, the seed cannot germinate and will be ignored. If the seed can germinate, it will become a sapling and will begin to grow. I have avoided the test for the exclusion radii at this stage by always placing a sapling at this stage, and checking all the exclusion radii in a single place once per tick. Every tree grows some amount each tick, I suspect it will be simplest to just store the age of a tree and then map that to the 3d model and exclusion radius. It is best if this is clipped to a reasonable value to avoid having extremely large trees with nothing around them (asymptotic growth might be worth investigating here). The amount of growth could depend on the trees nearby: those of the same species will help growth but those of other species will hider it, enforcing stands of similar trees instead of randomly interspersed tree species.At some point the exclusion radii of two trees will overlap due to their growth. There are many ways to deal with this, I have tried two: the growth rate can be reduced for each tree depending on their relative sizes, and the first to have its location be within the exclusion zone of another will die at that time; the smaller tree dies immediately and there is no reduction in growth rate. The simplest is immediately killing the smaller tree, and it seems to work very well at thinning out all the saplings that develop in holes in the canopy, just like a real forest. This is where the bin-lattice optimisation helps.At each tick, there is a non-zero probability that any given tree will die. This is small and simulates random lightning strikes and death from old age. It also has the effect of changing how the forest looks by producing holes which new trees can grow into, producing clearings which then develop into dense growth and finally mature and fill in the canopy.It may be possible to optimise out much of the exclusion radius testing by enforcing constant growth rates, computing a time of intersection and dealing with each case when it occurs. This would bring the costs down to around constant time for the exclusion tests for each tree, but would not allow any dynamically changing growth rates due to factors such as interaction with other trees, animals eating the foliage or a lack of water. This method has the added benefit of allowing you to replant a previously cleared area by collecting saplings and transplanting them before they grow too big, all it would require is some method of moving a sapling. It can also be hooked into a shallow water simulation to stop trees growing in a marsh or in a dry dust bowl, but I have not yet got my lax-wendroff shallow water simulation to work with very shallow fluids and dry areas. There have been some concerns in this thread about renewable resources producing masses of usable materials for a player. With this algorithm the amount of wood that would grow could be rather small, and depends entirely on the parameters chosen to model the growth of the forests. It would mainly effect late game economics and areas with very limited land, such as small islands. The impact it has on islands is that you get a very slow trickle of resources from the territory throughout the game, instead of getting absolutely nothing. Moving on from trees: I would like to see renewable fish stocks; grass that actually grows (so a farm wouldn't be a 'building' but would instead be an area of land that is tended to by a villager to enhance the amount of food that can be harvested) and interacts with the trees; herbivores that feed on the grass, seeds and some saplings to allow the environment to reach a dynamic equilibrium between forests, grasslands and fauna; animals that show flocking behaviour and realistic life cycles; a realistic water simulation with dynamically formed rivers, streams, marshes, wetlands and deserts. I want to be able to watch a wild bear go into a river and snatch one of the salmon out of a passing shoal, then eat it. I also want to be able to attack an island by building a causeway and then getting some siege equipment to roll up to the walls and open them up.
×
×
  • Create New...