What is the proper way to implement LuaAI?

What is the proper way to implement LuaAI?

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

Moderators: hoijui, Moderators

Post Reply
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

What is the proper way to implement LuaAI?

Post by Anarchid »

Now, i am confused. While the wiki says that luaAi's need to be executed on every machine in game. Then, there's a mention here that says they don't run on every machine.

So, how do LuaAi's work exactly, and what is the proper way to do them? So far i've just used a gadget that reads GetTeamLuaAI and assumes control of whoever has this set -- is this the way it's supposed to be?
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: What is the proper way to implement LuaAI?

Post by lurker »

The proper way is however the heck you want to do it.

If you want it to run synced, then make it a gadget that latches on. If you want it to be a real AI that you can set up more than one of, you'll want the gadget to create instances of itself or be written in an OO way.

If you want it to run on one computer, you could, for example, have it run in the unsynced gadget area, sending commands to a small bit of synced code that passes them on to the units.

AF's wording isn't the best in that post. 'no longer run synced' isn't true here nor there; they never had to run synced, but still can run synced.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: What is the proper way to implement LuaAI?

Post by AF »

Lua changes and someone says one thing and someone says another and you don't know whose right or if theyre both right.

If I'm not mistaken the reason it says it no longer runs synced is because of an objection by you yourself. I'm going to edit the post and remove both the strikeout text and the correction.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: What is the proper way to implement LuaAI?

Post by lurker »

lurker originally wrote:doesn't need to run synced
AF wrote:no longer runs synced
See the difference? It never had to run synced and doesn't have to run unsynced.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: What is the proper way to implement LuaAI?

Post by AF »

Do not manipulate sentences and take quotes out of context in order to attack somebody, especially not in this forum. Most of the people who actively post in this forum are developers, newbie coders, or academics, it is not in your interests to troll, and it is not in the interests of this projects survival to allow that in this forum.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: What is the proper way to implement LuaAI?

Post by lurker »

I'm not trolling, nor am I taking things out of context. Here is the entire quote, my post and your response:
AF wrote:
lurker wrote:Now don't you FUD too. A lua AI doesn't need to run synced. Still going to be slow, though.
Heh I didn't know that, I was going off of something trepan said on the forums when he implemented lua AIs, Ill issue a correction!
I do apologise that I'm not quoting what your blog said, I don't have a copy of what was there before you deleted it.

I don't know why you think I'm attacking you, just trying to explain that it can be synced or unsynced, because the wiki being wrong is confusing enough. Anarchid, which wiki page? I can't find it searching quickly.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: What is the proper way to implement LuaAI?

Post by AF »

I modified my blogpost accordingly admitting it was incorrect. But you still took that quote out of context and snipped words either side to get the bits you wanted.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: What is the proper way to implement LuaAI?

Post by lurker »

I know I snipped a bit quoting your post, but I was trying to get what the blog post had said, and that was your own summary of what it had said.
AF wrote:I modified my blogpost accordingly admitting it was incorrect.
I had gotten the impression you were still unsure, and were just removing it entirely. I was trying to clarify it, not attack you. v_v
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: What is the proper way to implement LuaAI?

Post by AF »

I said they can run unsynced with the text saying they had to run synced striked out. Semantics! But as I said, I edited my blog post a second time to remove that entirely so ti didnt mention synced or unsynced at all.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: What is the proper way to implement LuaAI?

Post by lurker »

You said 'can'? Then I horribly misread it; sorry. Again, my only intent has been to clarify.
slogic
AI Developer
Posts: 626
Joined: 17 Mar 2008, 19:03

Re: What is the proper way to implement LuaAI?

Post by slogic »

Finally, i guess the simplest answer would be: if you're creating a SkirmishAI then it should be synced & you should write a gadget (but better use any of the AI interfaces), otherwise it is a HelperAI & it should be written as widget (e.g. SmartNanos widget). By the way, i think widgets are true cheats cause if i'm a top coder i could create a superb helper AI widget which will do everything (or most of things) for me.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: What is the proper way to implement LuaAI?

Post by lurker »

I don't know; it's certainly easier to the write a synced AI, but not by a whole lot, and you can get a big speed improvement if you make a skirmish AI unsynced. In this case you have a miniature bit of synced code to actually implement orders, and it sends lua messages back and forth to the unsynced majority. This could be gadget unsynced or widget, but another benefit of having the majority of the code run in the widget arena is that you can have permanent config files and load external libraries.
Post Reply

Return to “AI”