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

Offline Draco18s

  • Resident Velociraptor
  • Core Member Mark V
  • *****
  • Posts: 4,251
Re: Helping out with External Code
« Reply #75 on: June 10, 2017, 06:05:10 pm »
* Draco18s poke pokes at doing some galaxy gen

Um. Hmm.

Not sure how to get started or test things.

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Helping out with External Code
« Reply #76 on: June 10, 2017, 06:07:20 pm »
incorporate some community maps into the base game
That's the main method, yes.

Making mods discoverable and downloadable are also things we want to do, but we also want to emphasize that the package we deliver is intended to be sufficient for full enjoyment without having to find more pieces to add to the package. Too many games are only so-so until you hunt down the right mods.
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 #77 on: June 10, 2017, 06:21:59 pm »
Hey draco, hop over to discord and I'll talk you through mapgen

Offline Draco18s

  • Resident Velociraptor
  • Core Member Mark V
  • *****
  • Posts: 4,251
Re: Helping out with External Code
« Reply #78 on: June 11, 2017, 02:17:20 pm »
Hey Keith, got a weird conflict with external code you might have insight on.

After getting set up with an old version of Badger's sample map-gen code, I added one. Everything is fine.
I redacted the file to contain only my code so that it would be able to load along side other DLLs.
Compiled, renamed the DLL, told the XML to use the new DLL name, restored the original DLL before I'd started mucking about and.... It breaks.

I can have the original (and none of Badgers or my map types, this is normal) or I can have the new DLL (containing my map types or Badgers depending on what I compiled) but I can't have both a DLL with my code and a DLL with Badger's.

It appears (to me) that there's some aspect of the DLL compilation process that prevents two DLLs with different code from loading next to each other.  This would handicap any sort of modding scene pretty harshly.  The base error doesn't make any sense to me (null pointer), see the attached log file (erroring on trying to create my map type, I can get the reverse if I rename the DLLs so that mine is AIWarExternalCode.dll and Badger's is AIWarExternalCode_Badger.dll).

Not sure if I'm missing something or what, so I thought I'd ask before doing a bug report.

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Helping out with External Code
« Reply #79 on: June 11, 2017, 02:22:26 pm »
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.
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 #80 on: June 11, 2017, 02:30:47 pm »
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.

I can use either DLL (mine, badger's) as long as it's the only DLL.
Examining the contents of each DLL, there is one reference to IInitialSetupForDLL (each) that I can see.

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Helping out with External Code
« Reply #81 on: June 11, 2017, 03:46:10 pm »
Which namespace(s) is each dll using for its types?
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 #82 on: June 11, 2017, 07:15:07 pm »
They're all in Arcen.AIW2.External.*

Mine I've put "D18" onto the class name, so it doesn't conflict.

I should note that if I put both Badger's cs file and mine into the project and compile that, the game's happy.

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Helping out with External Code
« Reply #83 on: June 11, 2017, 08:36:16 pm »
Ah, ok. Yea, sounds like it may be a bug with our external type loader after all then. Will look into it, thanks for letting me know. Could you email me both of the dll's you're using, just to make sure I can reproduce it?
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 keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Helping out with External Code
« Reply #84 on: June 12, 2017, 02:54:34 pm »
Wiki's still down, so here's the release note for this in the next version:

* Fixed a problem with the mod support where every dll had to define a type which implemented the IInitialSetupForDLL interface, and further required a specific naming convention for that type.
** Now when loading a dll it looks at all types exported from it and runs the RunInitialSetup() of each IInitialSetupForDLL it finds.
** If it doesn't find any, it won't mind.

Thanks :)

Your example dll's still lead to (different) errors on load, but it appears to be due to the xml not pointing to the right dll's rather than the game just not loading the dll's. Or possibly I didn't copy them right, etc.
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 #85 on: June 12, 2017, 03:26:00 pm »
My xml was newer than my DLL, that's probably it. If it was complaining about missing map types, at least.

Anyway, cool.

Offline Draco18s

  • Resident Velociraptor
  • Core Member Mark V
  • *****
  • Posts: 4,251
Re: Helping out with External Code
« Reply #86 on: June 16, 2017, 09:21:25 pm »
Alright, I've got a whole bunch!

We've got here...

  • Mesh.

Probably not very interesting to play, but it's constructed by taking a planet in the "open nodes" list and finding a spot it can add a planet within a certain range and so that all wormhole links stay above 30 degrees with respect to other wormhole links. This planet then attempts to connect to others within range following the same rules and is pushed to the "open node" list.
Any planet with > 4 outbound links is removed from the "open node" list (or it an attempt to expand fails too many times)

My first foray into design, based loosely off Space Empires 4(?) galaxy construction.

  • Linked Rings.

This one I was just kinda playing around. Not sure I'm happy with the tiny rings (mainly in how many of them there are, but I'm already 10% over budget on planets: you'll notice there are 88).  Crossing wormhole links are intentional, although kept to a minimum.

  • Swirl.

This one is based off of the mechanics that produce spiral arm galaxies in the real world:

Works better with more planets.

  • Bubbles.

Like Mini-clusters except that all of the clusters are circular "bubbles" linked in a ring. Rings are largely connected via MST, although very nearby bubbles will link up additionally (looks very foamy when they're clumped tightly).
« Last Edit: June 16, 2017, 09:26:30 pm by Draco18s »

Offline TheVampire100

  • Master Member
  • *****
  • Posts: 1,382
  • Ordinary Vampire
Re: Helping out with External Code
« Reply #87 on: June 16, 2017, 09:35:41 pm »
These look amazing. Especially swirl, very true to a real solar system.
Bubbles also look very nice.

Offline Draco18s

  • Resident Velociraptor
  • Core Member Mark V
  • *****
  • Posts: 4,251
Re: Helping out with External Code
« Reply #88 on: June 16, 2017, 10:51:52 pm »
Yeah, I'm pretty happy with Swirl :D
I'd like to make it feel even more like the celestial boonies, but I can't actually remove planets once they've been added.

Offline Pumpkin

  • Hero Member Mark III
  • *****
  • Posts: 1,201
  • Neinzul Gardener Enclave
Re: Helping out with External Code
« Reply #89 on: July 06, 2017, 07:28:03 am »
Woah! I just get out of my AIW slumber and find this. Awesome!

I don't have time to get my hands dirty, right now (and I never touched C# before ; I know C++ and I'll be fine with the code, but the toolchain is really alien for a linux+vim+gcc guy like me) but... Nobody looked at this? My algorithms are only written in Perl and use an external untangler (graphviz), so I'll need some work to turn them into an actual mod. I focused only on links and not on positions, essentially because it's easier, but also because the gameplay cares only about wormhole links (beside the nearest neighbors links of the nomad planets in AIWC). I can't wait to implement and play on a cube or a torus!

TL;DR:
GG, guys! I'll catch up with you later.
Please excuse my english: I'm not a native speaker. Don't hesitate to correct me.