Lua AI Solution n#2 - Page 2

Lua AI Solution n#2

Here is where ideas can be collected for the skirmish AI in development

Moderators: hoijui, Moderators

User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Lua AI Solution n#2

Post by AF »

Ideally you should only use the word and once in a sentence, should you require the need to use several and words in a sentence in roder to chain items you would use commars, aka 1,2,3 and 4. If the items being listed are sentences or phrases you may want to use ';'.

http://www.thepcspy.com/read/so_youre_t ... _a_comment

The sort of stuff english children learn in their first year at school, it should help you articulate better.

Also none of the AIs have direct access to lua scripts in the way your wanting, nor should they need to in order to communicate. None of the AIs can use the lua scripts.

None of the AI Interfaces provide Lua State pointers either.

I'm sorry but can you state what your actually doing and most importantly make us understand why your doing it.
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: Lua AI Solution n#2

Post by Kloot »

JAI can't use the Lua scripts and is AI not for helpers, and is not done and very buggy.
_No_ AI (global or group) can "use" a Lua script, what's possible is data
exchange between them and a Lua gadget via the AI callback interface
(global and group AI's share the same callbacks). JAI could be extended
to cover group AI's as well, the fact that it is not finished does not mean
you should just go off on a wild tangent and give AI's access to Spring's
Lua VM via some hackish intermediary scheme (if I am interpreting what
you are trying to do correctly).
Where is the Java port RAI? Can it talk to Lua? If so then good. If now how does that make helper scripts available for Java.
1. Ask hoijui
2. Probably not yet (depends on the status of JAI)
3. See above ;)
tberthel
Posts: 59
Joined: 12 Jan 2008, 06:17

Re: Lua AI Solution n#2

Post by tberthel »

You both are full of it.

Koot,

The AI's currently don't work as helpers. They are added as bots. If I could create helpers in Java to call Lua then I would be making the changes I need. hoijui is not responsive and pretends to want to open it but doesn't even have headers or a license file.

AF:

Stop trying to flame me with your grammar rules crap. Who cares how I write. It is crystal clear what I am doing. I'm going to make the changes regardless. So to bad so sad for you. Why do you hate java access to lua helpers so much. If that isn't a reason enough for you I don't care. Plus it would stop the build bloat since unit sync uses the same code which is specified in a build file for future change.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Lua AI Solution n#2

Post by hoijui »

yes JAI supports only GlobalAIs, and not GroupAIs, currently, and yes, it should be quite simple to extend it to that. JAI global AIs can use LUA the same way other AIs can, through that one callback function. i did not yet test that, but well.. its a function that takes a string and returns a string or something, so there is no reason it should not work in JAI.

as said, JAI is still unstable and unfinished, and because of the new C interface coming up, i think it will first be ported to that and some when later be released as stable. i see JAI as my project. sure, it will be open-source, but i wanted to have some control over it. the first 6 months were really boring annoying work, till i got it to work somehow, and now that it gets interesting. i want to keep maintaining it, till it is stable. then i would like to get spring SVN write access and be able to co-maintain it there. i'll try to go further on the C interface today, so i'll be able to go further with JAI too, later. i can understand that you want to fix it, now, but there is not only you.

as it is a community, it generally does not work well if you just do what you want, and do not care if others understand what and why you are doing that. in the end, nobody wants it, or you will find out that something simpler and better was done already, or that it is useless, or you had an error in your thinking which would have been revealed earlier if the others understood what you wanted to do, ...
most importantly, your thing will never be supported by others, not come with an official release, and possibly become useless if someone changes something in spring and you are not following the changes, ...

i do not understand what you want to do with this lua stuff either. if my vague idea of what i think you want to do is correct (which is unlikely), it really is rather unpractical for the project its self, and only aimed at what you want to do.
tberthel
Posts: 59
Joined: 12 Jan 2008, 06:17

Re: Lua AI Solution n#2

Post by tberthel »

Use Java to make helpers. Use Java to make helpers. Use Java to make helpers.

How simple can I make it.

Secondly, JAI is what I would use to make AIs if it had the cross capability of being a helper. If it can't do that then it doesn't do what I want and I can't change it until it becomes open.

Example, I have a Lua script that only has fighters that don't have radar and are not bombers go on patrol when created. I would like that same capability in my AI and also move it to Java.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Lua AI Solution n#2

Post by hoijui »

ahhh.. you mean the widgets, the things that come up when pressing F11 (default key).

would it not make more sence, to do something like what we are doing with the AI interface? i mean: designing a C interface for widgets, and then building a LUA interface on top of that, and possibly a Java one aswell. it is a bit more work, but a much cleaner way, no?
tberthel
Posts: 59
Joined: 12 Jan 2008, 06:17

Re: Lua AI Solution n#2

Post by tberthel »

Well that would be great, but that still doesn't allow Java to leverage Lua. So I would still want what I am doing.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Lua AI Solution n#2

Post by AF »

tberthal I'm not trolling you Im just trying to udnerstand what you were doing.

You see when you say helpers you might think your being crystal clear but your not. There are many things that could be termed as helpers. for example, group AIs, lua widgets, even skirmish AIs that co-operate with the player.

But rather than answer my question you just attempted to prove the benefits of lua<->java even though what I really wanted was for you to explain why not how. I thought perhaps a little improved grammar might help, especially since some of your sentences had literally hundreds of different interpretations all subtly different.

However if its the lua UI capabilities of Lua widgets that you want your wont get them from lua <-> java without hackery. Your java and lua Virtual machines wont be able to call the necessary callbacks in the spring lua API because they'd need direct access into spring tiself at which point there's no need for lua and you might aswell do a direct spring<->java interface.

You would need to cache the necessary commands so that when the lua scripts are running under the spring lua Virtual machine that has implementations of these APIs they can then be executed.

Or you could avoid the whole thing and use trepans callback to send a message from the AI to lua gadgets, bypassing all the effort and giving you something you can work with right now.

Eitherway, you'll never get svn access if your not willing to discuss things wiht other people, and the whole idea of adding in AIs to augment and help improve your abilities is something that will get you 50 or so very angry forum posters complaining and a sizeable proportion of people leaving in protest.

Surely we must have learnt the lessons of the 5 or so 20 page flame war threads over group AIs and people doing exactly what your intending to do.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Lua AI Solution n#2

Post by hoijui »

hmm.. now i am even more confused. you dont want to do something specifically with spring from within java that yet is only available from within LUa, but you want to do LUA <-> Java in general?

simplyfied:
whatever part of spring. that is doable in LUA, and you want to do in Java, is definatly better done with direct spring -> Java instead of spring -> LUA -> Java (as AF said already).
if you just want LUA<->Java in general, it has nothing to do with spring and the AI forum or the spring forum and this community in general.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Lua AI Solution n#2

Post by AF »

I think implementing a generic gadget that acts as a proxy between the AI and a lua widget would be more appropriate
tberthel
Posts: 59
Joined: 12 Jan 2008, 06:17

Re: Lua AI Solution n#2

Post by tberthel »

I'm sorry you 2 don't understand. I don't need to communicate to get what I want. So don't worry about it.

When or if you see or notice something of mine (New Java Helpers (Widget, Skirmish, Group, or Other)) that you want then maybe you will understand or maybe you won't. I look forward to leveraging JAI if it becomes open, or any Java wrapper to any other AI or Widget API into Spring.

Until then good luck on your development.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Lua AI Solution n#2

Post by AF »

If you dont communicate then you'll never get svn access, its that simple.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Lua AI Solution n#2

Post by hoijui »

hmm.. so tberthel, you want ot do it only for you? in the end, you will be the only one using whatever you will code? and that is fine for you?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Lua AI Solution n#2

Post by AF »

keep in mind playing with players who do not have your modifications will cause desync.
User avatar
SpliFF
Posts: 1224
Joined: 28 Jul 2008, 06:51

Re: Lua AI Solution n#2

Post by SpliFF »

I read the whole thing, and finally got what you were asking somewhere around the second page.

As is now clear to me, when you say 'helper' you actually mean a 'widget', in Spring parlance. Helper was the term traditionally used to mean Group AI (the AI that controls a selected squad - eg, 'Simple Formation').

You can't be referring to a gadget, group ai or opponent ai (each a separate concept) because all of these require the script to be installed by every player (not going to happen unless you write a mod).

Now the silly thing is this: You've said you're very smart and you work with C, Java and Lua, and I won't dispute those claims; but if that's the case why do you need Java at all? There is a perfectly functional Lua environment for widgets and you've already implied your widget will leverage existing Lua.

So why not just write the whole thing in Lua? You're certainly not going to improve performance or stability with your tertiary binding.

Is there something Lua can't do that you need or is it just that Java is your preferred language?
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Re: Lua AI Solution n#2

Post by jcnossen »

AFAICS tberthel wants spring to load a java module in some way, and then pass the Lua state pointer to it so the java part can use it with LuaJava.

This is quite a nice idea IMO, especially since it doesn't need another java scripting interface in spring, but can just use the spring lua bindings.

The only new thing that spring itself needs to do is load some java code and pass a pointer.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Lua AI Solution n#2

Post by AF »

My intention was that the AI would recieve extra help and logic in maintaining tis units via gadgets in the mod, that would only take effect on AI units, hence players would not have intererence or advantages.
Post Reply

Return to “AI”