I'm pretty much done adding buildings manually to terrain, I've placed so many buildings in PMC 51km Desert and now I'm looking the dreaded project of populating Mogadishu with houses... that I'm simply not going to do it manually anymore.
We need city creation algorithm.
I started to write C++ GUI tool where I can configure starting X/Z coordinate, building size, spacing between buildings and square size of the area where to place the buildings. The tool writes visitor 3 import script, ie text file, which is very quick to import to see the results but lateron WRP file could be written directly. The output now is 1 building and 3 dumpsters placed nicely on its sides as well as small part of stone wall/fence.
Right now I'm just like one day to this project, even though its been on my mind for some time.
What I really want it to do, is to have some sort of user definable "prefabs" on config file, then user would just let the tool know where to place the buildings and the tool would randomly create from these prefabs a city blocks and place them into the v3 import script file or WRP file directly.
I'm so lousy making cities (as can seen from my terrain work, lately on PMC 51km Desert) that I'm totally confident that I can make this tool to reach equal level that I can do by hand (in the volume I've had to do so far). So I'm optimistic on the outcome of this project.
Like said, all very much in early stages now.
City creation algorithm
Moderators: Lone Wolf, Snake Man
-
- Commander-In-Chief
- Posts: 9357
- Joined: 2000-07-31 22:01:01
- Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
- Editing Interests: All, I (try) to edit everything.
- Location: PMC
City creation algorithm
PMC Tactical Forum New User Registration please read new info here.
PMC since 1984
Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel
PMC Tactical forum Advanced Search is power.
"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."
PMC since 1984
Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel
PMC Tactical forum Advanced Search is power.
"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."
-
- FreeFalcon
- Posts: 848
- Joined: 2001-03-04 23:01:01
- Location: here
Re: City creation algorithm
In what format are the buildings, I mean, can you get the model information as to size?
I'm thinking that you could start by defining 3 groups of buildings - large, medium and small. Also, it would be ideal if you could divide them by function - commercial, housing (houses and apartments), and utility (sheds, barns). Take the size of the area defined by the user (also, maybe have check boxes for whether they want a "downtown" commercial area, or all residential), then divide into thirds. The inside third would be the most dense - large buildings, some small sheds mixed in. The "middle" third would be less dense, mostly residential, with the fences and such. The outer third would have the least dense - mostly residences and farms.
With some randomness built in, naturally.![Wink ;)](./images/smilies/icon_wink.gif)
I'm thinking that you could start by defining 3 groups of buildings - large, medium and small. Also, it would be ideal if you could divide them by function - commercial, housing (houses and apartments), and utility (sheds, barns). Take the size of the area defined by the user (also, maybe have check boxes for whether they want a "downtown" commercial area, or all residential), then divide into thirds. The inside third would be the most dense - large buildings, some small sheds mixed in. The "middle" third would be less dense, mostly residential, with the fences and such. The outer third would have the least dense - mostly residences and farms.
With some randomness built in, naturally.
![Wink ;)](./images/smilies/icon_wink.gif)
Sic Semper tyrannosauro.
-
- Commander-In-Chief
- Posts: 9357
- Joined: 2000-07-31 22:01:01
- Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
- Editing Interests: All, I (try) to edit everything.
- Location: PMC
Re: City creation algorithm
At the current code there is no relation to model at all, it don't care if I place rocks, trees or buildings. Eventually I'm hoping to utilize the file formats available and read P3DM/ODOL format p3d to grab the bounding box of the buildings to get the proper size.
But... lets not get ahead of ourselves, we are far away from that point![Smile :)](./images/smilies/icon_smile.gif)
So lets get this started, I hate to speak nonsense without nothing to back my words up, so I made a screenshot.
![Image](http://www.pmctactical.org/arma/screenshots/PMC_city_creator-001.jpg)
The above image was made in visitor3 buldozer after I imported the objects which my tool created. As can be seen its nothing fancy, anyone with 10minutes of time could do that manually by making the dumpsters and fences, then copy pasting the group of objects around. But like said, its proof of concept and very much WIP right now.
Hopefully this get discussion going and ideas come alive. Then I need to step my coding game up and really learn how to make cool city creation algorithm. I need help in that too, naturally.
But... lets not get ahead of ourselves, we are far away from that point
![Smile :)](./images/smilies/icon_smile.gif)
So lets get this started, I hate to speak nonsense without nothing to back my words up, so I made a screenshot.
![Image](http://www.pmctactical.org/arma/screenshots/PMC_city_creator-001.jpg)
The above image was made in visitor3 buldozer after I imported the objects which my tool created. As can be seen its nothing fancy, anyone with 10minutes of time could do that manually by making the dumpsters and fences, then copy pasting the group of objects around. But like said, its proof of concept and very much WIP right now.
Hopefully this get discussion going and ideas come alive. Then I need to step my coding game up and really learn how to make cool city creation algorithm. I need help in that too, naturally.
PMC Tactical Forum New User Registration please read new info here.
PMC since 1984
Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel
PMC Tactical forum Advanced Search is power.
"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."
PMC since 1984
Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel
PMC Tactical forum Advanced Search is power.
"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."
-
- FreeFalcon
- Posts: 848
- Joined: 2001-03-04 23:01:01
- Location: here
Re: City creation algorithm
DM and I had a conversation a long time ago about some of this stuff. ![Smile :)](./images/smilies/icon_smile.gif)
Would you use your tool after setting roads, or use it as part of the same process?
If roads are already set, you'd need to find the nearest road and put the "front" of the building model pointing towards the road. Only rarely does a building's primary entrance sit on a side other than towards the road.![Smile :)](./images/smilies/icon_smile.gif)
Once you have the front of the building established, set a distance (with a random component) from the road. Then, behind it, you could place additional small buildings. Also, you could have a random decision as to whether there is a fence or wall around the building, and maybe have some preset placements for those. If there is already a building with a wall or fence, maybe just continue that one.
I think differentiation will be the key attribute.
It will be easy to have a pattern or the appearance of a pattern.
Have you looked at some of the constructor series of buildings?
http://www.armatechsquad.com/ArmA2Class ... positions/
There may be some ideas there. Also, the underlying functions are available on dev-heaven.
![Smile :)](./images/smilies/icon_smile.gif)
Would you use your tool after setting roads, or use it as part of the same process?
If roads are already set, you'd need to find the nearest road and put the "front" of the building model pointing towards the road. Only rarely does a building's primary entrance sit on a side other than towards the road.
![Smile :)](./images/smilies/icon_smile.gif)
Once you have the front of the building established, set a distance (with a random component) from the road. Then, behind it, you could place additional small buildings. Also, you could have a random decision as to whether there is a fence or wall around the building, and maybe have some preset placements for those. If there is already a building with a wall or fence, maybe just continue that one.
I think differentiation will be the key attribute.
![Smile :)](./images/smilies/icon_smile.gif)
Have you looked at some of the constructor series of buildings?
http://www.armatechsquad.com/ArmA2Class ... positions/
There may be some ideas there. Also, the underlying functions are available on dev-heaven.
Sic Semper tyrannosauro.
-
- Commander-In-Chief
- Posts: 9357
- Joined: 2000-07-31 22:01:01
- Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
- Editing Interests: All, I (try) to edit everything.
- Location: PMC
Re: City creation algorithm
I haven't thought about roads yet.T_Rex wrote:Would you use your tool after setting roads, or use it as part of the same process?
Initial light above my head with this idea was just to place buildings + decor automatically (as I stated in the first post). I cannot emphasize how long time does it take to place the decorations along side your building to make city look alive. You have all seen my terrains without the decor, they look empty, they look cold, they look artificial. It makes world of difference when you have dumpster, fence, trash piles etc. Oops I'm babbling again.
Roads, well now that I think of it... I think we can do roads, I mean I wasn't "planning on it" on the scope of this city creator, but yes we could do city streets like separately from the normal terrains road network. This tool is not envisioned to be "Road Tool" by any means. But I can think its very easy to make city streets especially as they are (usually) straight with 90 angles / intersections.
I don't know if there is any way to determine front side of a building, as the 0 degree side of the building is not necessarily the front.If roads are already set, you'd need to find the nearest road and put the "front" of the building model pointing towards the road. Only rarely does a building's primary entrance sit on a side other than towards the road.
I think while it would be great to have the tool automatic like WrpTool to read the ODOL P3D files for model information, the more fine tuned placement relies on user input in the form of configuration file. This configuration file would state the building model, then the additional decoration models placed around it. Also it could define the city block types, like bundling high rise buildings together for downtown and smaller buildings for the suburban areas on the city edges. Then of course the village types on the countryside for rednecks.
Nope. You mean the buildings themselves or the scripts that create them?Have you looked at some of the constructor series of buildings?
Hmm what do you mean, like documented or? I mean the functions are in the modules.pbo (spelling?) aren't they?Also, the underlying functions are available on dev-heaven.
btw the screenshot shown above is already out dated as I put together last night much better configuration already (being it hardcoded or not at the moment), there is now 3 types of buildings with dumpsters and fences. Looks real sweet.
PMC Tactical Forum New User Registration please read new info here.
PMC since 1984
Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel
PMC Tactical forum Advanced Search is power.
"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."
PMC since 1984
Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel
PMC Tactical forum Advanced Search is power.
"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."
-
- FreeFalcon
- Posts: 848
- Joined: 2001-03-04 23:01:01
- Location: here
Re: City creation algorithm
Here is a link to all the sqfs that are "stock" with A2, to make the various compositions.
http://dev-heaven.net/repositories/brow ... mpositions
They might come in handy as ways to handle certain things.
If it isn't too complicated, I would also suggest that you pick a random direction for an initial orientation for the town, then figure the roads at ~ 90 degrees offset from that. Or - and this may be WAY too complicated - if there is a ridge or some other feature, use that to determine the primary orientation for the city.![Smile :)](./images/smilies/icon_smile.gif)
In terms of help, do you want some "sets" of city blocks, like pre-fabricated? Or building combinations that have a certain known bounding area?
http://dev-heaven.net/repositories/brow ... mpositions
They might come in handy as ways to handle certain things.
If it isn't too complicated, I would also suggest that you pick a random direction for an initial orientation for the town, then figure the roads at ~ 90 degrees offset from that. Or - and this may be WAY too complicated - if there is a ridge or some other feature, use that to determine the primary orientation for the city.
![Smile :)](./images/smilies/icon_smile.gif)
In terms of help, do you want some "sets" of city blocks, like pre-fabricated? Or building combinations that have a certain known bounding area?
Sic Semper tyrannosauro.
-
- Commander-In-Chief
- Posts: 9357
- Joined: 2000-07-31 22:01:01
- Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
- Editing Interests: All, I (try) to edit everything.
- Location: PMC
Re: City creation algorithm
Those sqf's can be found on the modules.pbo yep.
Yes if you could provide me with some sort of table like
ca\buildings\budova1.p3d
X: value
Z: value
- fence1
X: value
Z: value
- fence 2
X: value
Z: value
- dumpster 1
X: value
Z: value
That would be the format to create the prefabs. What I mean with those values is that first would be the building type which would be our X and Z coordinate "seed", then would come the individual objects and their coordinates. You can either give me direct OFFSET values, like X: -5.5, Z: 3.8 etc, or just the static coordinates and I'll calculate them myself.
Again I have not even looked the modules yet how do the sqf's handle the ArmA objects, might be worth to do right now. But thats how I created the building + dumpster + fence seen on the screenshot above.
Its very time consuming to first create the desired outcome for the prefab, then painstakingly track down the x/z coordinates and even calculate the offsets. I'm planning now a way to make just WrpTool WRP of the prefab and then tool to read that WRP and automatically sort out and calculate the offsets. But I'm not sure how to handle that really, maybe just make it that our seed building is always on 500,500 coordinates and the rest of the objects in the current WRP are all calculated into this prefab with their offsets. It would mean one wrp file per prefab. It might be more desirable to make just one WRP file with several building clusters and somehow get the coordinates to distinct which belongs to which prefab. Dunno really. All ideas are more than welcome.
Yes if you could provide me with some sort of table like
ca\buildings\budova1.p3d
X: value
Z: value
- fence1
X: value
Z: value
- fence 2
X: value
Z: value
- dumpster 1
X: value
Z: value
That would be the format to create the prefabs. What I mean with those values is that first would be the building type which would be our X and Z coordinate "seed", then would come the individual objects and their coordinates. You can either give me direct OFFSET values, like X: -5.5, Z: 3.8 etc, or just the static coordinates and I'll calculate them myself.
Again I have not even looked the modules yet how do the sqf's handle the ArmA objects, might be worth to do right now. But thats how I created the building + dumpster + fence seen on the screenshot above.
Its very time consuming to first create the desired outcome for the prefab, then painstakingly track down the x/z coordinates and even calculate the offsets. I'm planning now a way to make just WrpTool WRP of the prefab and then tool to read that WRP and automatically sort out and calculate the offsets. But I'm not sure how to handle that really, maybe just make it that our seed building is always on 500,500 coordinates and the rest of the objects in the current WRP are all calculated into this prefab with their offsets. It would mean one wrp file per prefab. It might be more desirable to make just one WRP file with several building clusters and somehow get the coordinates to distinct which belongs to which prefab. Dunno really. All ideas are more than welcome.
PMC Tactical Forum New User Registration please read new info here.
PMC since 1984
Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel
PMC Tactical forum Advanced Search is power.
"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."
PMC since 1984
Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel
PMC Tactical forum Advanced Search is power.
"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."
-
- FreeFalcon
- Posts: 848
- Joined: 2001-03-04 23:01:01
- Location: here
Re: City creation algorithm
This guy would probably be worth talking to. ![Smile :)](./images/smilies/icon_smile.gif)
Edit:
Dammit - forgot to post the link!
http://forums.bistudio.com/showthread.php?t=89926
![Very Happy :D](./images/smilies/icon_biggrin.gif)
![Smile :)](./images/smilies/icon_smile.gif)
Edit:
Dammit - forgot to post the link!
http://forums.bistudio.com/showthread.php?t=89926
![Very Happy :D](./images/smilies/icon_biggrin.gif)
The idea: basic building elements, arranged and spawned per script to form/build random, yet somehow authentic/believable - functional - buildings (inclusiv interiors!), where
* the basic building elements consist:
o wall-elements (we do not need corner elements)
o door-wall-elements (single-/double-doors, garage-doors, gangways, ...)
o roof-elements (incl. variations with hatches and ladders, solid/concrete roofs or camouflaged/overgrown and special egde/corner-elements with guard railing, little walls or sandbags)
.
* a pretty simple, recursive maze algorithm/script divides a rectangle into smaller ones (chambers) and return's the needed data to:
o spawn the maze/building itself (wall-, door-, roof-elements)
o design/spawn the interior of the building (we get an array of created chambers)
o also we may regard the roof as another (special-)chamber
.
The script itself should be highly customizeable to define min. and max. room/chamber-sizes, etc. And maybe we need a meta-maze/building-script to build non-rectangular or more complex buildings out of several such simple mazes, cleverly connected together. Maybe even multiple floors on resulting roofs?
Sic Semper tyrannosauro.
Who is online
Users browsing this forum: No registered users and 0 guests