Mechanized Assault & eXploration Reloaded



#11 Jan 03, 2013 4:34 pm
beko beko Offline
Developer, Administrator
Registered since: Jun 04, 2004
Posts: 2,279


Subject: Re: Ai implementation
It depends on how you implement it. You can basically use LUA as client or in the server.

Legend Of Grimrock had a nice article about this recently: http://www.grimrock.net/...ogramming/

They used a variant of LUA called LuaJIT that is capable of just in time compilation. Read pretty slick. I never tried it myself however. Guess why Wink
Bernd Kosmahl
"Sir, we are surrounded!" - "Great - we can attack in any direction."
↑  ↓

#12 Jan 03, 2013 6:26 pm
Toranaga Toranaga Offline
Developer
Registered since: Dec 28, 2005
Posts: 232


Subject: Re: Ai implementation
Quote by Eiko:

3) Directly within the server main loop. Direct access to the game model.
  • Yes easy implementation
  • No AI could slow down the server main loop too much. That would affect the game speed an all clients.
  • No No multicore support: All AI players and the Server itself share the same CPU core.

I think there is no inherent problem in writing the AI (and even the Server) as a multi-threaded application. So I think multicore support should be possible. We just have to think how to do it right without introducing too many locks.
Paul Grathwohl (pagra)
↑  ↓

#13 Jan 04, 2013 12:48 am
Jarod42 Offline
Developer
Registered since: Oct 17, 2011
Posts: 84


Subject: Re: Ai implementation
Method 1 requires code duplication (as I understand).
I prefer method 2, but it requires a _lot_ of cleaning to separate game state from UI (which is good, I think in long term).
Method 3 is the easier to have something, but I don't like mixing AI stuff in not simple server code...
↑  ↓

#14 Jan 05, 2013 12:21 pm
alzi alzi Offline
Developer, Moderator
Registered since: Aug 12, 2007
Posts: 339


Subject: Re: Ai implementation
Quote by Eiko:
Now that you mention it, I remember...

Alzi once wrote a concept for lua integration:

http://www.maxr.org/showtopic.php?id=650&page=1

But I don't understand the concept in deep detail. Does this mean, the script is interpreted by the server, so this would be a variant of method 3) ?

Yes this would mean the script is interpreted by the server. The advantages would be that with lua we would have one interface for AI scripts and for scenarios that would be very powerful. And the AI would then not be directly integrated within any of the C++ code, but can be handled as separate module that does not affect compilation.
As for the slow down problem with the server I'am with pagra: It should definitely be possible to write this in a multi-threaded manner, so that we can use even more processes.
Albert Ziegenhagel
↑  ↓

#15 Jan 05, 2013 5:46 pm
ness Offline
Developer
Registered since: Nov 12, 2010
Posts: 59


Subject: Re: Ai implementation
I'm for 1.
I think it is possible without having too much code duplication. Maybe that will need as a first step to make a library with all common code to access the server eg. That library would be used by both GUI client and AI client.

And I hate AI that cheats to win Tongue

Also for LUA, this is scripting language that can be used to make AI modules, those modules can be used to make more clever AI and so on.
As an example we could have a look at what they did in openTDD (bottom of the page): http://www.openttd.org/en/development
↑  ↓

#16 Feb 16, 2013 11:29 pm
urrit Offline
Approved Member
Registered since: Feb 16, 2013
Posts: 1


Subject: Re: Ai implementation
Hello all,

I discovered MAXR a few years ago and have checked in every now and then for the latest release. I'd like to help, but I don't know where to start.

My background:
-I'm an engineer who knows the basics about programming in C++ and writes programs at work.
-However, I'm not a programmer who writes code every day and knows libraries by heart.

My interests:
-I've enjoyed gaming my whole life. Although I've never programmed a "real" game, I've always wanted to make my own game.
-I like to play singleplayer games where I can take my time to strategize and scheme, but they become boring once I "figure out" how the AI works. This leads me to play multiplayer games where I can find opponents who can offer up a challenge. Unfortunately, most of the good multiplayer games that I've come across are either FPSs or RTSs.
-Efficiency.

My convictions:
-Every game that I can think of that I've ever played has made the game harder by giving the AI some kind of bonus/advantage or by giving me a handicap at the higher difficulty settings. Sure, the game becomes more challenging for the first few rounds, but, since the AI has the same limitations as it did on "normal" mode, the AI is still flawed by the same logic. All that means is that now I have to defend against a rush of 15 marines instead of 8. At that point, since I'm always looking for the path of least resistance to victory, I naturally settle for some kind of strategy that involves exploiting the AI's logic to compensate for my disadvantage.
-I understand that developers don't always have the time or resources to develop the AI further, so I don't want to call it "lazy" per se, but, at the bare minimum, it certainly doesn't raise the standard. I expect more. It would be nice if I could help MAXR develop a robust AI to play against.

I really don't think I know enough to be helpful as far as coding how the game communicates with the players and AI over the internet and such. I think I'll go ahead and start throwing together some pseudo-code or methods until you experts decide how the AI should be implemented and I can learn more about what needs to be done and how I can be useful.
↑  ↓

#17 Feb 19, 2013 6:58 pm
Sandman Sandman Offline
, Approved Member
Registered since: Jul 29, 2004
Posts: 105


Subject: Re: Ai implementation
Hi Guys,

I'm still out there and watching especially this post, looking forward to the next step...

See ya,
Sandman

"AAAAAAAAAAAAAAAAAAAAaaaaaaaaaahhhh..." [spotted Infiltrator!] Angel
↑  ↓

#18 Feb 21, 2013 10:37 am
beko beko Offline
Developer, Administrator
Registered since: Jun 04, 2004
Posts: 2,279


Subject: Re: Ai implementation
Quote by urrit:

I discovered MAXR a few years ago and have checked in every now and then for the latest release. I'd like to help, but I don't know where to start.

Hi urrit and welcome on the forum. As you may have guessed it's a slow forum / project Smiling

It's really great that you want to help. No need to write a resume however Wink Check our Bugtracker, grab the source from SNV and simply start hacking. We gladly accept patches. If you're stucked the fastest way to contact a dev is usually in the evening (GMT+1) on the IRC. Also make sure to check the dev forum where I'll grant you access to.

Sorry, I can't give any more advice or guidance right now since my reallife became very spicy the last months Undecided
Bernd Kosmahl
"Sir, we are surrounded!" - "Great - we can attack in any direction."
↑  ↓

#19 Jan 02, 2016 10:55 pm
Razvan Offline
Approved Member
Registered since: Dec 13, 2012
Posts: 3


Subject: Re: Ai implementation
Hello everybody and happy new year!

I was playing MAX over the holiday and I remembered the thread. I think the major issue is not the architecture (whether we do in-process or out-process, using LUA or C++, etc ) but the major issue is how to do it with regard of algorithmic implementation. The game is very complex, as it requires an interconnected "threads" of economy, exploration and military strategy. They are interconnected because focusing on economy only will make the player vulnerable to early attacks, while focusing on military expenditure will affect the player on the long run, if unable to defend quickly the adversaries.

What I was wondering these days is if you have any large number of games stored (as a set of events) and in case you do, this may be fed to a neural network. I can contribute the NN and the initial training. I don't know how well can be trained such a player, but I think it is worth trying. The game is highly stateful (one cannot build if no materials are available) or it requires a long chain of events strategy therefore I don't know if the NN will be able to follow up such a chain or rather jump from one strategy to another.

Also, the neural network will "try" at least in the initial phase to build or move items to invalid places, the server needs to be able to reject such requests.

On the other hand, being able to "cheat" with regard of exploration, adversary position and assets would greatly boost the AI.

Cheers,
Razvan
↑  ↓

Pages (2): 1, 2

All times are GMT +01:00. Current time: 1:33 am.