Page 1 of 1

Lux Delux AI Secondary Class Build Question

Posted: Sun Apr 12, 2020 1:38 am
by jman84
I recently got this game and am starting to work on an AI bot. That's one of the cooler features of this game and part of the reason why I chose to get it. I have the SDK downloaded and made a simple Hello World-style bot that doesn't do much, but it confirmed that I can get a bot to run and attack.

The issue I have is I cannot figure how to create and use another class in my bot. I had my bot BigBadBot.java. Now I want to create a class called LuxGraph.java. The code compiles, but I always get this stack trace

Code: Select all

java.lang.NoClassDefFoundError: com/sillysoft/lux/agent/BigBoyBot$LuxGraph
	at com.sillysoft.lux.agent.BigBoyBot.placeArmies(BigBoyBot.java:44)
	at com.sillysoft.lux.B.T(Unknown Source)
	at com.sillysoft.lux.B.h(Unknown Source)
	at com.sillysoft.lux.B.P(Unknown Source)
	at com.sillysoft.lux.B.run(Unknown Source)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException
	at com.sillysoft.lux.L.loadClass(Unknown Source)
	at com.sillysoft.lux.L.loadClass(Unknown Source)
	... 6 more
Some things I tried: include the code for the LuxGraph class in BigBadBot.java. Didn't work, got the same result.
Then, I made LuxGraph a nested class within BigBadBot. Also didn't work. I don't see why it would not work now, because it's inside BigBadBot so shouldn't that code be included when Lux runs BigBadBot?

Re: Lux Delux AI Build Question

Posted: Sun Apr 12, 2020 4:08 am
by jman84
"I don't see why it would not work now, because it's inside BigBadBot so shouldn't that code be included when Lux runs BigBadBot?"

I just read on StackOverflow that nested classes, when compiled, are not still nested in their parent class. So that explains why that was not working, though I still can't figure out how to include another .class file.

I tried putting BigBadBot.class into the Lux/Agents folder where all my downloaded agents are and I got the message when starting that BigBadBot is not a LuxAgent. So it looks like all of the classes in that directory are only loaded if they implement LuxAgent. Then I made it implement LuxAgent with dummy methods that do nothing just to see if it can then be included, but that still did not work.

Re: Lux Delux AI Build Question

Posted: Tue Apr 14, 2020 1:57 pm
by dustin
It can definitely be done. Install Tactobot from the plugin manager, and you can see how its files get located. Seems like main class file inside /Agents directly and then other classes inside a folder path based on their package.

Oponn agent also seems to use many other classes for functions.

It's been a while since I've delved into specifics of this. Hope this helps!

Re: Lux Delux AI Build Question

Posted: Tue Apr 14, 2020 5:06 pm
by jman84
Ah, thanks for pointing me towards Tactobot. I followed how that worked and got it working for me!