Jump to content

Floating props


Recommended Posts

Currently, there are issues with buildings on non-flat terrain.

One of the solutions would be to flatten it. But that won't be the nicest one. The main problem is, even if the model has deep foundations. There are still artefacts that shouldn't happen, such as floating props (see screenshots).

post-15092-0-13858700-1371737207_thumb.p

So I would suggest to add a attribute to the "prop" element of an actor. I imagine something like floating="ground" or floating="water". in which case, the horizontal (X,Z) position would still be taken from the original model (just as the prop is currently bound to a point), but the vertical Y position would be the terrain height on that point.

That way, you won't get those floating props (at least not if you have a separate prop for every object you add). But moreover, it could give an advantage to walls.

TheGreatWall1.jpg

If the wall pieces would just consist out of some small props (a few meters wide, or exactly one merlon wide), repeated with some variation. Then those wall props could float on the ground, and create a nice landscape following layout.

It does seem possible (and quite simple) this far, but the render code is huge, so I haven't yet found where the prop placement happens. If someone could help me with that, it would be great. I also like to hear some input from designers.

I even believe, once floating props are implemented, terrain flattening shouldn't even happen anymore. Everything could be fixed in the models.

Edited by sanderd17
Link to comment
Share on other sites

Sounds like a good idea for building props. I'd even go so far to suggest we apply the terrain Z to every mesh group in the model that has same Z value as the foundation. This would let us keep the current art unmodified and it would require less from the 3d artists. Mesh groups that have higher Z will be ignored (clay pots on pillars, etc.).

This means that the model has to be broken down into sub-objects during loading time. Mesh groups with high Z value stick to the original object, while other mesh groups get extracted.

I don't even know how the model importing system works in 0 A.D., though, so perhaps someone else could comment on that.

Link to comment
Share on other sites

It could be a solution, but a tricky one. IMO having to make each prop a separate mesh doesn't sound like the best method. It also sounds hard to mod.

I think partial flattening + clever prop positioning (see mauryan market or mauryan elephant stables) is the way to go.

Link to comment
Share on other sites

@RedFox, I don't know if adjusting every group on the ground would be a good idea. It could give some strange results.

@Enrique, Wow, I never discovered that about the elephant stables. Nicely done. But how would having multiple props with a single element be more difficult than a single prop with multiple elements? I also would like the decision to the artists if they want their prop to be floating, or if they want it to be fixed. So you wouldn't have to do that trick with the table (which is very well thought). Maybe it could be even extended to set floating in some range if you like.

And how do you feel about the walls? Would it be a solution for those? Every wall would need some vertical thing (like the vertical woods in the celtic wall) to obscure the seam I guess.

@zoot: stick out on one side, and be burried on the other side indeed. But I think flattening would be more dangerous to implement. If the terrain is almost impassable, and you flatten a part, an other part will become steeper and completely impassable. AI will have a nice time searching where to build the dropsite so the way to the dropsite doesn't become impassable. And some new players could be very surprised.

Link to comment
Share on other sites

Not sure how the walls would work divided in pieces. It would also break the wall placement system I guess. If I understand correctly, you want to divide the long section in, for example, 5 pieces? I think that would make the wall a little weird on uneven terrain, probably with big differences in height between pieces, and probably hard not to see the seams between pieces and discontinued texture. It also could make difficult to place gates I guess. Not sure if I understood the method you are proposing correctly xD

Having multiple props in each building means a lot more actors per building. One per prop seems to me a too much, but it could be done.

Another thing to point out: in your example screenshot, you placed the mill in atlas? the game doesn't let you build on such steep terrain, 90% of the time you can't see the extended underground structure end even on extreme cases. The props are easy to see them floating though.

I would like to see partial terrain flattening to test it out to see how it works and if it's so easy to generate impassable terrain. I also wonder if it can be possible to make some kind of check on the surroundings of the building before placement and don't let it build where it would make impassable terrain? this seems harder to get it right though.

Link to comment
Share on other sites

Not sure how the walls would work divided in pieces. It would also break the wall placement system I guess. If I understand correctly, you want to divide the long section in, for example, 5 pieces? I think that would make the wall a little weird on uneven terrain, probably with big differences in height between pieces, and probably hard not to see the seams between pieces and discontinued texture. It also could make difficult to place gates I guess. Not sure if I understood the method you are proposing correctly xD

Depending on the desing yes, a piece or five. If the pieces are designed with care (with step-like features between them) I think it could work. Hiding the seam would indeed be the most difficult. It can be done with separate pieces of wood, or some buttresses. Gates would still be one piece I guess. That's a lot harder to change. But at least walls would follow terrain. Which is something Michael wanted (he mentioned that here somewhere).

Having multiple props in each building means a lot more actors per building. One per prop seems to me a too much, but it could be done.

Well, but you can re-use props directly by just referencing to them. Use the same basket as a prop for a house, the mill, the civil center ... So a lot less duplicate meshes.

Another thing to point out: in your example screenshot, you placed the mill in atlas? the game doesn't let you build on such steep terrain, 90% of the time you can't see the extended underground structure end even on extreme cases. The props are easy to see them floating though.

I turned on the passability overlay, and the terrain I placed it on is still passable (and also constructable) but only barely. Sorry, that doesn't seem clear as the mill also marks those squares red. But they were originally green.

I would like to see partial terrain flattening to test it out to see how it works and if it's so easy to generate impassable terrain. I also wonder if it can be possible to make some kind of check on the surroundings of the building before placement and don't let it build where it would make impassable terrain? this seems harder to get it right though.

Could cause some long iterations for big buildings though. But as you're art dept lead, I'll first check that.

Edited by sanderd17
Link to comment
Share on other sites

After a night of sleep, I decided I won't change the terrain elevation. That's just too dangerous for a newbie to the code base like me. The terrain has to be synced perfectly. And if I do it, I could cause additional OOS problems. I'll leave it for someone more qualified to do it.

I'll instead look around for something else to do.

Link to comment
Share on other sites

I also thought about the floating props solution. I haven't tried it yet (and I can't right now) but I think the prop's origin is inherited from the building "main" actor, therefore, I think the prop height will stay the same as the main building actor. It's just a guess, haven't tried it yet as I said.

Link to comment
Share on other sites

IRC there already is a ticket that implements terrain flattening somewhere on trac. Also I think terrain flattening is a must, I've never played an RTS before that didn't have terrain flattening and currently it is the most outstanding visual flaw in the game. On the other hand, I think doing something along Redfox's idea might be a little easier for artists to deal with then making nearly everything a prop.

Edited by Josh
Link to comment
Share on other sites

IRC there already is a ticket that implements terrain flattening somewhere on trac. Also I think terrain flattening is a must, I've never played an RTS before that didn't have terrain flattening and currently it is the most outstanding visual flaw in the game. On the other hand, I think doing something along Redfox's idea might be a little easier for artists to deal with then making nearly everything a prop.

http://trac.wildfiregames.com/ticket/21 - I really think we need to test and consider carefully terrain changing during the game. Currently it's not something we even need to worry about (Atlas is a special case, so we do have to handle dynamic terrain modification in the engine, but Atlas is also buggy).

Link to comment
Share on other sites

http://trac.wildfire...s.com/ticket/21 - I really think we need to test and consider carefully terrain changing during the game. Currently it's not something we even need to worry about (Atlas is a special case, so we do have to handle dynamic terrain modification in the engine, but Atlas is also buggy).

Pretty much the best way to do it would be to set the terrain pathfinding in stone when the map is generated and not have it "update" based on the terrain height changes. This is what happens with Age of Mythology. Sometimes the flattened terrain would create little cliffs around some of the edges that would normally cause passability issues, but this should be ignored by the pathfinder.
  • Like 1
Link to comment
Share on other sites

But pathfinder in Atlas should update the pathfinding based on the terrain. How can a map designer otherwise design cliffs and passable hills?

Since it's the same code being used, that's rather difficult.

Btw, I also think a 45° angle is a bit too steep to build on (see the screenshot, Enrique didn't believe it was buildable), maybe we could bring it to something lower? Bring the "building-land" class to a max slope of something like 0.5?

For most maps, this won't change, but you won't be able anymore to build on the entrance way to an acropolis (which might even be a good thing, no player wants to build there, and if the AI builds there, it gets pathfinding problems).

http://trac.wildfiregames.com/browser/ps/trunk/binaries/data/mods/public/simulation/data/pathfinder.xml

Link to comment
Share on other sites

Pretty much the best way to do it would be to set the terrain pathfinding in stone when the map is generated and not have it "update" based on the terrain height changes. This is what happens with Age of Mythology. Sometimes the flattened terrain would create little cliffs around some of the edges that would normally cause passability issues, but this should be ignored by the pathfinder.

That might be possible if we cached the pathfinder's terrain passability at the start of the match. Entity position would use the actual updated terrain, I suspect that would look decent. The difficulty sanderd17 brings up is that Atlas in fact reuses the gameplay logic from matches, so we have to add more special cases for Atlas-specific behavior.

Link to comment
Share on other sites

  • 3 weeks later...

I've tried to make a patch for it (http://trac.wilfiregames.com/ticket/2033), it works pretty well, but before I clean it up, I'd like some more input. I've used a maxheight and minheight attribute, those define the relative maximum and minumum height a prop can differ from the main mesh. When not set, they default to 0 (so the prop can't move). You can use it f.e. so that a prop can never rise over the original position, but when the ground is dropped, it can be placed lower so it won't dangle. I'd like to hear if this is a good interface, or if anyone wants other control over the props, or better names for the attributes.

Link to comment
Share on other sites

Sounds very promising. Enrique and I discussed this during saturday's art team meeting and we agreed this was very useful and we'd start creating buildings from now on that can work with this setup (where certain objects that sit on the ground level are propped to the main actor).

I can't test it out, or comment much on whether the attribute names conflict with anything, but the interface you've described sounds ideal for what's needed (y)

Link to comment
Share on other sites

About terrain change during play in general.

There are two ways possible IMO:

1.) Terrain change does not happen at all in-game.

2.) Terrain can be transformed in-game - that would include terrain flattening below buildings (which on it's own has its problems besides pathfinding mentioned by historic_bruno (http://www.wildfiregames.com/forum/index.php?showtopic=17405entry270541) and the topic link in that track ticket) as well as some kind of terrain transformation commands to make paths though otherwise unpassable areas as well as making walls and cliffs for defensive purpose.

But it seams the favor is leaning towards a mix (again) that only fixes the visual issue while granting no gameplay feature. Maybe it's just me but I strongly reject such things. For me the graphic has to represent the gameplay features and add a specific mood and feel to different regions of a game. If a graphic enhancement comes along with a nice gameplay feature that's quite cool. But making units be able to walk extremely step ground near buildings (because the pathfinder was not updated) but not allowing that on the rest of the map seams quite absurd to me.

Link to comment
Share on other sites

@Pureon or Enrique, if you say you're creating the new buildings to be compatible to the system, can you send me one (or commit it to the repo)? I'd like to make sure we're not talking next to each other (and have something better to test than that silly carthagian palm thing I used).

Link to comment
Share on other sites

@Pureon or Enrique, if you say you're creating the new buildings to be compatible to the system, can you send me one (or commit it to the repo)? I'd like to make sure we're not talking next to each other (and have something better to test than that silly carthagian palm thing I used).

We already have a few of these in-game. One example is the Persian stables building which has 3 horses propped at ground level each with their own prop points. See here. So props 'horsea', 'horseb', and 'horsec' would move up or down based on where the ground is.

Does that work?

Link to comment
Share on other sites

Leper got it in the game, and Historic Bruno fixed a Windows problem. So the horses in the Persian stables will adjust to the terrain height, and new buildings can also use this.

Btw, there are many possibilities. When a building exists out of two parts (like the L shaped blacksmiths), you can have one part added as a prop, so they move a bit relative to the terrain. But I'll leave it to you artists to see what's nice.

  • Like 1
Link to comment
Share on other sites

We already have a few of these in-game. One example is the Persian stables building which has 3 horses propped at ground level each with their own prop points. See here. So props 'horsea', 'horseb', and 'horsec' would move up or down based on where the ground is.

Does that work?

Pretty cool. Any chance a programmer can extend this to the Actor Editor?

Also, looks like we can now have real wheat fields that conform to terrain.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...