How do you cycle through all the children of the intersection ? With a for loop ? Probably … LOL
No I didn’t look at those yet. I have to check those out soon.
It gets kind of complicated because since I added the intersections it’s overlapping a lot more than before.
I’ve been watching this thing build roads automatically for hours. LOL
Here is the updated version. When I added a free camera I realized the segments were not properly aligned.
See if you can figure out the intersections script but I see way more overlaps now. It also depends on how many curved segments and intersections you feed into it. More intersections gives more overlaps. I have to try different designs on the segments.
Your script is hard for me to understand.I did a little regular python programming but i am still a noob.I use logic bricks instead.Maybe i will get back to that but not now.All i can do is make suggestions and provide resources.
I would probably as easy as i could do it.Even if i knew python really good.
And here the file with 4 types of intersection segments (T-Y-X-O). Unfortunately the script is not using more than one node/child and intersections have more than one link node. So yeah, it’s a good programming challenge for the more advanced ones. I’ll have to try the scripting part too. At some point.
LostScience , you want bridges and tunnels and highways going above one another ?
I’ll have to add a few I guess but highways also need on/off ramps so it gets pretty complicated.
Hey , I managed to make it expand from all children I just had to use pop() to prevent runaway effect. It took me all day. LOL
I will have to read your script for a long time to figure out what’s what.
Mine is doing it completely different. Check autoAlignF8.
What I wanted to do was collect all children in the scene and add road segments there randomly but that created a feedback runaway effect because each spawned segment brings in it’s own children.
Ok so now that your road builder works, what’s next ? How do we add buildings in between or terrain ? Or should we do the one from the Unity 3D video ? The idea is to make it into a full city somehow. Like a mini clone of GTA 4 or something. The only difference is, this one would be completely open to modify. GTA 4 is not very easy to modify. It’s not generating roads for you at all.
Main point , listen: Make your tiles all square
Make the connections standard
Don’t make the road segments randomly , otherwise the whole logic becomes too hard to make any use of it later.
You can use use logic brick (collisions(road)-and-endobject) and build your road system,
but what do you do after that? It’s a hard do manage mess…
I would suggest doing it by hand first by cutting out squares out of paper first.
Tiles would also be most easy for other people ( kids as you said) to understand.
To make the squares match, just put the empties where the roads on the tiles are,
it’s the same system you put together.
You can start by having special building tiles that you add on the side of the road
You can have special empties on you tiles can spawn buildings or other assets on them
You can stack tiles
[/LIST]
Or should we do the one from the Unity 3D video ?
I want you to use or create the assets that are satisfy the problem and you.
We can use the texture from the video , as it was free?(didn’t watch it ) if you want…
The thing is there is not much difference, a tile(in sense) is a shape and a rule, it is not a texture always.
GTA not generating roads for you at all.
Well, their design was not a editable world but a copy of the real world
That is why they had to do it by hand beforehand.
A random world would need rules to be able to harbor a city and roads.
[LIST]
Almost all building type stragegy games like simcity/transport tycoon/anno have a grid on top of which there are tiles.
In real world we flatten ground, define borders of things already built and don’t let matter occupy same space.
The thing is, from the way your script is generating is not leaving much room for buildings or sidewalks but it’s doing it nice.
Do we have to place buildings before the road gets generated or after ?
I think I get it now. All those road segments are always centered on the tile so it always fits properly as long as the rotation is ok.
And all tiles need to be the same size.
Its not the script, its the tiles. It depends how we ( you ) want to design the tiles.
Yeah we would after placing a road tile reserve some empty tiles for buildings.
Also you can add buldings on a road tiles: a map tile can have its own sub tiles ( buildings ).
Yup, basically that.
The funny part is how do you define grid if your objects (obj.worldPosition) is not centered in the tile.(per your design)
Hopefully you get how that is handled in logic…