slapin Posted August 14, 2017 Share Posted August 14, 2017 Hi, all!Using torque3D, what approach should be about dynamically-generated worlds, i.e. random-generated dungeon?How can I add world parts to a scene while game is running?Thanks! Quote Link to comment Share on other sites More sharing options...
Duion Posted August 14, 2017 Share Posted August 14, 2017 Easiest system would probably a grid based tile system, so you can place and remove tiles through script.Objects can be created from script with "new TSStatic()" search for that term, in the tools folder there is a function like this to place objects in the scene already, you can copy that code. Quote Link to comment Share on other sites More sharing options...
slapin Posted August 14, 2017 Author Share Posted August 14, 2017 Thanks a lot! Please point me where to hook a script which runs at scene load but before sceneis visible, so camera will not see how level is cinstructed?Also is it possible to build navmesh dynamically? Quote Link to comment Share on other sites More sharing options...
slapin Posted August 14, 2017 Author Share Posted August 14, 2017 i.e. I want dungeon monsters to navigate navmesh freely and find player without problems,,, :) Quote Link to comment Share on other sites More sharing options...
Duion Posted August 14, 2017 Share Posted August 14, 2017 I would suggest you to get Torsion for Torquescript debugging, then you can create a breakpoint and step through the scripts and then you can decide where you hook your scripts up.You can rebuild a navmesh dynamically, try it in the editor, for example you can select a single tile and rebuild it, you would need to trigger it ingame somehow for each tile that changes. Quote Link to comment Share on other sites More sharing options...
Phantom139 Posted August 18, 2017 Share Posted August 18, 2017 Oh, this sounds like fun, and also similar to something I tested out for Tribes way back in the days of the old construction mod.Procedural generation is reliant upon a tile set, or a list of objects from which the generator may select from. So, for your dungeon generator, you'll create a large number of tiles (Start with a small amount and branch out), including the following "bins":Starting RoomRoom (2 Doors, 1 Entry, 1 Exit)Room (3 Doors, 1 Entry, 2 Side Paths)Room (4 Doors, 1 Entry, 3 Side Paths)Connector (Hallways if you'd rather)Dead EndsExit Room The generator itself will be coded to place each of your tiles within one of the above "bins", then the fun part. You'll have the generator start by randomly selecting a starting room tile, then randomize the number of rooms to reach the end. From here, you'll establish a selection from the connector and room bins (Randomly selecting 2, 3 or 4). When it selects a room with multiple routes, it will have another random element to decide how far it will reach away from the "designated path", and then continue branching out. Once the end is reached, select a tile from the exit room and voila.As for the tiles themselves, this will require a bit of work on both the script side and modelling side, which is why some good debugging techniques will be required here as you'll need to get the room sizes and scales down precisely as such the flow looks good.For generation prior to loading in, just have this occur during the pre-game time frame, or if you need it during the active game time, just have the camera at a different location with a GUI element over the screen specifying the user to Please Wait.Navigation meshes should make use of the Recast module that Daniel Buckmaster provided to the engine a while back, you can easily detect the size of your generated dungeon and stretch a mesh over it and have Recast generate nav points for your AI very easily that way.It's no small task by any means, but I think it will be well worth it for your project in the long term to have something like this. Good luck! Quote Link to comment Share on other sites More sharing options...
Mack Posted August 18, 2017 Share Posted August 18, 2017 Gibby (along with help from the Torque community) created a Random Sequence Generator which randomly picked models from a list (without duplicates) in order to generate a randomized city environment.Code:http://www.garagegames.com/community/forums/viewthread/136423/1#comment-855784Blog:http://www.garagegames.com/community/blogs/view/22626The same method could be applied to randomly generate any environment. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.