BigHead
thanks
On a separate note, all that's really missing to make a LuaGaia or
LuaRules AI possible is a decent metal map calculator (which I
happen to have on my hard drive). If I commit and make it possible,
it'll be interesting to see what could be done, and at what cost.
One small advantage to a synced lua AI is that it requires no bandwidth
(not that I think there are all that many multiplayer + AI games being
played). The opposite side of that coin is that the AI calculations must
be done on all client computers.
I should take a look at some of the current AIs to see where the
bottlenecks are, and get an idea as to whether or not this is worth
trying. If it does pan out, then it might be worth breaking out a
separate LuaAI class.
P.S. I'm guessing that without a few support call-outs, lua AIs could
be terrifically slow (depending on their level of complexity)
LuaAI (split from: AI improver gadget)
Moderator: Moderators
hmm somehow I dont think LuaAI is a new idea.
However it comes along with a slew of penalties, and although speed is on of them, its no the worst.
For one we've already explored a lot of avenues of simple AI, and to continue we're either going to have to opt into areas that lua isnt that great at handling, or we're going to have to start implementing more maths, maths that we'd have to implement from scratch in lua whereas we could simply use an existing library in C or another more widespread language. For example CGAL.
Ontop of that there's a vast wealth of code and research into things such as pathfinding in c++. Lua cant domainate the AI scene that is currently held by Global AIs, and if it does it will mean inferior AIs for all or slow AI lag for all.
Lua should be an aide for AIs, to allow mods to improve AIs by adding behaviours or as a tool for customizing AIs and allowing them to interact with gadgets and widgets in order for us to get the best of both worlds.
So why don't we have the same issue with a java or C# ai? Because java and C# can use existing libraries too, have a huge library base, and a consistent set of APIs for a huge range of actions. They're also much better performance wise for the various possibilities AI could use.
Ontop of that the AIs dnt have to be synced to b able to run effectively, and each machine can use different calculations to get results as they're only ran on one machine. There're also the benefits of asynchronous designs and multithreading, which are especially relevant where Java and C# are concerned.
Simply put, your not going to get a KAI style AI into a lua format without paying a price.
As for AI innovation, here is why it isnt happening:
1: Lack of people and developers
2: Lack of time with existing developers
3: AI interface neglect and personal involvement by developers
4: modder ignorance
However it comes along with a slew of penalties, and although speed is on of them, its no the worst.
For one we've already explored a lot of avenues of simple AI, and to continue we're either going to have to opt into areas that lua isnt that great at handling, or we're going to have to start implementing more maths, maths that we'd have to implement from scratch in lua whereas we could simply use an existing library in C or another more widespread language. For example CGAL.
Ontop of that there's a vast wealth of code and research into things such as pathfinding in c++. Lua cant domainate the AI scene that is currently held by Global AIs, and if it does it will mean inferior AIs for all or slow AI lag for all.
Lua should be an aide for AIs, to allow mods to improve AIs by adding behaviours or as a tool for customizing AIs and allowing them to interact with gadgets and widgets in order for us to get the best of both worlds.
So why don't we have the same issue with a java or C# ai? Because java and C# can use existing libraries too, have a huge library base, and a consistent set of APIs for a huge range of actions. They're also much better performance wise for the various possibilities AI could use.
Ontop of that the AIs dnt have to be synced to b able to run effectively, and each machine can use different calculations to get results as they're only ran on one machine. There're also the benefits of asynchronous designs and multithreading, which are especially relevant where Java and C# are concerned.
Simply put, your not going to get a KAI style AI into a lua format without paying a price.
As for AI innovation, here is why it isnt happening:
1: Lack of people and developers
2: Lack of time with existing developers
3: AI interface neglect and personal involvement by developers
4: modder ignorance
Lua could be setup to use CGAL, or any other C/C++ compatible library.
I would have thought this obvious from the fact the Spring's lua scripts
are already interfaced to OpenGL (and can be used to render complicated
meshes in complicated ways). I guess sometimes we only see what we
want to see, heh?
A LuaAI class could be setup to be asynchronous, you could even wire
it in using the current global AI bindings. Lua also has a form of threading.
Rather then lua being an aid to AIs, you could set it up so that lua does
the higher level control (possibly through some abstracted lua objects),
and the C++ code is made available for routines that require the speed.
I would have thought this obvious from the fact the Spring's lua scripts
are already interfaced to OpenGL (and can be used to render complicated
meshes in complicated ways). I guess sometimes we only see what we
want to see, heh?
A LuaAI class could be setup to be asynchronous, you could even wire
it in using the current global AI bindings. Lua also has a form of threading.
Rather then lua being an aid to AIs, you could set it up so that lua does
the higher level control (possibly through some abstracted lua objects),
and the C++ code is made available for routines that require the speed.
I don't understand why would anyone want to do such complicated thing (AI) in lua. I mean, lua is most likely the worst programming language ever. It's great for simple scripts (<1000 lines of code) but imagine writing something huge in it. Programers hell.
Still I think it's a good idea. If Spring ever manages to have a single-player campaign, it will most likely need some custom AI that is able to follow scripted mission structure while microing it's unts. I think lua is the best and only candidate.
Edit:
Still I think it's a good idea. If Spring ever manages to have a single-player campaign, it will most likely need some custom AI that is able to follow scripted mission structure while microing it's unts. I think lua is the best and only candidate.
Edit:
... and chess is game with simple set of rules played on 8x8 "map". Compare it to most spring mods and mapslook at the power of computer needed to beat a human at chess

Python has ctypes which makes this sort of stuff supereasy... wonder if Lua has something similar.trepan wrote:Rather then lua being an aid to AIs, you could set it up so that lua does
the higher level control (possibly through some abstracted lua objects),
and the C++ code is made available for routines that require the speed.
Trepan, when doing AI development waiting several months for a new spring release so that you can use a new library that has been integrated into spring is unnacceptable.
Ontop of that if your the only one using that library it would be irresponsible to enforce it on all spring users, and it would not fit in with the current consensus in development that we should minimize springs dependencies.
Of course you could then justify it by building an abstract interface with a C++ dll which in turn loads thus allieviating the issue but so far you've failed to even implement a simple method of sending "hello world" nm calls to an external library, despite large demand from numerous longstanding members of the community. At which point it becomes an all lua or an all C++.
Implementing the interface would undermine the whole point as you would have implemented the very thing C++ AI developers and their users have been demanding for such a long time. An attempt to restrict things and no include the existing AI interface would be seen as a malicious attempt at developing for personal gain at the expense of the spring community.
So to avoid the whole mess of the AI win win situation you could just ignore AI or enforce lua only AIs at which point you leave yourself open to scrutiny and portray a bad image of yourself as an immature developer with a personal vendetta.
Of course the lack of co-operation and a hostile attitude that shows no signs of giving way to compromise and discussion does nothing to help the matter and raises an atmosphere of uncertainty that has contributed greatly towards the slowdown in AI development and has already instilled fears in some modders over how they should use lua and yet not loose AI compatibility forever.
Ontop of that if your the only one using that library it would be irresponsible to enforce it on all spring users, and it would not fit in with the current consensus in development that we should minimize springs dependencies.
Of course you could then justify it by building an abstract interface with a C++ dll which in turn loads thus allieviating the issue but so far you've failed to even implement a simple method of sending "hello world" nm calls to an external library, despite large demand from numerous longstanding members of the community. At which point it becomes an all lua or an all C++.
Implementing the interface would undermine the whole point as you would have implemented the very thing C++ AI developers and their users have been demanding for such a long time. An attempt to restrict things and no include the existing AI interface would be seen as a malicious attempt at developing for personal gain at the expense of the spring community.
So to avoid the whole mess of the AI win win situation you could just ignore AI or enforce lua only AIs at which point you leave yourself open to scrutiny and portray a bad image of yourself as an immature developer with a personal vendetta.
Of course the lack of co-operation and a hostile attitude that shows no signs of giving way to compromise and discussion does nothing to help the matter and raises an atmosphere of uncertainty that has contributed greatly towards the slowdown in AI development and has already instilled fears in some modders over how they should use lua and yet not loose AI compatibility forever.
I have written several >1000 line scripts and I think Lua scales quite well. It lets you very easily divide your script into separate, independent tasks and hide complexity. LuaUI is a good example: as a widget maker you don't need to worry about other widgets or about what happens in the widget handler (which is 100% Lua).BigHead wrote:I don't understand why would anyone want to do such complicated thing (AI) in lua. I mean, lua is most likely the worst programming language ever. It's great for simple scripts (<1000 lines of code) but imagine writing something huge in it. Programers hell.