Help Getting Up and Running

AI discussion, ideas, and SDK help.
Post Reply
mctuble
Lux Newbie
Posts: 2
Joined: Mon Aug 21, 2006 8:32 am

Help Getting Up and Running

Post by mctuble » Mon Aug 21, 2006 8:46 am

Can someone help me get my java ide set up so I can compile an AI please? I am currently using Eclipse v 3.1.2 and using Java version 1.5.0. Eclipse runs and I can program in it. The problem is getting it to work with the Lux SDK. After that another quick question. How do I compile the program? Do I make a program that uses the AI class I made then run it then I use the .class file created from it? Thanks in advance.

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

Post by dustin » Mon Aug 21, 2006 4:32 pm

Hey,

This link has some details about how to get set up writing an AI:
http://sillysoft.net/wiki/?WritingYourOwnAI

I don't use eclipse, so I can't give exact steps. As long as you can compile all the java files into their corresponding class files that's all you need. Then make a copy of an agent's java file, mod it to be your own, and compile again. Then stick your compiled class file into the Lux agents folder.

mctuble
Lux Newbie
Posts: 2
Joined: Mon Aug 21, 2006 8:32 am

Post by mctuble » Mon Aug 21, 2006 5:07 pm

Ok so my second question is answered now thanks. Back to my first one. Actually coding the AI is not a problem as of yet. The problem is setting up Eclipse to recognize the Lux libraries. If anyone here has set up Eclipse to make an AI please help. At this point I'm willing to scrap Eclipse and use whatever method. So any help is appreciated.

User avatar
Bertrand
Reaper Creator
Posts: 568
Joined: Mon Nov 28, 2005 4:35 pm
Location: Montreal

Post by Bertrand » Mon Aug 21, 2006 6:48 pm

I can't help you with eclipse, since I use the NetBeans IDE. NetBeans is free and can be downloaded from http://java.sun.com/j2se/1.5.0/download-netbeans.html
The setup in NetBeans is very simple: just create a new project and add the luxSDK\src directory in the Files tab. Then, drill down to com\sillysoft\lux\agent, create a new empty java source file and as a starting point copy one the sample bots (I recommend Angry.java) into it.
To compile just hit F9. To run your bot copy the class file to the Lux\Support\Agents folder and restart Lux.

User avatar
GregM
Luxer
Posts: 252
Joined: Wed Jun 01, 2005 4:33 pm

Post by GregM » Mon Aug 21, 2006 8:18 pm

For the development of my bot I mostly used a text editor and command line functions.

On my computer the Lux SDK is located at "C:\Program Files\Lux\LuxSDK." There are SDK classes located at "C:\Program Files\Lux\LuxSDK\src\com\sillysoft\lux" and "C:\Program Files\Lux\LuxSDK\src\com\sillysoft\lux\util." You have to first compile these SDK classes (Board.java, Country.java, CountryIterator.java, etc.). I did this by going to those two directories with the command prompt and then using javac:

javac -cp "c:\program files\lux\luxsdk\src" *.java

I think there are also some build scripts provided with the SDK if you can figure them out.

Now you're ready to start writing your bot. My bot is in package "org.mcglynns.lux" so it is in the directory "C:\Program Files\Lux\LuxSDK\src\org\mcglynns\lux." When I want to compile my bot I go to this directory with the command prompt and type

javac -cp "c:\program files\lux\luxsdk\src" MyBot.java.

This generates MyBot.class in the org\mcglynns\lux directory. Lux will not look for the bot here: you need to put it in the Agents folder. On my computer this is at "C:\Program Files\Lux\Support\Agents," so I copy the .class file to there.

Now I start up Lux from the command line by typing "java -jar LuxCore.jar" in the "C:\Program Files\Lux" directory. Running Lux this way allows you to see any output the bot makes via System.out.printlns or any exceptions that are thrown in real time in the command prompt. Then you can make modifications to your bot, recompile it, copy the new version into the Agents folder and run Lux with the new version.

After writing all I imagine the process seems long and involved, but once you have it figured out it's pretty quick.

Good luck, and I hope to see a bot by you competing online in the future. :)

User avatar
blackj3sus
Lux Messiah
Posts: 3223
Joined: Fri May 05, 2006 12:27 pm
Location: sillysoft.net/roman-battles
Contact:

Post by blackj3sus » Fri Aug 25, 2006 5:11 pm

easy for you to say... :? :wall:

User avatar
GeekHammer
Lux Newbie
Posts: 1
Joined: Fri Mar 02, 2007 12:02 am

Post by GeekHammer » Fri Mar 02, 2007 12:05 am

I'm new to both LuxSDK and Eclipse, but here is what I was able to figure out (Eclipse 3.2):

1. Install the LuxSDK. I put it in c:\program files\lux\luxsdk...
2. Run Eclipse. Open the Package Explorer (window -> show view -> package explorer).
3. Right-click and select New -> Project -> Java Project
4. In the new project wizard, under "Contents" select "create project from existing source"
5. Browse to and choose the LuxSDK folder; I used a project name of LuxBots and press "Finish"

6. Expand "LuxBots" in the package explorer
7. Expand src
8. expand com.sillysoft.lux.agent and you will see all the agents
9. Right-click on com.sillysoft.lux.agent and chose New -> Class
10. Pick SmartAgentBase as the superclass.
11. Cut&paste imports and edit as needed. You now have a bot.
12. Copy the class file from the LuxSDK bin folder and run Lux.

Hope this helps.

Post Reply

Who is online

Users browsing this forum: No registered users and 50 guests