project-navigation
Personal tools

Author Topic: Modifiable Environment  (Read 11428 times)

Offline Azraiyl

  • Cannon Fodder
  • **
  • Posts: 4
    • View Profile
Modifiable Environment
« on: September 18, 2007, 12:03:24 am »
I know that UFO-AI-1 will not support destructible environment. I do not know if a destructible environment is a good thing or not, but I like to talk about a possible future. Here are my thoughts.

[Models]

What is the best way to model a house? It may be easier to model a house as one thing. Disadvantage: You can place this house only as a whole on a random map. Whenever you use this type of house it looks exactly the same. Another approach: Model cubes: e.g. a wall (only one square meter), a window, a corner, a roof, .... This cubes can be randomly merged together on a map. Disadvantage: Even to create a simple house you have to create 20+ cubes. Each of this cubes may need its own texture.

[Grid]

Can cubes be placed only on a grid or can the have any rotation? In a world editor it maybe easy to build up a house with single cubes, if all cubes are aligend. On the other hand all houses are then aligned too (like Sim City), but it may be a tedious (impossible?) task to build a house without creating any gap/lap.

[Textures]

If we shoot at a wall there may happen two things. The wall is destroyed completly. In this case I may see inside the neighbor wall. If I model this wall with this in mind, I will draw a texture for this missing face. Disadvantage: 99% of the time the engine has to draw/remove faces which may be never seen.
In the other case the wall may not be destroyed completly. The question that arises here. How does the model/texture looks yet? To modify a model one may use a CSG algorithm (although I dont know if there is piece of software that can do this on arbitrary models without any error). In a perfect world a 3D texture would solve this (because we can look inside an object). But a 3D texture with a size of 256 and 4 channels (RGBA) may consume up to 64 MB RAM (512 = 512 MB). Within the next 2 years I think it would be impossible to use them for game content.

[Objects]

It may be possible to create a house with cubes. But what happens with trees? cars? If the designer splits them at creation time he also has to model the interior. When I shoot at the car the engine may brake the model at this defined planes.

[Batches]

Today graphic cards are able to draw an enormous amount of polygons. But they are not able to draw an enormous amount of batches. A game which allows to move around every object is inherently slower than a game that has large objects that stay at the same location every time.

[Shadows]

It is more or less easily to calculate a perfect shadowmap (or lightmap as you like) at creation time. You may invest a day to calculate a perfect map based on some radiosity equations. No one cares, because this work is not repeated at runtime. But if you shoot at a window, everything changes. In UFO like game, you may see 10 or more lights on one screen (maybe 1000+ lights on one map). 10 lights means to render the scene at least 10 times and map this textures on the current scene.
If there is a sun, the sun may cast long shadows, a problem that is not solved, as far as I know, without introducing ugly artifacts (there are millions of shadow mapping examples with small objects).

[Physics]

Every generic physic simulation I have seen till today has problems in some situations. It happens from time to time that objects are rotating/moving not as intended, objects collide too early/late. It may not be a good idea to use this ideas to blow up a whole building.
In a FPS game you may blow up 10 objects at the same time, but in a UFO like game you may be able to blow up 100 of objects at the same time, something that current physics engine may not handle efficiently (every object may collide which every other).

There are tons of questions in my head. May be that is one reason that 99% of all games only have static environments/models. If there is more then one people interested talking about this topic I will post an overview of every game, I am aware, that has a destructible environment (and probably how they solved it).

I am happy to get response from anyone but especially from the ones who create models and paint textures. (BTW I know that my english is terrible, if there is something indecipherable I'll try to rewrite it).

Offline BTAxis

  • Administrator
  • PHALANX Commander
  • *******
  • Posts: 2607
    • View Profile
Re: Modifiable Environment
« Reply #1 on: September 18, 2007, 01:26:48 am »
Regardless the implementation, fact is that the Quake 2 engine isn't capable of handling it. For this to work, the engine itself needs to be rewritten, or alternatively, the game must be ported to an engine that does. Needless to say, both are impractically costly.

Here's how maps work:
Objects can be made up out of two things: brushes or models (well, or patches, but those aren't implemented). Models are just that - prefab models that are placed on the map in some orientation. Brushes are the "cubes" you speak of, except they can have any shape, really, as long as it is convex. Most of the map is made of brushes, and most maps have a good deal of brushes that you can't see.

Brushes can be made destructible. In theory, it's possible to make everything out of a lot of small brushes and have them be destructible individually. However, that doesn't work in practice because of two things:
1) Lighting. The destructible brushes will completely mess up the lightmap that is generated when the map is compiled.
2) Frame rate. More brushes means more faces, and that means more work for the renderer. A map made of a million small brushes would slow down the game to a crawl, if it would even work at all.

Maybe there are even issues with that which I haven't mentioned yet. But the bottom line is, it can't be done on this engine. We can (and will) have destructible objects such as windows and maybe some cracked walls, but that's about the extent of the possible.

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: Modifiable Environment
« Reply #2 on: September 18, 2007, 09:19:44 am »
if you could help with the shadow part that would be already very cool. we are using a lot of hacks to bring shadows to misc_model entities and func_breakables (breakable walls and the like).

also it would be nice to remove the creation of the shadowmap from the compiler at all - less size of every map, less compile time. of course it must be fast to create it on-the-fly. if you know more about that stuff - feel free to join us ;)

Offline BTAxis

  • Administrator
  • PHALANX Commander
  • *******
  • Posts: 2607
    • View Profile
Re: Modifiable Environment
« Reply #3 on: September 18, 2007, 12:17:24 pm »
Absolutely. Dynamic lighting is something I'd really want to see. Then we could have flare grenades to light up the darker maps, as well as cool light effects for missiles and explosions.

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: Modifiable Environment
« Reply #4 on: September 18, 2007, 04:32:40 pm »

Offline BTAxis

  • Administrator
  • PHALANX Commander
  • *******
  • Posts: 2607
    • View Profile
Re: Modifiable Environment
« Reply #5 on: September 18, 2007, 05:22:44 pm »
Looks promising. Do you think it's useable in UFO:AI?

Offline Azraiyl

  • Cannon Fodder
  • **
  • Posts: 4
    • View Profile
Re: Modifiable Environment
« Reply #6 on: September 18, 2007, 08:52:40 pm »
Sorry people, it seems that I'm not able to ask my quetions correctly. I have read a lot of threads here why the current engine never would support such things. Nevertheless you have done a very good job at extending the Q2 engine. But for UFO-AI-2 maybe the core developers chooses another engine. In 2/3 years maybe it is still not possible to create perfect shadows on the fly but a least the pixel shaders would be able to apply a gloss map, normal map, specular map with factoring in the nearest 10 lights. Maybe the graphic card vendors even start to understand that rasterizers have no future an switch to raytracers.
But besides the problems that may arise with any engine, there are more then only technical limitations. E.g. Given that we have an enormous poly count, how would a modeller build a house now, a house that is fully destructible.
« Last Edit: September 18, 2007, 09:02:10 pm by Azraiyl »

wastelandmerc

  • Guest
Re: Modifiable Environment
« Reply #7 on: September 18, 2007, 10:11:08 pm »
Is there any free/open source engine with destructible environment?

Offline Azraiyl

  • Cannon Fodder
  • **
  • Posts: 4
    • View Profile
Re: Modifiable Environment
« Reply #8 on: September 18, 2007, 10:24:44 pm »
This is a question about an engine again. CrystalSpace, Irrlicht, Panda3D, ... all of them are able draw anything. If you invest some time you may be able to allow destructible environments (as described you never will have a frame rate like a FPS). Before you google for an appropriate engine you have to define the word destructible. That is the reason why I am writing here. I'm not a pro 3D programmer but I currently play around with some ideas. Maybe I will put together a amazingly simple show case to better describe that there are some underlying problems that have nothing todo with an engine (but with algorithms, modeling and texturing).
« Last Edit: September 18, 2007, 11:12:07 pm by Azraiyl »

Offline BTAxis

  • Administrator
  • PHALANX Commander
  • *******
  • Posts: 2607
    • View Profile
Re: Modifiable Environment
« Reply #9 on: September 18, 2007, 11:00:10 pm »
Something to point out here is that UFO:AI isn't being developed with the state of the art in graphics acceleration in mind. So even if a problem can be solved by new hardware that will appear on the market in the next few years, that really isn't relevant to the issue because we want the game to run on as many computers as possible, not just on the ones that have the latest technology.

Of course, if there are workable software solutions and if there's someone with the skill and the time to implement them, we may be on to something.

Offline Winter

  • Captain
  • *****
  • Posts: 829
    • View Profile
    • Street of Eyes: The Writing of Ryan A. Span
Re: Modifiable Environment
« Reply #10 on: September 18, 2007, 11:08:28 pm »
I think he's asking if there's going to be destructible environments in some kind of sequel to UFO:AI.

Which, to my knowledge, is not in the plans at the moment. :P

Regards,
Winter

Offline Azraiyl

  • Cannon Fodder
  • **
  • Posts: 4
    • View Profile
Re: Modifiable Environment
« Reply #11 on: September 18, 2007, 11:19:11 pm »
"I think he's asking if there's going to be destructible environments in some kind of sequel to UFO:AI."

That doesn't matter. Maybe it is really an awfull idea. But let a least talk about it.

"So even if a problem can be solved by new hardware that will appear ..."

As written more then once, lets talk about the "not engine related" problems of destructible environment. Because I'm not an artist I think only on a technical level. But there are tons of other problems.
   
It is really so unclear about what I like to talk? I'll try to explain it with a simple example.



1. I box as it may appear in every game. It has 6 faces (12 triangles). Most people do not ask the question? What is inside the box. But if the box is destructible the designer has to.
2. If you shot at the box an engine has several options to deform this box. As an example the engine splits the box.
3. Problem you may see here. The wood is infinitly thin. In fact you wouln't see 3 faces in this examples because the face normals point in the opposite direction.
4. Another approach is to use CSG. The missing faces are replaced with appropriate ones. But is this texture correct? No.
5. This is maybe the best one, but I had to draw it by myself. (But the texture is wrong at the intersection plane)
« Last Edit: September 18, 2007, 11:31:46 pm by Azraiyl »

Offline Wilko

  • Cannon Fodder
  • **
  • Posts: 3
    • View Profile
Re: Modifiable Environment
« Reply #12 on: July 28, 2008, 03:15:22 am »
Has there been any update on destructible environments, I know this thread is a little old but there has been alot of development done since the OP.

Offline BTAxis

  • Administrator
  • PHALANX Commander
  • *******
  • Posts: 2607
    • View Profile
Re: Modifiable Environment
« Reply #13 on: July 28, 2008, 10:36:12 am »
Nope. Destructible environment is not, and will not be a big part of the game.

Offline TroubleMaker

  • Squad Leader
  • ****
  • Posts: 114
    • View Profile
Re: Modifiable Environment
« Reply #14 on: July 29, 2008, 12:33:49 pm »
My 2 eurocents :-)

Well, drawing the blown objects in runtime is seems to be unsolvable prolem with Q2 engine.

But may be there is a "pseudo-destructible environment" solution? I mean: object which is broken by any means (shot, blown etc) must be replaced with ANOTHER object, another model.
Let me explain. Have you played UFO:AM, where spores-infected Earth almost freed of human species? On some bases there are lifting platforms to deliver aircrafts from underground hangars. And some times these platforms carries the planes on itselfs. I can hit a plane with any explosive weapon - from hand grenades to rocket- and plasma-grenade launchers. And plane will go thru 3 stages of being: normal state, broken plane, pile of debris. Latter may be annihilated at all, makes the platform "virgin clear"

So, why similar approach can't be used in UFO:AI? We not to re-render new model's state, we can have it pre-rendered!