Alright, so i fully intend to dive into making a city generator of my own (post-modern/sci-fi though), and hopefully output something good enough for the marketplace. I hope I’m not stepping on any toes doing that xD
Ill be sure to post my progress here and on the forums and keep you guys updated on my progress (or lack thereof)!
As for the road network generator, I’m planning to go with zoltans suggestion of branching splines, multiplying at procedural intervals, each branch procedurally devolving into a lesser and lesser tier of road. I figure setting up 2 or 3 main roads would give me a good network. I just need to figure out when to stop the branches from generating any more road.
@6ixpool: That’s awesome, dude! Looking forward to seeing what you make. Please toss me a link if you make your own thread so I can follow along, otherwise you’re welcome to stay here.
Wow seeing some interesting stuff happening while I am out for a few days!hah
I made a bit of progress with mine last week but I started focussing on the building construction again now rather than the roads.
I grabbed the Medieval village pack and I am using the building parts from that as my initial assets. Doing everything based on size and using while loops to create the floors an exterior walls, grabbing from a datatable to randomly place the walls and floor pieces based on the size of the building. It will attempt to use the least amount of meshes possible for the floor to simplify things. EG. I have a 1x1 floor block, a 1x2, a 2x2. So if it is 4x4 in size then I can use 4 2x2 floor pieces as opposed 16 1x1 pieces. I still convert over to instanced meshes but it does the trick.
Also for my initial generation I am just using placeholders which is just a cube mesh that gets scaled to the size of the random width,depth, floors of the building. I can then tweak it’s position and rotation and change it’s variable if I want. Then when I am happy I can on the individual building spawn it’s parts, or I can use my CityGenerator controls to convert all placeholders on the map into full buildings.
With this way as well I can also spawn blueprint actors in the buildings so that I can have interactive items, movable doors etc etc. Handy for having lights placed and automatically turn on at night and whatnot.
Hah yep it is all too easy to overcomplicate things, then when you eventually find that simple solution to it you just want to smack yourself in the face for wasting so much time! haha
So this is just the spline track from the learn tab all i did was add my make circle function on top of everything in the cs script
But, what im trying to do is set this up so that the road changes its rotation based on the floor. I’m not sure its even possible because you cannot access spline points rotation in bps and you cannot access the spline handles from bps either. I thought about the tangent of the spline point, but the spline is tangent to the floor already…
Edit 2 : i figured out that the bp spline track has a bank float that was overriding my calculations, it now works
Got zoltans instantiator to work! The lack of documentation made things 10 times harder than it should be, and I ended up having to step by step reverse engineer that one picture zoltan posted to grasp how the mechanism works.
Quick question though, do instanced meshes work with LODs?
Extending from zoltans idea, I kinda eventually wanna build a “dynamic regenerator” script. So as the player walks around the city he regenerates buildings with in a certain range so he can interact with fully scriptrd actors. This also opens up the possibility of allowing each building to have indoor spaces that are fully interactible I imagine. I’m just wondering how expensive storing all the class definitions in memory would be…
You will want to convert it over to Hierarchical Instanced Static Meshes so that you can take advantage of LOD’s. I have done that with mine already. You also need to save in a custom struct the array information so that when you reload it still exists, otherwise once the construction script runs they will all get destroyed.
All the interactive objects in mine remain as regular actor blueprints rather than converting them to instances, but i suppose if you have thousands of them then using an instanced mesh and converting it back once the player gets in range this could speed things up a bit
Hey guys! I’d like to ask how you guys would approach the problem of corners for the “building generator”.
Currently, my system uses “lego block” style segments to make the builder as flexible as possible. My current solution for corners is to have a specific mesh for the corner pieces. I feel like theres a creative (and more efficient!) solution thats just right under my nose. I am limited however by the need to have the structure be functional once assembled (meaning each segment has an interior).
Any thoughts on a better way to approach this problem?
What’s wrong with using a specific mesh for it? That’s how I am doing mine. I have an array of corner pieces and it will pick 1 that fits and place it. It then starts the next wall piece from the end of the corner piece and goes along till the next corner
I have all of my “parts” in multiple data tables. EG. Floor,exterior wall,interior wall,exterior door,interior door,corner and multiple different roof 1s.
I use the same data table for all of the different 1s and just have a ENUM in there which is for the different themes. Medieval, modern, country etc. Then I just do a random and make sure it’s of the same ENUM I have declared in the city type during the generation. You could always just split up the data tables as well into modern-floor, country-floor etc.
I mean hardcoding how the buildings are assembled from blocks. This is to achieve specific “architectures” for buildings. Like if a skyscraper should branch out into two towers. Or if you want spires that progressively taper down in thickness as it goes higher. That sorta logic needs to be hand built into the code right? Unless I’m missing something obvious…
I was looking into cellular automata to try and automate building generation further. With just a few parameters to tweak (rules for when to spawn a building segment, and when not to spawn anything, and what block to spawn depending on what sorts of block are adjacent) you can end up with very interesting outcomes. I find though, at least from a theorycrafting perspective, that the results would either be too ‘rigid’, or too ‘organic’. Could be good if the art style you’re after is like a hyperfuturistic “machine as organism” sort of vibe (think the machine city from “The Matrix”). Any input from anyone thats tried a similar approach?
Also, yeah i agree now. Corners are pretty essential for a “voxel” based approach to work. Its a good thing you only need 1 corner for each block style too. At least for me since my voxels are cubes.
As a last aside/rant, Im running into alot of bugs just trying to implement even the simplest of systems! Ive forgetten just how hairy coding can be it seems xD