SC4 Devotion Forum Archives

Other City-Building Games => Other games => [Archived] CityMania - Open Source Sim City => Topic started by: tomkeus on March 28, 2010, 04:09:56 AM

Title: Construction Layer Protoype - Progress Update
Post by: tomkeus on March 28, 2010, 04:09:56 AM
Hi guys, I know it's been a while since you've seen anything from me, but what I'm doing ain't easy   :-[

I'm developing some tools which generally fall into CAD/CAM category, and there are no references for such stuff on the interwebs and I have to invent everything by myself and, although general principles are not particularly hard to develop, bug hunting is a nightmare and I don't have as much free time as before (maybe 10-15 hrs of effective work per week).

Now, enough of excuses, here's what I've done so far:

- Implemented camera similar to camera in Google Earth

- Implemented some basic UI indicators

- Laid ground work for the road/rail system: This means, most of the basic drawing algorithms are in place. Basic algorithm is extrusion along the path. Road is geometrically represented as a curved line, and 3D mesh is obtained by sweeping a profile (another 2D line, specified by user as a sequence of Points in a XZ plane) along the line. This is also used to draw bridges and within 15 min (time needed to find good texture and to specify a new profile) I can do railroads, expressways, embankments etc. Another algorithm I've developed is spacing along the path. I'm using it currently to position bridge pillars. This tool can also be used to place street lights, catenary for the railroads and similar.
 So far, process of laying down roads is a little different than the one you saw in the 2D prototype demo. Segment types (curved or straight) are not specified manually. Their type is inferred automatically in a way similar to splines. Possibility to draw the same way as in 2D demo, will be added soon (it is much more controllable but a little messy to do when you have to deal with polygonal geometry)

When I'm happy with the overall feel of the road/rail laying system I will upload the program for you to evaluate and start the work on the zone laying system.


For now, few screens:

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fi4.photobucket.com%2Falbums%2Fy127%2Ftomkeus%2Froads3.jpg&hash=bbc01d6fe97a250aa0eb5628c6a3680ff5d5f428)

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fi4.photobucket.com%2Falbums%2Fy127%2Ftomkeus%2Froads2.jpg&hash=fc644b6d59d338c9b563673e012177f9442e874e)

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fi4.photobucket.com%2Falbums%2Fy127%2Ftomkeus%2Froads1.jpg&hash=4543262b8fe3c17cab7aeddf6b207295f3a92582)
Title: Re: Construction Layer Protoype - Progress Update
Post by: croxis on March 28, 2010, 10:17:00 AM
I look forward to putting some terrain under all that :D
Title: Re: Construction Layer Protoype - Progress Update
Post by: TJ1 on March 28, 2010, 01:55:40 PM
Cooooooooooooooooooollllllllllll!!!!! :thumbsup: :thumbsup:
Title: Re: Construction Layer Protoype - Progress Update
Post by: DanniBee on March 29, 2010, 07:15:13 AM
Looking good!
Title: Re: Construction Layer Protoype - Progress Update
Post by: JoeST on March 30, 2010, 05:38:33 AM
mmmmmmmm
Title: Re: Construction Layer Protoype - Progress Update
Post by: townscape on March 30, 2010, 11:29:15 AM
oh by the way: I don't see any junctions and intersections

how do they look? planning on placing any limits at wich you can junction roads?
Title: Re: Construction Layer Protoype - Progress Update
Post by: tomkeus on March 30, 2010, 01:52:35 PM
Quote from: townscape on March 30, 2010, 11:29:15 AM
oh by the way: I don't see any junctions and intersections

And you probably wont see them for some time. Two problems are main reasons:

Simple problem: I have worked out on the paper how should junctions work, but I still have to code them and debug them.

Messed up problem: For now, all roads so far have straight line topology and thus I can just cram them into lists. When junctions and intersections enter the story, topology becomes nontrivial and I have to use graphs which is something I never did earlier and I still didn't came around to think about it.

I could make some interim solutions just for eye-candy purposes but I'm not keen on wasting time doing things I know I will have to remove later.
Title: Re: Construction Layer Protoype - Progress Update
Post by: tomkeus on April 04, 2010, 02:57:03 PM
I will be little longer until I finish what I've promised but it is for a good reason. I haven't written new functionality lately (save for the parts of the code needed to create line fillets between adjacent road segments), rather I have finally fleshed out what kind of geometrical operations I need
and organized them into pretty powerful compact class. I think you'll be pleasantly surprised with amount of stuff that is going to be possible to do with this framework.


Let me mention some of this stuff:

-Sweeping arbitrary profile along the curve with automatic texturing: I am currently drawing single lane roads and bridges, but I could be drawing railroads, or avenues or whatever. Everything I need is a texture, and a profile which can be easily specified as a sequence of points in txt file.

-Spacing along the curve. I can distribute given number of objects along the curve: I'm using it to space pillars on the bridges, but it can easily be used for creation of streetlights, railroad electrification, treelines etc.

-Snapping in 2D and 3D with ofset (as seen in 2D prototype demo), curve offsets (thus easily making multi-lane, multi-rail, multi-x tools), curve fillets (fiting curved segments of specified radius bettween two segments), intersecting with offsets (thus identifying boundary points of the intersection or junction and generating intersection/junction polygons and texturing them).

....There are many possibilities now. System also allows powerful zoning tools. Zones will be drawn in the same way shown in 2D prototype demo. There will be NO autoroads, it will be possible to have concave zones and lots will be capable of having curved edges. Though, zones wont be able to have unreasonable shapes (you will se what I mean once I do it).

For example, on the screenshot bellow, you can see that bridges look different than those on screenshots few posts above. It took me one minute to change them. You will also be able to do that very fast, and If you're not to lazy to do some modeling, you can make truss bridges by spacing truss segments along the curve and additionally sweeping a number of profiles to get the road surface, or concrete beams, etc.
Title: Re: Construction Layer Protoype - Progress Update
Post by: joelyboy911 on April 04, 2010, 03:11:19 PM
Are you in need of someone to help make textures? I'd be willing to give it a shot, just let me know what size/format/colours it needs to be and I can try to make something up.
Title: Re: Construction Layer Protoype - Progress Update
Post by: tomkeus on April 04, 2010, 03:21:52 PM
I will be needing some texture work in the near future and I will announce everything I'll be needing, from textures to models. I have two building models from Victor01 and I might need few more to make some clutter.
Title: Re: Construction Layer Protoype - Progress Update
Post by: croxis on April 04, 2010, 05:19:40 PM
That sounds absolutely amazing!
Title: Re: Construction Layer Protoype - Progress Update
Post by: tomkeus on April 05, 2010, 08:13:31 AM
Though, I still have to do job I really hate but is absolutely essential.

Around half of the code is uncommented and there is enough of it I'm beginning to forget some stuff I did month or two ago.
Title: Re: Construction Layer Protoype - Progress Update
Post by: croxis on April 06, 2010, 07:51:14 AM
I know the feeling. I found myself documenting almost everything just because I often do not remember what the heck I was doing after a week.
Title: Re: Construction Layer Protoype - Progress Update
Post by: JoeST on April 07, 2010, 11:18:37 AM
that sounds absouletly sexy as hell! and yeah documenting isnt always fun :D

Joe
Title: Re: Construction Layer Protoype - Progress Update
Post by: Nique on April 09, 2010, 12:43:17 PM
Awesome work Tomkeus!  &apls
Title: Re: Construction Layer Protoype - Progress Update
Post by: tomkeus on June 16, 2010, 08:25:50 AM
Guys, I'm sorry we're absent, but I am currently dealing with some administrative crap and I cannot hang around the Internets too much.

Despite that I am making relatively good progress, and intersection system is taking shape. I was hoping to be able to feature some nice video of network laying features by now, but when working on something of this size, dealing with one set of problems, opens a whole new larger set of problems and I'm working slower than expected. So please bear with me.
Title: Re: Construction Layer Protoype - Progress Update
Post by: townscape on June 16, 2010, 01:10:06 PM
Take your time :)

There's no time limit and we're not limited in budget because we don't have one (yet?)
Title: Re: Construction Layer Protoype - Progress Update
Post by: tomkeus on July 12, 2010, 08:15:06 AM
Hey guys, just to report to you that I'm still breathing.

I didn't get to do anything lately. Approximately two weeks ago I have moved to Frankfurt in Germany for my PhD work. I'm still in the process of setting my life up. I currently do not have Internet at home, since I'm accommodated temporary, until I move to a new apartment next week. Workload at the office is not too high so I will be able to continue to work fairly regularly on CityMania.

One nice thing is that some of my new colleagues are researches in the field of complex and neural networks and some of them have shown interest in contributing to the game (simulation aspects, especially traffic).
Title: Re: Construction Layer Protoype - Progress Update
Post by: Nique on July 12, 2010, 01:54:24 PM
Quote from: tomkeus on July 12, 2010, 08:15:06 AM
Hey guys, just to report to you that I'm still breathing.

I didn't get to do anything lately. Approximately two weeks ago I have moved to Frankfurt in Germany for my PhD work. I'm still in the process of setting my life up. I currently do not have Internet at home, since I'm accommodated temporary, until I move to a new apartment next week. Workload at the office is not too high so I will be able to continue to work fairly regularly on CityMania.

One nice thing is that some of my new colleagues are researches in the field of complex and neural networks and some of them have shown interest in contributing to the game (simulation aspects, especially traffic).

that's good news!  &apls  ()stsfd()
Title: Re: Construction Layer Protoype - Progress Update
Post by: JoeST on July 17, 2010, 05:27:44 AM
Awesome sauce!, hope you enjoy yourself Tom :)

Joe
Title: Re: Construction Layer Protoype - Progress Update
Post by: mali on July 21, 2010, 02:02:35 PM
LOVE IT LOVE IT LOVE IT!!!!! &apls &apls #1
Title: Re: Construction Layer Protoype - Progress Update
Post by: tomkeus on August 23, 2010, 06:15:19 AM
OK. I'm back in business. I got net installed last Wednesday after more than three weeks of waiting but my laptop died the very same day so I had to get new one this weekend. I hope I'll be able to show you some new results soon.
Title: Re: Construction Layer Protoype - Progress Update
Post by: DanniBee on August 26, 2010, 01:32:57 PM
\ ()stsfd()/ Back in business now!
Title: Re: Construction Layer Protoype - Progress Update
Post by: tomkeus on September 14, 2010, 06:35:38 AM
Hello guys. Reporting again. I'm coding on the weekends only now. I'm rewriting a lot of code to accommodate use of the numpy and scipy packages to simplify code. Too bad I haven't thought of this before. They will also come extremely handy for simulation part.

I also got one idea, I would like to expose here. One problem with 3D city simulators is that you cannot align buildings to each other as they are in densely built parts of the cities so for example, you cannot have row house quarters. I have a way which can be used to procedurally generate such areas. As I have already told many times, transportation network is drawn by sweeping a profile curve along a path curve. Similar approach can be used to generate, for example, row houses: smaller path curve, parallel to zone edges is inscribed into the zone, and then, appropriate profile is swept along in order to generate building meshes. Algorithm can be relatively simply enhanced to use a pack of profiles to obtain a row of different buildings.
Title: Re: Construction Layer Protoype - Progress Update
Post by: Ocram on September 16, 2010, 10:55:13 PM
That is a really nifty idea to procedurally generate your buildings. The idea has been casually tossed around by many people who do not know very much about it (and have tried free trials of those big urban simulator engines). I would be very glad to know that an open source (this used to be called open source s*mc*ty, right?) city simulator would do any sort of procedural generation of buildings (procedural generation of plazas has been done by consumer games and procedural "fetching" of buildings has been done by a game I would rather not mention but have admitted to purchasing and playing...).
Title: Re: Construction Layer Protoype - Progress Update
Post by: tomkeus on September 19, 2010, 07:07:41 AM
Heh, those damned intersection are really pain in the a$$  $%#Ninj2

I'm still wrestling with some bug I got while I was still in Serbia in June. Damned thing just won't go.

I may be forced to completely rewrite intersection mesh generator. I don't like that idea, since I have managed to have procedural generation of intersection meshes which is at the same time highly customizable (for example cloverleaf interchanges can be created in game to any shape and size, they don't have to be plopped; user builds every piece of the interchange like it is a regular road; ramps are for example just elevated one way roads). I think no one got this kind of flexibility before, and I really wouldn't like to give up any of it.
Title: Re: Construction Layer Protoype - Progress Update
Post by: townscape on September 19, 2010, 07:35:00 AM
good luck with your bug! And I really like the direction that the intersections are going :)
on the topic of aligning buildings: would it be possible to place buildings as I suggested in this (http://sc4devotion.com/forums/index.php?topic=9138.0) thread? or is it unproductive?
Title: Re: Construction Layer Protoype - Progress Update
Post by: tomkeus on September 19, 2010, 07:53:09 AM
Well, your gif in the first post is a very good representation of how the zone subdivision algorithm works. As for the building placement, I currently cannot see why buildings should be placed only on the center of the lot, that is, I see no reason, why not to allow having buildings placed closer or further down from the street.
Title: Re: Construction Layer Protoype - Progress Update
Post by: townscape on September 19, 2010, 08:17:16 AM
I agree, then.
Title: Re: Construction Layer Protoype - Progress Update
Post by: Nique on December 26, 2010, 05:54:16 AM
We need to add a CSG method underneath the road when it cuts through the surface of the terrain. (the terrain needs to be adjusted when you want to make a slope). Is this something you can do Tomkeus?

CSG = Constructive solid geometry
(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fcommons%2Fthumb%2F4%2F4a%2FBoolean_union.PNG%2F275px-Boolean_union.PNG&hash=2942e61f44fd460b01e7a8740f697e0e9976a5ed)
(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fcommons%2Fthumb%2F8%2F86%2FBoolean_difference.PNG%2F275px-Boolean_difference.PNG&hash=2ac67f18a0ab5705dad02402c33900dab82953a7)

You know what i mean?