dynamic map generation
-
- Posts:4
- Joined:2012-08-26, 16:30
Here is a question for all you smart people,
i want to make a dynamic map, that has say a "foyer" which is the same each time you start, but from there every "room" is randomly chosen, rendered, and interactive with random NPC's if the room meets the right conditions
can this be done with this engine or should i be looking into some other engine
or is there another way this can be done
also is there some sort of AI and NPC's
i and not much of a programmer ... well i an teaching myself everything so far and I'm sure like most programmers making it up as i go along
i want to make a dynamic map, that has say a "foyer" which is the same each time you start, but from there every "room" is randomly chosen, rendered, and interactive with random NPC's if the room meets the right conditions
can this be done with this engine or should i be looking into some other engine
or is there another way this can be done
also is there some sort of AI and NPC's
i and not much of a programmer ... well i an teaching myself everything so far and I'm sure like most programmers making it up as i go along
Re: dynamic map generation
Hi diablos821,
welcome to the Cafu forums!![Welcome :welcome:](./images/smilies/welcome.gif)
Randomly creating monsters/NPC's is easy. For example, you could modify the
"Random rooms" is more difficult. If your "foyer" can act as a hub, where for example the player walks into a (closed) door or into a portal or into a similar mechanism where you load the "next level", then selecting the next level on random (and having the player return to the "foyer" level after that), is relatively easy to accomplish, too.
It would even be conceivable to have all rooms that are available for random selection in the same map, where the player would teleport from the foyer into a random room, then back into the foyer. This solution is similar to the one above, but without the loading pauses. (If you have really many or really big rooms, overall resources might eventually become a challenge.)
For an even more seamless method, I'm afraid that I can at the moment not think of a convincing solution.
![Wink ;-)](./images/smilies/icon_wink.gif)
![Thumb Up :up:](./images/smilies/thumbup.gif)
welcome to the Cafu forums!
![Welcome :welcome:](./images/smilies/welcome.gif)
Well... I'd say it depends on what exactly you want, and what is an acceptable solution for you:diablos821 wrote:Here is a question for all you smart people,
i want to make a dynamic map, that has say a "foyer" which is the same each time you start, but from there every "room" is randomly chosen, rendered, and interactive with random NPC's if the room meets the right conditions
can this be done with this engine or should i be looking into some other engine
or is there another way this can be done
Randomly creating monsters/NPC's is easy. For example, you could modify the
EntMonsterMakerT
entity class for this."Random rooms" is more difficult. If your "foyer" can act as a hub, where for example the player walks into a (closed) door or into a portal or into a similar mechanism where you load the "next level", then selecting the next level on random (and having the player return to the "foyer" level after that), is relatively easy to accomplish, too.
It would even be conceivable to have all rooms that are available for random selection in the same map, where the player would teleport from the foyer into a random room, then back into the foyer. This solution is similar to the one above, but without the loading pauses. (If you have really many or really big rooms, overall resources might eventually become a challenge.)
For an even more seamless method, I'm afraid that I can at the moment not think of a convincing solution.
The built-in AI is extremely simple, see the Trinity bot in the TechDemo map. There is no principal obstacle that prevents improving it, though.also is there some sort of AI and NPC's
![Wink ;-)](./images/smilies/icon_wink.gif)
Yes, this is a good way to learn!i and not much of a programmer ... well i an teaching myself everything so far and I'm sure like most programmers making it up as i go along
![Thumb Up :up:](./images/smilies/thumbup.gif)
Best regards,
Carsten
Carsten
-
- Posts:4
- Joined:2012-08-26, 16:30
Re: dynamic map generation
Um i'm not to sure what would work the best... Ill try to expand on what i meant,
Okay say you load a map called "hotel assault", which would start as a basic generation of a hotel lobby which includes the lobby with a restaurant and a few conference rooms to the side and is the same every time, now when the player(s) goes to the lift or stairs to go up or down this is where things would get a little difficult.
The map gen decides the layout of the hallways on each floor, most of them at least mimicking the plan of the floor beneath, as you would find in a hotel. Thinking along the lines of most FPS games the level generations are always static, the layout of the levels are the same. I was wanting to create the game levels in a modular fashion. where going from one section to the next flows as seamlessly as it possibly can without the need for teleporters, portals and loading screens. going back to the hotel analogy, say the player walks up the stairs without knowing the layout of the hotel the best way to find it is to open and look through the door. They then step through as they would any other door and go, with the map generator having already decided what rooms are accessible and the randomly chosen layout of said rooms.
So if the portal solution can work in the sense of seamless transition from one doorway to the next then that might work however what sort of limitations would i find with that solution? the only problem that i could think of is that what if the map gen chose 2 "rooms" the same, what would happen to one would happen to the other, due to the portal linking to the same room basically.
this method of map gen could be applied to any "style" of level, eg: warehouse, hospital, school etc etc....
thanks heaps for all your help and ideas. i really think that if we manage to make a game with a truly dynamic map generation, it would make a tactical fps much more interesting and have a lot more replay value
Okay say you load a map called "hotel assault", which would start as a basic generation of a hotel lobby which includes the lobby with a restaurant and a few conference rooms to the side and is the same every time, now when the player(s) goes to the lift or stairs to go up or down this is where things would get a little difficult.
The map gen decides the layout of the hallways on each floor, most of them at least mimicking the plan of the floor beneath, as you would find in a hotel. Thinking along the lines of most FPS games the level generations are always static, the layout of the levels are the same. I was wanting to create the game levels in a modular fashion. where going from one section to the next flows as seamlessly as it possibly can without the need for teleporters, portals and loading screens. going back to the hotel analogy, say the player walks up the stairs without knowing the layout of the hotel the best way to find it is to open and look through the door. They then step through as they would any other door and go, with the map generator having already decided what rooms are accessible and the randomly chosen layout of said rooms.
So if the portal solution can work in the sense of seamless transition from one doorway to the next then that might work however what sort of limitations would i find with that solution? the only problem that i could think of is that what if the map gen chose 2 "rooms" the same, what would happen to one would happen to the other, due to the portal linking to the same room basically.
this method of map gen could be applied to any "style" of level, eg: warehouse, hospital, school etc etc....
thanks heaps for all your help and ideas. i really think that if we manage to make a game with a truly dynamic map generation, it would make a tactical fps much more interesting and have a lot more replay value
Re: dynamic map generation
I think what you're wanting to do can be accomplished using the script, but I think you'll need to define some new static "room" objects as well, and some kind of marker object to indicate where the randomized rooms should go.
Try this simpler example: Let's say you've got a map consisting of a hotel's hallway, with doors that will lead to randomized individual hotel rooms. You've also got 3 room entities defined; say a single bed room, a double, and closet. In the map, I think you'd need a "random room entity" marker (defined in the EntityClassDefs file?) placed where the rooms should go, and then the associated map script would just spawn one of the 3 room entities anywhere it saw the room entity marker.
This would give you the same hallway every time, but every time the map was loaded, you'd have a different room behind each door. Is this closer to what you're after? You can expand on this with hallways (you'd need a straight hallway mesh, an L-bend, a T-intersection, and a four-way; along with variations with a door in each wall), larger rooms, stairs, etc.; but the basic idea would be the same - static markers in the map file that the script uses to place random room entities.
...now that I think about it - if you let the players change the room types while the game's running, you could have a "dungeon keeper"-esque kind of mod! Just join a series of these markers in a grid, keep most of them closed off, and add/remove walls as they "dig" out a section by interacting with the walls. Not quite what you're asking, though![Razz :P](./images/smilies/icon_razz.gif)
Try this simpler example: Let's say you've got a map consisting of a hotel's hallway, with doors that will lead to randomized individual hotel rooms. You've also got 3 room entities defined; say a single bed room, a double, and closet. In the map, I think you'd need a "random room entity" marker (defined in the EntityClassDefs file?) placed where the rooms should go, and then the associated map script would just spawn one of the 3 room entities anywhere it saw the room entity marker.
This would give you the same hallway every time, but every time the map was loaded, you'd have a different room behind each door. Is this closer to what you're after? You can expand on this with hallways (you'd need a straight hallway mesh, an L-bend, a T-intersection, and a four-way; along with variations with a door in each wall), larger rooms, stairs, etc.; but the basic idea would be the same - static markers in the map file that the script uses to place random room entities.
...now that I think about it - if you let the players change the room types while the game's running, you could have a "dungeon keeper"-esque kind of mod! Just join a series of these markers in a grid, keep most of them closed off, and add/remove walls as they "dig" out a section by interacting with the walls. Not quite what you're asking, though
![Razz :P](./images/smilies/icon_razz.gif)
-
- Posts:4
- Joined:2012-08-26, 16:30
Re: dynamic map generation
all i have to say is that's exactly what i was wanting to do, but would these entity markers cause some kind of loading screen or "portal" to another room, or would it still work as walking up to a door and opening it.Stoo wrote:Try this simpler example: Let's say you've got a map consisting of a hotel's hallway, with doors that will lead to randomized individual hotel rooms. You've also got 3 room entities defined; say a single bed room, a double, and closet. In the map, I think you'd need a "random room entity" marker (defined in the EntityClassDefs file?) placed where the rooms should go, and then the associated map script would just spawn one of the 3 room entities anywhere it saw the room entity marker.
that would be just a natural extension of the basic map genStoo wrote: This would give you the same hallway every time, but every time the map was loaded, you'd have a different room behind each door. Is this closer to what you're after? You can expand on this with hallways (you'd need a straight hallway mesh, an L-bend, a T-intersection, and a four-way; along with variations with a door in each wall), larger rooms, stairs, etc.; but the basic idea would be the same - static markers in the map file that the script uses to place random room entities.
if all that works
can you walk me through how to do something like that.
Re: dynamic map generation
While Stoo's description is technically right and very appealing, afaik this has never been tried before, and I fear that the actual results and current implementation may (initially) not meet the expectations.
For example, light from static (lightmapped) light sources will certainly not propagate from the floor through the doors into the rooms (but to be fair, this restriction also applies with the other alternatives that I suggested).
My biggest concern though is if physics (including normal movement) would properly be applied when the player walks in room entities (rather than in the world entity, as usual), and if everything behaves and "scales" as expected, especially if there are very many instances of such rooms, and/or if the geometry of the rooms is large and happens to be very complex. For example, as room entities would be embedded in the containing world entity, the room entities PVS would also be embedded in the worlds PVS. Same for the clipping, physics, etc. It likely works well, but I can think of some facts that I'd prefer to check if I was to implement it like that.
These factors were much less a problem if some teleportation trick was used, ideally implemented in a manner such that the player doesn't notice it. Using teleportation is simple, because the teleportation would be the only unusual element in the implementation of the map, keeping all the other well-established and battle-tested techniques in place.![Wink ;-)](./images/smilies/icon_wink.gif)
Having the player not notice it would require some creativity, for example by modelling small parts of the foyer together with the exit of each room, so that when the player walks from the room back to the door, he sees the fake-part of the foyer, before the teleportation actually takes him there.
For example, light from static (lightmapped) light sources will certainly not propagate from the floor through the doors into the rooms (but to be fair, this restriction also applies with the other alternatives that I suggested).
My biggest concern though is if physics (including normal movement) would properly be applied when the player walks in room entities (rather than in the world entity, as usual), and if everything behaves and "scales" as expected, especially if there are very many instances of such rooms, and/or if the geometry of the rooms is large and happens to be very complex. For example, as room entities would be embedded in the containing world entity, the room entities PVS would also be embedded in the worlds PVS. Same for the clipping, physics, etc. It likely works well, but I can think of some facts that I'd prefer to check if I was to implement it like that.
These factors were much less a problem if some teleportation trick was used, ideally implemented in a manner such that the player doesn't notice it. Using teleportation is simple, because the teleportation would be the only unusual element in the implementation of the map, keeping all the other well-established and battle-tested techniques in place.
![Wink ;-)](./images/smilies/icon_wink.gif)
Having the player not notice it would require some creativity, for example by modelling small parts of the foyer together with the exit of each room, so that when the player walks from the room back to the door, he sees the fake-part of the foyer, before the teleportation actually takes him there.
Best regards,
Carsten
Carsten
Re: dynamic map generation
Quite true! I'm planning to implement something similar to what you described, but not for quite a while yet - I've got a lot of other groundwork to cover before I get to the point of generating new areas! I'd basically satisfied myself that something like this was technically possible, and moved on to more immediate concerns. Certainly, any time you try to use software in an unexpected fashion like this, you can expect to run into unexpected problems - take my advice more as "this is an area you might explore", rather than "this is the way!" (I hadn't even thought about the lighting passthrough... could you get around it by creating a light object at every room position? Not real good for mood, though...)Carsten wrote:While Stoo's description is technically right and very appealing, afaik this has never been tried before, and I fear that the actual results and current implementation may (initially) not meet the expectations.
That said, the best way to start is to get started! If I remember right, the base download should include the mapping software; and most of what we're talking about (aside from new entities) I think is doable entirely from map scripts - which just need a text editor. Have you played with the mapping tutorials at all yet? I think the best way to start would be to create a new map to start testing different methods in - get your starting foyer area (with doors) set up, and let them initially just open into open space (just be sure it's all contained in a "world box" - I have no idea what kind of errors you'll run into if you let it leak! The tutorial covers this.)
Once you've got that set up, go ahead and try something - set up a few "random rooms" and triggers to teleport a player to, to try Carsten's technique (I believe there's a "trap trigger" script you can use for a trigger example, and another map already teleports you, so you have an example of that as well). Or, have the map script set up to just drop some existing static objects behind doors when the map loads (to see if you can drop a static entity without strangeness) to try mine (just hard-code the locations for now - you can worry about making them correspond to map elements once the basic idea works). Or, once you start exploring how everything works, you might find another way to do what you're ultimately after.
Re: dynamic map generation
Cafu already supports "elevators" partially... you could mod that into teleporting entire chunks of map in the form of ent groups around the place to rearrange the world.
Teleporting would also be useful because you can make the world seem infinite... until people bumped into each other, that would be trippy.
Teleporting would also be useful because you can make the world seem infinite... until people bumped into each other, that would be trippy.
Re: dynamic map generation
Is right... even you can find a map that has an elevator :pHWGuy wrote:Cafu already supports "elevators" partially... you could mod that into teleporting entire chunks of map in the form of ent groups around the place to rearrange the world..
Simón Carreño AKA Scorphame.
Leader & Game Designer at HeXentic Games
Leader & Game Designer at HeXentic Games
-
- Posts:4
- Joined:2012-08-26, 16:30
Re: dynamic map generation
so is there any chance of a working example? or a detailed guide to make this work... or try to make it work
Re: dynamic map generation
I'd like to provide you with a working example, but unfortunately, I don't have sufficient spare time at the moment to create one myself.diablos821 wrote:so is there any chance of a working example? or a detailed guide to make this work... or try to make it work
However, as has been pointed out above, there is an example map that demonstrates simple teleportation (BpWxBeta), and another one that has trigger brushes (TestPatches).
If you look into those, you'll learn as much (or more) as with a ready-made example, and it will help you with creating your actual game maps.
I'll happily answer any related questions, though!!
![Thumb Up :up:](./images/smilies/thumbup.gif)
Best regards,
Carsten
Carsten
Who is online
Users browsing this forum: No registered users and 149 guests