Author Topic: Helping out with External Code  (Read 20316 times)

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Helping out with External Code
« Reply #30 on: May 08, 2017, 01:06:09 pm »
Oh, right. Duh, sorry, didn't read my own method name there ;)

I was sure I was doing some kind of link-crossover prevention but I can't find any code in there that does so.

You could use Mat.LineSegmentIntersectsLineSegment to check for it, though.
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline BadgerBadger

  • Arcen Volunteer
  • Hero Member Mark III
  • *****
  • Posts: 1,229
  • BadgerBadgerBadgerBadger
Re: Helping out with External Code
« Reply #31 on: May 08, 2017, 01:08:25 pm »
What arguments does that function take? My copy of MapGeneration.cs doesn't have any references to it.

Offline Draco18s

  • Resident Velociraptor
  • Core Member Mark V
  • *****
  • Posts: 4,251
Re: Helping out with External Code
« Reply #32 on: May 08, 2017, 01:13:47 pm »
Oh yes. I meant random connections to nearby systems, not pure random anywhere.

That screen shot is almost prefect except for the crossing path, as noted. A Delaney triangulation would also solve that, as each system would only be connected to other systems in a flat network to begin with (impossible to form crossings) and then MST that (the MST from a Delaney triangle mesh will always be the MST performed any other way, due to the mechanics of the triangulation).

But yeah, you can get "closer enough" only looking at X nearest.

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Helping out with External Code
« Reply #33 on: May 08, 2017, 01:27:42 pm »
What arguments does that function take? My copy of MapGeneration.cs doesn't have any references to it.
Sorry, I figured you were using visual studio and it would give you intellisense. What are you using to code?

Signature on that one is:

bool LineSegmentIntersectsLineSegment( ArcenPoint Segment1_P1, ArcenPoint Segment1_P2, ArcenPoint Segment2_P1, ArcenPoint Segment2_P2, int ConsiderIntersectingIfWithinThisDistance );

It's possible that you'll need to make the line segments a little shorter on each end to avoid colliding with the links each planet already has (because they all meet at the middle of the planet).
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline BadgerBadger

  • Arcen Volunteer
  • Hero Member Mark III
  • *****
  • Posts: 1,229
  • BadgerBadgerBadgerBadger
Re: Helping out with External Code
« Reply #34 on: May 08, 2017, 01:33:13 pm »
I'm using Emacs. Does VisualStudio let you see the function headers and so on from things that are only in DLLs? I've been using a combination of guesswork and disassembling the DLLs to check variable/function names when necessary, which is not exactly the most efficient thing in the world ;-) . For example, it's less intuitive to figure out what

      IL_005f:  call       bool [ArcenUniversal]Arcen.Universal.Mat::LineSegmentIntersectsLineSegment(valuetype [ArcenUniversal]Arcen.Universal.ArcenPoint,
                                                                                                      valuetype [ArcenUniversal]Arcen.Universal.ArcenPoint,
                                                                                                      valuetype [ArcenUniversal]Arcen.Universal.ArcenPoint,
                                                                                                      valuetype [ArcenUniversal]Arcen.Universal.ArcenPoint,
                                                                                                      int32)

means than to just ask you
« Last Edit: May 08, 2017, 01:36:29 pm by BadgerBadger »

Offline Draco18s

  • Resident Velociraptor
  • Core Member Mark V
  • *****
  • Posts: 4,251
Re: Helping out with External Code
« Reply #35 on: May 08, 2017, 01:36:55 pm »
I'm using Emacs. Does VisualStudio let you see the function headers and so on from things that are only in DLLs?

It super depends. In this case, probably yes.
In the work job I have now, there's a c# wrapper around a c++ dll, and the intellisense only works on the wrapper (the linkages to the c++ are handled via magic strings).

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Helping out with External Code
« Reply #36 on: May 08, 2017, 02:12:43 pm »
Does VisualStudio let you see the function headers and so on from things that are only in DLLs?
Yep. Actually in my external code project I'm just using AIW2Core as a dll same as you are. Go-to-definition opens up the metadata for the class in question. And intellisense uses it correctly.

I mean, use whatever you like, but visual studio community edition is free to use. There's also https://code.visualstudio.com/download if you're on linux, but I don't know how it compares to the community edition.
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline BadgerBadger

  • Arcen Volunteer
  • Hero Member Mark III
  • *****
  • Posts: 1,229
  • BadgerBadgerBadgerBadger
Re: Helping out with External Code
« Reply #37 on: May 08, 2017, 02:37:43 pm »
Okay, how does this one look? The number of random connections is easily tunable (I have it set to 4 right now)


Offline Draco18s

  • Resident Velociraptor
  • Core Member Mark V
  • *****
  • Posts: 4,251
Re: Helping out with External Code
« Reply #38 on: May 08, 2017, 05:56:39 pm »
Looks pretty good to me. I might shift a few around, but that's mostly my sense of esthetics die to where the labels are (i.e not anything map get SHOULD worry about)

Offline BadgerBadger

  • Arcen Volunteer
  • Hero Member Mark III
  • *****
  • Posts: 1,229
  • BadgerBadgerBadgerBadger
Re: Helping out with External Code
« Reply #39 on: May 08, 2017, 06:05:22 pm »
It's all randomly generated, so feel free to hit "New Seed" ;-). I'm glad you like it though! It definitely adds something to the original (though I could imagine wanting to play the original map as well).

I also have two(!) new maps to offer. The first is a Gabriel Graph (which I think is also how some of the Clustering code works, but this is different because it's an entire graph done this way), the second is a Relative Neighbor Graph. These two examples are generated on the same set of planets, but will play very differently with the different map styles. I think they are both pretty cool.
« Last Edit: May 08, 2017, 06:06:57 pm by BadgerBadger »

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Helping out with External Code
« Reply #40 on: May 08, 2017, 06:11:23 pm »
The Relative Neighbor Graph looks especially cool. It's a lot like AIWC's "Simple" but with a more pleasing arrangement.

And yes, the names often float way out at a not-good place (closer to some other planet, etc). I'm sure that will be tightened up in some manner.
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline Draco18s

  • Resident Velociraptor
  • Core Member Mark V
  • *****
  • Posts: 4,251
Re: Helping out with External Code
« Reply #41 on: May 08, 2017, 07:09:26 pm »
Gabriel looks really close to what a full Delaney triangulation would look like (particularly towards the center). Took me a moment to realize it was not fully connected.

Definitely like the relative neighbor one too.

Edit, for Keith:
Awe man, I just had an Awesome idea. So when I was doing some map-gen stuff for that stealth game I have on the back burner, one of the things was having "backdoor" routes that created linkages from room to room that were less planned (it was a "pick two rooms that aren't connected, they can be anywhere, do a brute-force search towards the destination: if at any point you dead-end with no reasonable method of placing a further passage, terminate and consider that the linkage instead).

So. The idea I had for AIW2 was having some kind of building/capturable/hackable node that would act as a long-distance warp gate that would provide linkages between planets that doesn't use the galaxy map linkages. They'd be predetermined and fixed, go in one side, come out the other, just like a wormhole only they'd be backdoor-y.
« Last Edit: May 08, 2017, 07:13:52 pm by Draco18s »

Offline Toranth

  • Hero Member Mark III
  • *****
  • Posts: 1,244
Re: Helping out with External Code
« Reply #42 on: May 08, 2017, 07:57:45 pm »
Edit, for Keith:
Awe man, I just had an Awesome idea. So when I was doing some map-gen stuff for that stealth game I have on the back burner, one of the things was having "backdoor" routes that created linkages from room to room that were less planned (it was a "pick two rooms that aren't connected, they can be anywhere, do a brute-force search towards the destination: if at any point you dead-end with no reasonable method of placing a further passage, terminate and consider that the linkage instead).

So. The idea I had for AIW2 was having some kind of building/capturable/hackable node that would act as a long-distance warp gate that would provide linkages between planets that doesn't use the galaxy map linkages. They'd be predetermined and fixed, go in one side, come out the other, just like a wormhole only they'd be backdoor-y.
I haven't gotten into modding yet, but are the wormholes objects that can be modded/have functions and such attached to them?  This would support a lot of interesting ideas, from Draco's buildable backdoors, to one-way links, to moving wormholes, to temporary wormholes, to wormholes with sizes limits...

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Helping out with External Code
« Reply #43 on: May 08, 2017, 08:02:41 pm »
I haven't gotten into modding yet, but are the wormholes objects that can be modded/have functions and such attached to them?  This would support a lot of interesting ideas, from Draco's buildable backdoors, to one-way links, to moving wormholes, to temporary wormholes, to wormholes with sizes limits...
The wormhole traversal logic itself is in the core dll, but you could define other units that have the wormhole type. Depending on what you did you could run into problems, but temporary wormholes like the AIWC Nomads do should work.

Size limits and other "filters" are tricky for pathfinding purposes. But like all the other things in your list they could be done with some additional core dll work on my part. Whether they would lead to people pulling their hair out by the roots is a different question ;)
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline Draco18s

  • Resident Velociraptor
  • Core Member Mark V
  • *****
  • Posts: 4,251
Re: Helping out with External Code
« Reply #44 on: May 08, 2017, 09:33:44 pm »
Size limits and other "filters" are tricky for pathfinding purposes. But like all the other things in your list they could be done with some additional core dll work on my part. Whether they would lead to people pulling their hair out by the roots is a different question ;)

I figure if they're user-activated (i.e. not pathfinded normally) you'd get around most of those issues.
I'm thinking along the lines of how Achron handles the device that sends units back in time.