View Full Version : Procedural levels - possible?
11-16-2009, 04:16 AM
Is there any way to load prefabs into a scene at given positions/orientations specified by code? What I'm trying to do is procedural levels constructed out of readymade prefabs. Is this at all possible?!
11-16-2009, 05:03 AM
What you're describing is essentially how level actors work in Unreal. Everything is described in code, and you can see this if you place a static mesh somewhere in a map manually and then export a t3d file. Look at the t3d in a text editor and you see how the instructions work. So you could very easily call in a bunch of static meshes or whatever you want purely by writing code instructions if you know how the code works.
You could then conceivably make an unrealscript to load a set of assets in (and out) statically or with varying degrees of randomness. I know some people have created mutators that do this for UT, for instance relics that appear in random places then disappear again. You could make them appear or disappear based on their proximity to you, if that's what you want....
11-16-2009, 08:15 AM
Do you mean random generation like Diablo has?
11-16-2009, 12:34 PM
There's a map that did this for UT2004 that had the walls move... the problem is making sure you have desirable permutations...
11-16-2009, 12:58 PM
Do you mean random generation like Diablo has?
Well what I want to be able to do is procedurally create interior levels. Not dungeon style but more like the interior of a building- from room generation and placement to populating the rooms intelligently with prefab assets (I've already written code to generate rooms and place them in the building). I guess this doesn't need to be done whilst the game is running - that would be good though.
I'm am now under the impression that this is possible by:
1. Writing some code which takes my generated scene and creates the correct t3d file for it
2. Import the t3d file into unreal editor and build it
Any t3d documentation would be useful though as I can't seem to find much at all!
11-16-2009, 01:11 PM
This thing done in runtime would result with no lighting, as this part is done by editor. You can bake all lights to textures and use static meshes with sections of rooms (like for eg. aurora engine for NWN did), but then you lose all pretty stuff like lightmass.
In editor this should be possible, but I am not sure if you can run unreal script from inside editor that can add static actors to level. I know spawning actors in game during runtime works fine, so there is hope it can be done for static objects.
11-16-2009, 04:11 PM
If it's inside, it should be fine to have them lit dynamically, but this of course depends on the quantity of items you have in the room.
11-18-2009, 08:28 AM
Look into "SNIPPETS" some new thing Hourences started using to post tutorial examples of levels. This looks exactly like functionality you need, sorrry i do not know much more about it yet, besides that you can export your level as text SNIPPET and then copy/paste text file inside editor.
03-08-2010, 05:05 AM
Hi there! Any progress made yet? I'm looking for something like this, too. I'd like to use UDK for creation of maps from Dwarf Fortress world data (only part of it, not the whole world that would be far to much). For those who don't know Dwarf Fortress: it's a rogue-like rpg/city-building-sim/economy-sim/community-sim... well, there's hardly anything you CAN'T do with it. Aside from loving the optical presentation which is "simple", to say the least.
I would like to build 3D walkable maps from the data of the game. That includes:
* different items
As a start, walls floors and ceilings would be enough. Just to be able to walk through the halls created by your very own dwarven folk.
So, to create this map I need more or less detailed block elements that are put adjacent to one another, depending on the cell data of the DF map.
Such a map cell can be:
* empty space
* empty space with floor
* ramps/stairs of three different types: up, down, or up AND down
* totally solid
Furthermore solid cells have a material and a status. Materials reaching from several wood types over even more stone types to a bunch of metals. Status might be engraved, smoothed, rough and the like.
I don't want to put all of this into the map. Just a small part of it to simply be able to walk through a fortress. So step one would be to construct a map from simple block brushes that are
* cubes for solid cells
* flat blocks of a fixed height for empty cells with floor
* blocks of one of seven fixed heights for the seven possible water levels
I have already tried to put a map together by just creating a T3D file similar to one that the UDK editor has exported. But I have got some problems with it. Either it happens nothing, no level data is imported, or the UDK editor crashes.
What I need is a way to debug the generated T3D file and see where the errors are. A crash is not very helpful.
03-08-2010, 05:17 AM
isn't Solid snake trying to do something like that ?
03-08-2010, 05:26 AM
You can add a button to the editor that can run whatever code you'ld like by subclassing BrushBuilder. I'm not sure what the limits of script are in the editor environment, but you should be able to create static meshes and such. So that may be a good entry point for editor-time procedural generation.
SeveQ, all I can recommend is to make some simple test data - have some very small dwarf fortress maps (a 1x1, maybe up to 10x10). Hand make the equivalent UDK maps. Then it is just a matter of working your generator to produce the exact T3D from the UDK maps for the equivalent dwarf fortress maps. Use a text diff utility to check what differences there are. Also check launch.log when the editor crashes to see if there is a salient error recorded.
03-08-2010, 04:32 PM
Well, I would give it a try but... It's disturbing somehow to see UDK editor crashing on import of maps that it self has just exported.
Launch.log tells me nothing about the crash as the crash doesn't appear while launching but on import of a T3D file.
I have uploaded a RAR file that contains two T3D maps. One exported from the editor itself (Level5x5) and the other one generated by my test case application (TestMap). You can download it here: http://rapidshare.com/files/360778559/Level5x5.rar My UDK editor crashes on both!
Perhaps somebody could have a look at them and tell me what's wrong... I haven't managed to fully understand the format yet. Thank you very much!
03-09-2010, 07:23 AM
launch.log isn't just information on the launch, it contains all log statements from a UDK session (game or editor).
The pertinent error that I can see is
Critical: appError called: Renaming an object (Package Package_1) on top of an existing object (Package Package_0) is not allowed
tldr: Use Import into Existing Map rather than New Map, and the crash won't occur.
The problem seems to be related to importing maps using existing Package names, and your maps using Package_0 is the name for the first unsaved map per editor session. The editor crashes if the imported a t3d into a new map and the t3d has stuff in an existing package, apparently. Using a different name instead of Package_0 helps, although you can only import one map with each name per session. Or just use Import into Existing Map (after creating a new map) and avoid the problem completely.
I don't recall this happening in UT3 or earlier though - although I usually imported into existing maps anyway.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.