Custom AI Question

Game of universal domination. New dice available free upon request.
Post Reply
Preacherman

Custom AI Question

Post by Preacherman » Mon Feb 23, 2004 8:05 am

Dustin,
I have tried creating a custom AI with the SDK, but am having problems compiling it. I am using javac from the Terminal, using :

javac ~/Test/Nefarious.java

But despite copying all relevant classes into the Test folder I am compiling to I am getting lots of 'cannot resolve symbol' errors...any ideas what I am missing/forgetting?

User avatar
dustin
Lux Creator
Lux Creator
Posts: 10999
Joined: Thu May 15, 2003 2:01 am
Location: Cascadia
Contact:

Post by dustin » Mon Feb 23, 2004 11:38 am

Try javac ~/Test/*.java

This will compile your Nefarious class and let it see all the SDK stubs.

Preacherman

Post by Preacherman » Tue Feb 24, 2004 3:06 am

Awesome Dustin thanks, that did the trick...testing time :)

User avatar
Preacherman
Semiholy Priest
Posts: 4496
Joined: Tue Feb 24, 2004 3:52 am
Location: Sweden (capital of Denmark, an island in Norway, southern Europe)
Contact:

Post by Preacherman » Tue Feb 24, 2004 5:53 am

OK, the Nefarious agent compiled fine, I created both ~/Library/Application Support/Lux/Agents/ and /Library/Application Support/Lux/Agents/ and dropped her in, and I can select her from the Lux splash screen, so all is fine there.

She goes through her country selection routines OK, but then just sits there doing nothing at all apart from accumulating armies...no attacks, nothing.

I figured this was something I did wrong in the attack phase code, so just for a test I copied Pixie from the examples folder in the SDK, recompiled her, and tried that - exactly the same, she just sits there doing nothing, which is ver un-Pixie like! Tried also with the Quo and Boscoe examples, and again exactly the same - they all compile fine, and play the game as far as selecting countries and placing armies, but do absolutely nothing at all.

Any ideas? Am I perhaps missing stubs or something (I assumed SmartAgentBase.java needed to be copied to the compile folder as well as the other stubs), or are the examples outdated, or?

Thanks :)

User avatar
dustin
Lux Creator
Lux Creator
Posts: 10999
Joined: Thu May 15, 2003 2:01 am
Location: Cascadia
Contact:

Post by dustin » Tue Feb 24, 2004 12:02 pm

Hmm, I am not sure. I haven't played around with creating agents for a while. One thing that you should definately do in have the Applications/Utilities/Console.app open while you are doing this stuff. It will print out any error messages that come from agents. That might give you a clue. You can also include System.out.println("blah"); statements in your code and they will get printed out to the console.

evile

Post by evile » Wed Mar 03, 2004 12:16 am

I've been having similar problems. My agent shows up in the AI list, but its gameplay is screwed up. I checked the console, and it says it can't find the .class file for my agent, so it's using BoringAgent.class instead. That would definitely explain why the gameplay is strange! I've found that adding my class file to the lux.jar file buried in the application solves the problem.

Unfortunately, I'm trying to create an agent that learns using a neural network, and I need to save data to a file between runs. I'm not that knowledgeable about Java programming, but I suspect that I can't save that data in the jar file. For now, I'll try hardcoding a path to save that data in, but it would be nice if I could just save it in whatever directory the class file is in, which I could do if leaving it in the Library worked.

User avatar
dustin
Lux Creator
Lux Creator
Posts: 10999
Joined: Thu May 15, 2003 2:01 am
Location: Cascadia
Contact:

Post by dustin » Wed Mar 03, 2004 9:03 pm

OK, I found the problem. I was missing a slash. Doh!

A fixed version will be released soon.

User avatar
Preacherman
Semiholy Priest
Posts: 4496
Joined: Tue Feb 24, 2004 3:52 am
Location: Sweden (capital of Denmark, an island in Norway, southern Europe)
Contact:

Post by Preacherman » Thu Mar 04, 2004 1:14 am

lol, thanks Dustin!!

Post Reply

Who is online

Users browsing this forum: Amazon [Bot], Bing [Bot] and 52 guests