Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (524)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (592)
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 3819 times)
0 Members and 1 Guest are viewing this topic.
Offline kevglass

« JGO Spiffy Duke »


Medals: 208
Projects: 24
Exp: 18 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,

Kev

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.   http://groovy.codehaus.org/
F3 - Hasn't been fully released yet and it is not real java either.   http://blogs.sun.com/chrisoliver/entry/f3
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.  http://www.beanshell.org/index.html

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?

Keith

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

« JGO Spiffy Duke »


Medals: 208
Projects: 24
Exp: 18 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.

Kev

Offline aldacron

Senior Devvie


Medals: 9
Exp: 16 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 »

Hi,
I was just reading around and came across this site http://theopensourcery.com/jsgpsl.htm 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.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

toopeicgaming1999 (57 views)
2014-11-26 15:22:04

toopeicgaming1999 (50 views)
2014-11-26 15:20:36

toopeicgaming1999 (10 views)
2014-11-26 15:20:08

SHC (24 views)
2014-11-25 12:00:59

SHC (24 views)
2014-11-25 11:53:45

Norakomi (27 views)
2014-11-25 11:26:43

Gibbo3771 (24 views)
2014-11-24 19:59:16

trollwarrior1 (37 views)
2014-11-22 12:13:56

xFryIx (75 views)
2014-11-13 12:34:49

digdugdiggy (52 views)
2014-11-12 21:11:50
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org 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‑gaming.org
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!