Jump to content

6 posts in this topic Last Reply

Highlighted Posts

Posted:
Last Online:  
 

Hi,

I'm currently experimenting with Cities: Skylines modding and I am pretty much stuck on one issue.

I'd like to create roads (including the connection of those and thereby creating intersections). Unfortunately my research wasn't successful yet and I have no clue what I could do now apart from asking here.

I already tried to hook the NetTool (by hooking the IL code and capturing the CreateNode / CreateNodeImpl function) and calling NetTool.CreateNode manually afterwards. To some extent this works (without any extra code it does create the road, but look at the attachment for results). I also forked some GitHub repository that contained code which allowed me to at least create roads at the correct height, but they never connected and thus never created intersections.

I guess I'm missing some code to seperately create an intersection which respectively creates "correct" roads, but I'm lost here.

Can someone please give me a hint on this issue?

Thanks in advance

 

roads_ground - Kopie.png

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

"Create" roads in what way? There are many ways to approach this. I would recommend you to take a look at the code that places the integrated networks of buildings.

That's BuildingDecoration.LoadPaths.

  • Like 1

Share this post


Link to post
Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    Hi,

    thank you @boformer. I will take a look on that later.

    To answer your question: I'm trying to create a simple server / client system which automatically dispatches the clients actions (just like "creating" a road) to all the other clients. That stuff works great already, just the road dispatchment won't quite work. I would be happy to have a single way to solve my issue, but it seems like you have much more experience on modding this game. Please excuse me, if this didn't quite answer your question.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    9 hours ago, CynCeyd said:

    Hi,

    thank you @boformer. I will take a look on that later.

    To answer your question: I'm trying to create a simple server / client system which automatically dispatches the clients actions (just like "creating" a road) to all the other clients. That stuff works great already, just the road dispatchment won't quite work. I would be happy to have a single way to solve my issue, but it seems like you have much more experience on modding this game. Please excuse me, if this didn't quite answer your question.

    Maybe just log all "CreateNode"/"CreateSegment" calls and play them in the same order?

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    That's what I already did with CreateNode. There are two strange things about this:

    Firstly, for some reason I don't know yet, when I hook CreateNode and just click on the road tool bar a few thousand nodes get created (yet with no visible effect) and secondly the roads never connect (both before and after using the forked code to adjust the height correctly). I serialized all parameters from a called CreateNode and dispatched them to the clients - I verified the data and it was identical on all clients. That's why I believe I'm missing something in order to create a road correctly.

    Perhaps you can tell me, whether I require to synchronize CreateSegment as well in order to correctly create or more correctly connect the roads.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    20 hours ago, CynCeyd said:

    That's what I already did with CreateNode. There are two strange things about this:

    Firstly, for some reason I don't know yet, when I hook CreateNode and just click on the road tool bar a few thousand nodes get created (yet with no visible effect) and secondly the roads never connect (both before and after using the forked code to adjust the height correctly). I serialized all parameters from a called CreateNode and dispatched them to the clients - I verified the data and it was identical on all clients. That's why I believe I'm missing something in order to create a road correctly.

    Perhaps you can tell me, whether I require to synchronize CreateSegment as well in order to correctly create or more correctly connect the roads.

    Could be that the assigned node IDs are different?

    Nodes itself are not visible, the segments between them are, so you have to sync CreateSegment as well.

    • Like 1

    Share this post


    Link to post
    Share on other sites

    Sign In or register to comment...

    To comment in reply, you must be a community member

    Sign In  

    Already have an account? Sign in here.

    Sign In Now

    Create an Account  

    Sign up to join our friendly community. It's easy!  

    Register a New Account


    ×

    Thank You for the Continued Support!

    Simtropolis depends on donations to fund site maintenance costs.
    Without your support, we just would not be in our 24th year online!  You really help make this a great community. *:thumb:

    But we still need your support to stay online. If you're able to, please consider a donation to help us stay up and running. This helps sustain a platform where we can share our community creations for years to come.

    Make a Donation, Get a Gift!

    Expand your city with the best from the Simtropolis Exchange.
    Make a Donation and get one or all three discs today!

    STEX Collections

    By way of a "Thank You" gift, we'd like to send you our STEX Collector's DVD. It's some of the best buildings, lots, maps and mods collected for you over the years. Check out the STEX Collections for more info.

    Each donation helps keep Simtropolis online, open and free!

    Thank you for reading and enjoy the site!

    More About STEX Collections