SFM City/Town Road Layout Script?

So I’m working on a scenebuild of part of a made-up city. I’m on the road setup at this moment and its a slow “road” to completion with only doing half a huge void map. I came across an idea when looking at Simcity town layouts if it was possible to create a script sorely on road layouts to quickly recreate towns or parts of a major city without using Hammer. I have no skills on creating such a script, but what if it took a couple of already completed road models (Mask’s scenebuild roads spring to mind), had a standard grid-map on how its gonna look based on how big out want it (3x3, 8x4, 8x8, etc with possible turns in the middle) and where you were going to place it based on your camera position? The size of the roads itself would be determined on what the size of the original road models were.

The images I got the idea from:


Not saying that the ol’ Copy/Paste isn’t working, but it does get really tedious making sure everything’s not a bit off the track you’re setting up.

It’s perfectly possible.

It’d require a bit of set-up, setting up the spawn schemas, but it’s possible.

From a logical standpoint, it’d really be no different than any other grid-based construction schema. It could be something as simple as grids like you said, to something as complex as like what Cataclysm: Dark Days Ahead does.

In essence, all you’d need to do on the logical side is set up a bunch of “groups”, and then set up rules for them. Would probably have a special set of rules for the “road” groups, dictating “straight” stretches and “intersections”, with different rules for 2-way “intersections” (EG a turn), 3-way intersections, 4-way intersections, and if you hate your life, even 5-way intersections.

Then you have another set of rules that determines what spawns alongside the road. Things like commercial storefronts, industrial sections, urban housing, things like that.

The tedious part would be tying SFM spawns to those groups, and importantly setting up boundaries. Would take a fair amount of work, getting the measurements for the roads and buildings as such, so that they don’t spawn with gaps or overlapping.

In short, it’s perfectly possible, but it’d take a fair bit of work.

Not to mention there are around 5 maps where people could go nuts with the setup. Huge void XL (the one I’m using) is a pretty huge blank map on its own, but you also got a ton of other void maps plus on Pte. Jack made that stretches the limit on how big a scenebuild could be. TheMask’s scenebuild props from the basic pack to part 5 already have a full road system to straight paths to bends, intersections, and slopes and even stoplights.

The road build in question. ~50 road models using Huge Void XL, and I’m not even done doing the grid part to put the buildings in.

Goddamnit no automerge.

do you know where i can get some sidewalk and road models? i already have some buildings and little scenery stuff like bus stops and mail stands, etc.

[editline]13th December 2016[/editline]

NVM, i just read your message and now i feel stupid, sorry to make you waste your time.

I don’t mind. I’ve been busy with finals that I haven’t made progress on the citybuild yet.

Also I found this;


This could be a cheaper alternative. Its got pavement to make where buildings would go, where roads could go, the size of the models to match the locations, etc. I think option C would be to make maps like this, but a bit bigger with more room to make use of skyscrapers and business/entertainment districts.

Wouldn’t it be easier to make a city or whatever you need in hammer instead of scene building it? I dunno.

scenebuilding a city allows it to be modular, especially when having stuff like a script that auto-assembles a randomly generated sequence of buildings

From what I can gather is that the standard source hammer buildings aren’t the best to show off in large scenes. It’d be better to use buildings from open world games like GTA or Sleeping Dogs as to give scenebuilds and videos more life to them.

Speaking of the script, a neat idea to implement would be to have labels of model buildings from other games. If you want to make, say, a chinatown citybuild, there would be labels called cht_buildingtype(shops, business, industrial, etc.)#, or if you want to replicate a district of Liberty City, the model labels would be GTAIV_buildingtype(industrial park, business, urban, skyscrapers, etc.)#.

Mask has been pretty good with his categorisation. You could just have the script pick buildings from specific directories. Once he builds up the number of buildings in the scenebuild pack, he’ll probably start splitting them up into their categories. Of course though, I’ve got no idea how long that’s gonna be. Or if it’s already done and my brain is on the fritz. Either way, I’d think it’d be a neater way than having the labels at the beginning of the model names. That’s just my opinion though.

Im kind of suprised weve only ever gotten like 2-3 buildings tops from GTA 4 ported , oh also thats a modified version of a old map i made a long time ago

Yeah we definitely need more city buildings like Liberty City imo, but I can make do with Mask’s Mega Scenebuild packs for now.

Just got back with a startup that could be very resourceful and possible to make this script a reality.

Major props for Gmod4ever for letting me be able to share this, though as he mentioned, it would take some time;

   # Grab the current animset
    shot = sfm.GetCurrentShot()
    animSet = sfm.GetCurrentAnimationSet()

    # Create the model and hide it.
    propName = "IAmAProp"
    propPath = "models/your/path/here.mdl"
    prop = sfmUtils.CreateModelAnimationSet( propName , propPath )

    # Position the model
    sfm.SetOperationMode( "Record" ) # Change the operation mode so changes can be made

    sfm.PushSelection() # Push the current selection to preserve it

    sfm.Select(propName + ":rootTransform")

    sfm.Move(xpos, ypos, zpos)
    sfm.Rotate(math.degrees(pitchrot), math.degrees(yawrot), math.degrees(rollrot))

    sfm.PopSelection() # Pop the current selection to restore the previous selection
    sfm.SetOperationMode( "Pass" ) # Restore the operation mode

A bit of an update; TheMask has released a brand new Scenebuild pack Update #9, and this one contains a bit of retail and residential housing. This should make it possible to make the City script come up with more varied models.