So I was actually poking around in the MapGenerator code, and I note that each IMapGenerator takes a "numberToSeed", which seems to be the number of planets. However, we don't have a means of controlling that from the start of the game, which makes it hard to experiment properly.
Hey Keith/Chris! I managed to create a planet style that I think feels pretty cool. It's trying to feel like "solar systems ultra-lite", where we have planets on a ring, each orbited by a few other planets. You have to go via the central planet of each ring to get to the ring of planets, so for people who like choke points it should work well.
If you guys would like to include it in the base game you'd be welcome, I'll happily send you the code (or take feedback). I learned a bunch about how the MapGeneration code works, so if any other aspiring modders wants to poke around in there and doesn't want to bug Keith, feel free to give me a holler.
Quick question: Are there any bad side effects of calling "using System.Threading" in MapGeneration.cs? I'm considering trying an interesting map that might be computationally expensive, and want to make sure a threading implementation would work if I can't make the algorithm < O((n/2)!)The "Travelling Salesman" map type, eh? ;) Or using a force-driven untangling algorithm?
So I dug out my old Graph Theory notes, because I thought that implementing a few graph theory algorithms might lead to interesting maps. Here's a map style constructed by scattering points at random across a circle centered on GalaxyCenter, then using Prim's algorithm to construct a minimum spanning tree. I think this looks pretty cool!
So I dug out my old Graph Theory notes, because I thought that implementing a few graph theory algorithms might lead to interesting maps. Here's a map style constructed by scattering points at random across a circle centered on GalaxyCenter, then using Prim's algorithm to construct a minimum spanning tree. I think this looks pretty cool!
Looks cool, but it would be hell to play. It's basically an X map.
//Two potential planets are selected for random connections (neither has
//a random connection yet)
//Lets make sure a link there does not cause any overlap in lines
Planet firstPlanet = planetsForMap[firstPlanetIdx];
Planet secondPlanet = planetsForMap[secondPlanetIdx];
bool wouldLinkCrossOtherPlanets = UtilityMethods.GetWouldLinkCrossOverOtherPlanets(firstPlanet, secondPlanet);
if(wouldLinkCrossOtherPlanets)
{
i--; //discard this pair, since there's an overlap
}
else
{
firstPlanet.AddLinkTo(secondPlanet);
usedPlanetsForConnections.Add(firstPlanetIdx);
usedPlanetsForConnections.Add(secondPlanetIdx);
}
if ( Mat.LineIntersectsRectangleContainingCircle( First.GalaxyLocation, Second.GalaxyLocation,
planetToNotHit.GalaxyLocation,
planetToNotHit.TypeData.IntraStellarRadius ) )
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?
I'm using Emacs. Does VisualStudio let you see the function headers and so on from things that are only in DLLs?
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.
Edit, for Keith: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...
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...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 ;)
if one-way wormholes become a thing (...) the Wormhole image itself should be tweaked."Why does that icon look like a giant catapult?"
If it floats like a duck, it must be a witch.An icon of a crone with a pointy hat on a broom would be pretty funny. But an icon of a duck would be even better.
Okay, I've updated my Map Generators to handle the changes in .123. While I'm happy to just enjoy those maps myself, I'd like to share them with everyone else! I'm not sure how to do that best though. If you guys would like the code in the base game then I'm happy to send you the code and do a few rounds of cleanup to bring it up to your standards.
And for Keith, is there any way you could finagle in some flags that I can expose in a GUI so I can pass some additional variables to the map generation subroutines? There are a ton of variables I'd like to tune to optimize things, but it's really annoying having to close the program, recompile, reopen the program and then navigate to the map I'm tweaking over and over.... "No, I'm busy" is technically fine, since it's not like it's prevented me so far, but I'd much rather ask and be told No than not ask!You're welcome to read a config file of your own off disk during mapgen, for now. Later external code will be locked down from doing file i/o.
incorporate some community maps into the base gameThat's the main method, yes.
Does your DLL have a InitialSetupForDLL? That was added as a bandaid when adding support for certain input events handled by external code, and it may be implemented in such a way that requires all external dlls to have that method. I can fix that if so, but I wanted to check if your dll actually works if that type is present or if there are further problems as well.