Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (710)
Games in Android Showcase (212)
games submitted by our members
Games in WIP (784)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  AI detail level and scripting  (Read 5306 times)
0 Members and 1 Guest are viewing this topic.
Offline kevglass

« JGO Spiffy Duke »

Medals: 319
Projects: 25
Exp: 22 years

Coder, Trainee Pixel Artist, Game Reviewer

« Posted 2007-01-04 17:55:32 »

I'm just at conception stages of a new game and thinking about how to implement AI. The game takes place in two fields:

1) A risk style level map where units are moved around to protect resoruce given by owning areas

2) A combat arena where the units from the top level map fight it out in turn based strategy to take ownership of areas

Having never done much formal AI coding I was wondering about two things. First, does it make sense to treat both of scenarios seperately (as in completely decoupled) or to provide some way of the two interacting.

Second, I think I might finally bite the bullet and look at scripting again for the purposes of AI. I hear that Lua is the preferred option where AI is concerened but I'm not really sure of the pros/cons of different dynamic alternatives. LuaJava looks pretty mature and well used so I guess it's a good option?

It's all turned based so I'm thinking performance isn't too much of a concern.

Thoughts appreciated,


Offline ravenger

Senior Newbie

« Reply #1 - Posted 2007-01-16 17:23:29 »

Don't have experience with scripting, tho i could say something about AI;

I guess you could treat both scenario's the same. You'd prolly have to calculate a priority for each area every turn for all of the owned areas and the ajecent enemy ones,. The priority should be something constructed from the amount of units in the certain area, ajecent area sovereignity and some other factors. From there on you should be able to decide on where you want to move troops from and to (ie from low priority area to a high one). Maybe you could do something with A* pathfinding aswell if the units have to come from elsewhere.

Offline CommanderKeith
« Reply #2 - Posted 2007-01-18 17:03:56 »

About scripting, I've been really disappointed with it. 

Seems like there are 3 main options and they are all half-baked IMO.

Groovy - must be fast since it turns the script into byte code and runs it in the JVM.  Problem is that it is a whole new language that is similar but different to java.  You can't just cut and paste java code into and out of your program.
F3 - Hasn't been fully released yet and it is not real java either.
BeanShell - Is meant to be like pure Java but there are lots of bugs.  eg declaring an array can only be done like String anArray[] = ...;  Also the error reporting isn't very good and the project hasn't been active since mid-2005 it seems.  Unlike Groovy the code isn't turned into bytecode and fed to the JVM, instead it manipulates the objects using Reflection which is slower.

I hadn't heard of Lua Java but it looks OK if you are already familiar with it... but once you've perfected the AI code wouldn't you want to stick it in the Java code with the rest of the program?


Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline kevglass

« JGO Spiffy Duke »

Medals: 319
Projects: 25
Exp: 22 years

Coder, Trainee Pixel Artist, Game Reviewer

« Reply #3 - Posted 2007-01-18 17:13:25 »

I'm only going on others advice - as mentioned, AI and me haven't really been together very long. Scripting gives the ability to tweak with in game editing without extra leg work. Sure once it's perfected you could put it back into the source, however if it's fast enough why bother?

Onyx suggested pnuts as a possibility, but so far I haven't had any time to look at any of them.

As I mull it over in my mind I'm really having trouble justifying using scripting for this game tho - I just can't picture how it's going to be a great boon.


Offline aldacron

JGO Coder

Medals: 18
Exp: 18 years

Java games rock!

« Reply #4 - Posted 2007-01-18 17:59:17 »

Onyx suggested pnuts as a possibility, but so far I haven't had any time to look at any of them.

I use LUA when working with C, but for scripting in Java pnuts just rocks. It's fast, easy to implement, easy to pick up, scripts can be compiled to classes... I can't say enough good about it. I've used it both with and without the new scripting framework. It's easy to implement either way. It supports generators (coroutines), which are very useful in AI scripting. I'm putting it to work in a project right now and so far, no troubles.
Offline biggeruniverse

Senior Newbie

That's just peanuts to space.

« Reply #5 - Posted 2007-01-19 13:26:48 »

Actually, in testing most of the options, my personal favorite has been Groovy. pnuts has some odd little quirks.

What do you mean by "AI"? That's anywhere from path-finding to Neural Nets. What you use will really depend on what kind of gameplay you are going for, and will probably be a combination of several things.
Offline Swackhammer1

Innocent Bystander

« Reply #6 - Posted 2007-02-15 15:44:19 »

I was just reading around and came across this site which mentions 'Rhino'. I was wondering if anyone has any insight as to how useful it would be for game scripting.

Nihil Fieri Non Potest Nobiscum -- Nothing Is Beyond Our Reach.
Offline oNyx

JGO Coder

Medals: 2

pixels! :x

« Reply #7 - Posted 2007-02-15 19:34:26 »

Well, you can use it to script the menu flow or stuff like dialogs (high level logic). So, you can use it to do all the stuff which is usually done with scripting.

But you can't script inner loops n stuff like that. Well, you could, but it would be too slow.

If you want to script everything, take a look at Janino (it's a very fast on-the-fly compiler).

弾幕 ☆ @mahonnaiseblog
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

numerical (7 views)
2017-02-21 07:32:16

numerical (5 views)
2017-02-21 07:31:46

theagentd (118 views)
2017-02-18 13:42:33

theagentd (122 views)
2017-02-18 13:35:16

h.pernpeintner (1286 views)
2017-01-24 22:39:11

h.pernpeintner (1274 views)
2017-01-24 22:38:32

Galdo (1834 views)
2017-01-12 13:44:09

Archive (1937 views)
2017-01-02 05:31:41

0AndrewShepherd0 (2476 views)
2016-12-16 03:58:39

0AndrewShepherd0 (2303 views)
2016-12-15 21:50:57
List of Learning Resources
by elect
2016-09-09 09:47:55

List of Learning Resources
by elect
2016-09-08 09:47:20

List of Learning Resources
by elect
2016-09-08 09:46:51

List of Learning Resources
by elect
2016-09-08 09:46:27

List of Learning Resources
by elect
2016-09-08 09:45:41

List of Learning Resources
by elect
2016-09-08 08:39:20

List of Learning Resources
by elect
2016-09-08 08:38:19

Rendering resources
by Roquen
2016-08-08 05:55:21 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!