I Am Not a Java Programmer

AI discussion, ideas, and SDK help.
Post Reply
User avatar
rip
Luxer
Posts: 352
Joined: Wed Mar 31, 2004 10:22 am
Location: Vienna Austria
Contact:

I Am Not a Java Programmer

Post by rip » Tue May 22, 2007 3:51 am

So I'm not exactly sure how Java sticks together. Make no assumptions about what I do know when replying...thanks.

At the moment, you can write an agent that implements agent:

public class Angry implements LuxAgent
{
...
}

Or, you can extend SmartAgentBase:

public class Bug extends SmartAgentBase {
...
}

This means that Java lets me inherit, so I could implement a SmarterAgentBase:

public class SmarterAgentBase extends SmartAgentBase {
...
}

with more path-finding abilities.

public class Bug extends SmarterAgentBase {
...
}
etc.

But when I compile Bug, does it include the code for SmarterAgentBase, /and/ SmartAgentBase in the class, or does it assume that the base package (Lux) includes that code?

If it assumes that Lux will have it, how would I supply Bug to the Plugin Manager (I supply the .java file to Dustin, right? but if a 3d party wants to use Bug, they would need to /also/ download SmarterAgentBase?)

That's probably a question for Dustin, but for now will start with the inheritance question.

rip

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

Post by dustin » Tue May 22, 2007 4:39 am

BotOMatic is a subclass of BotOfDoom, similar to the way you describe it. If you install BotOMatic you can see it also installs a BotOfDoom inside some subfolders. So it's possible to do it.

To start with, I would recommend you keep al your stuff inside 1 class, for simplicity sake.

User avatar
rip
Luxer
Posts: 352
Joined: Wed Mar 31, 2004 10:22 am
Location: Vienna Austria
Contact:

ok

Post by rip » Tue May 22, 2007 6:02 am

I'll look at BotOMatic. I'd BotOfDoom installed but not that one.

Thanks!

Still, my bots end up getting pretty big. Ravitar will end up in Reaper's class probably. For size, certainly probably not for abilities :>

rip

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

Re: I Am Not a Java Programmer

Post by Bertrand » Tue May 22, 2007 7:03 pm

rip wrote:But when I compile Bug, does it include the code for SmarterAgentBase, /and/ SmartAgentBase in the class, or does it assume that the base package (Lux) includes that code?
Funny, I'm not a java programmer either! I think that your class file does not include any other code. If you go the multiple objects route, you would have to create a directory structure inside the Agents folder to put the other classes in. Something like Agents\com\sillysoft\lux\agent\*.class if you use the com.sillysoft.lux.agent package.

I prefer the KISS principle, and keep everything in one class.

rip wrote:Still, my bots end up getting pretty big. Ravitar will end up in Reaper's class probably. For size, certainly probably not for abilities :>
True, Reaper is getting fat, but there is lots of code and text in there to handle chatting. Right now he clocks in at 6.5K lines.

Post Reply

Who is online

Users browsing this forum: No registered users and 54 guests