The Ur-Quan Masters Home Page Welcome, Guest. Please login or register.
Did you miss your activation email?
April 19, 2025, 08:33:37 pm
Home Help Search Login Register
News: Celebrating 30 years of Star Control 2 - The Ur-Quan Masters

+  The Ur-Quan Masters Discussion Forum
|-+  The Ur-Quan Masters Re-Release
| |-+  General UQM Discussion (Moderator: Death 999)
| | |-+  Thoughts on rewriting the AI
« previous next »
Pages: 1 [2] 3 Print
Author Topic: Thoughts on rewriting the AI  (Read 7631 times)
Valaggar
Guest


Email
Re: Thoughts on rewriting the AI
« Reply #15 on: April 24, 2007, 02:36:05 pm »

Yeah, keep up the good work. Don't mind the people requesting Kzorz-Za Nemeses on the Cafe - don't mind me either requesting them, which I surely will. In fact, don't even POST anymore ideas like that one. AI is a better project.
Logged
Smaug
Zebranky food
*
Offline Offline

Posts: 23


I love YaBB 1G - SP1!


View Profile
Re: Thoughts on rewriting the AI
« Reply #16 on: April 24, 2007, 11:52:10 pm »

Honestly?

If you guys are serious about improving the AI in the game, then you need to make it easier for people to do the work.

What you need is a single mod that you don't need grand C++ experience in order to get in there and adjust. And the best way I can think of to do that is to invoke a scripting language. My recommendation would be Lua.

The idea would be that the code would call a Lua script for each frame, and the Lua script would be able to ask questions (where is the ship, are there any space objects in this region of space, how fast am I going, etc) of the game and give their own ship commands (turn, fire, etc). The way I'd design it is such that there could be a single Lua script for every matchup, but if a script for a particular matchup isn't found, then the game goes to the standard ship script, and if that isn't found, it goes to a generic one that can work for all ships (but shouldn't work very well).

Lua as a language is a lot more fogiving than C++, and because it's executed at runtime, you can even change scripts in the middle of battle without needing to recompile them. This makes it much faster in terms of development of a good AI, since you don't have to stop the program, make your change, recompile, run, start Super Melee, select the fleets, and start the battle. The biggest difficulty is going to be creating a good script interface. That is, exposing appropriate script functions so that it can ask useful questions (is there a space object that will hit me if I keep going, can I dodge it in time to avoid the damage, etc). Once you work out a decent list of questions (and the best way to do it is to get a bare-bones script working, and then try to make a good AI. When you start needing to test things that there is no API function for, write one), you're pretty much ready to go.

Really you don't need all 625 different pairs in the end. Ship-based generic ones can handle a lot of the variation, but there are going to be certain encounters for certain ships that will require a hand-tuned approach.
Logged
Elvish Pillager
Enlightened
*****
Offline Offline

Posts: 625



View Profile
Re: Thoughts on rewriting the AI
« Reply #17 on: April 25, 2007, 12:02:04 am »

I'm not sure how much work it would be to sensibly integrate a scripting language... I suspect it would be a lot, given the game's current code.

I'm just a modder on this game, a coder of petty features. (and for a reason.)
Logged

My team of four Androsynth and three Chmmr is the most unfair team ever!
My mod
alexo
Zebranky food
*
Offline Offline

Posts: 6



View Profile
Re: Thoughts on rewriting the AI
« Reply #18 on: April 25, 2007, 05:27:18 pm »

I am personally very interested in AI that learns, but connecting your code to UQM is going to be tough, because the UQM code is not very clean.
I suggest you log in on the IRC channel #sc2 on irc.freenode.org sometime; I can give you some pointers interactively then.

Excellent, I'll need all the help I can get.  I'm gonna be familiarizing myself with the UQM code for the next couple weeks, I'm quite excited as I've never worked on a game, or on an open source project before.

How I'm planning to make this work...
1) clean up the UQM AI code
2) interface with with my Java reinforcement learning code
3) watch crazy AI battles unfold.

About my AI code...
1) Genetic programming based
2) Decomposes environment into useful sub-cases and solves each one separately (this gets around the 25*25 problem, coz we can just run random matchups and it will pick up on the cross-ship patterns itself).
3) Has many adjustable parameters such as reaction time.
4) Makes heavy use of multi-threading.
Logged
Death 999
Global Moderator
Enlightened
*****
Offline Offline

Gender: Male
Posts: 3876


We did. You did. Yes we can. No.


View Profile
Re: Thoughts on rewriting the AI
« Reply #19 on: April 26, 2007, 09:04:01 pm »

Are your genetic algorithms going to include 'sexual selection', i.e. nontrivial means of choosing pairs for crossbreeding?
Logged
alexo
Zebranky food
*
Offline Offline

Posts: 6



View Profile
Re: Thoughts on rewriting the AI
« Reply #20 on: April 27, 2007, 12:10:15 am »

Are your genetic algorithms going to include 'sexual selection', i.e. nontrivial means of choosing pairs for crossbreeding?

Yep, currently my model supports micro mutation, macro mutation, sexual recombination.  For choosing pairs for cross breading I use tournament selection with tournament size = 4.   This means that four individuals are randomly selected and compared by fitness, then the fitter two replace the two losers.  We will easily be able to pit different selection strategies against each other.
I am currently cleaning up my code, I'll put it up on google code or something when its good to go (currently I'm testing it on a tron-style game).
Logged
Death 999
Global Moderator
Enlightened
*****
Offline Offline

Gender: Male
Posts: 3876


We did. You did. Yes we can. No.


View Profile
Re: Thoughts on rewriting the AI
« Reply #21 on: April 27, 2007, 06:02:20 pm »

Though that's good, it's not what I meant.

I meant, do you have these AI's have any features not related to their performance which determine which AI's mate? Sexual selection can be useful to help 'valley-crossers' get where they're going, and can eventually bring about speciation.

Just a thought.
Logged
countchocula86
*Smell* controller
****
Offline Offline

Gender: Male
Posts: 345


Culture 20!


View Profile
Re: Thoughts on rewriting the AI
« Reply #22 on: April 27, 2007, 07:09:40 pm »

Does.......does that mean the ships are gonna get it on?
Logged

I like to think you killed a man. It's the romantic in me.
Death 999
Global Moderator
Enlightened
*****
Offline Offline

Gender: Male
Posts: 3876


We did. You did. Yes we can. No.


View Profile
Re: Thoughts on rewriting the AI
« Reply #23 on: April 27, 2007, 07:35:13 pm »

No, the AI's which fly the ships.
Logged
alexo
Zebranky food
*
Offline Offline

Posts: 6



View Profile
Re: Thoughts on rewriting the AI
« Reply #24 on: April 29, 2007, 07:01:37 am »

Though that's good, it's not what I meant.

I meant, do you have these AI's have any features not related to their performance which determine which AI's mate? Sexual selection can be useful to help 'valley-crossers' get where they're going, and can eventually bring about speciation.

Just a thought.

Yep there are many things that determine which AIs mate.  I use a cluster analysis algorithm to find useful patterns in the environment and then evolve independent niche species for each case.  With UQM, one niche might be "running away", and another might be "bogged down by green blobs".  A good read on this is http://www.cs.bham.ac.uk/~wbl/biblio/gp-html/rosca_thesis.html


Logged
Death 999
Global Moderator
Enlightened
*****
Offline Offline

Gender: Male
Posts: 3876


We did. You did. Yes we can. No.


View Profile
Re: Thoughts on rewriting the AI
« Reply #25 on: April 30, 2007, 06:31:58 pm »

That's good, and even better, but it's still not what I meant: you're still basing it off of survival advantage (combat performance).

Real organisms have additional selection criteria. Like, are pretty girls more capable of surviving? No; but they are more likely to reproduce. In the same vein, you are unlikely to attempt to mate with a chimpanzee, no matter how attractive that chimpanzee is to other chimps.

In other words, it may be useful to keep some clusters together by factors other than environmental selection.
Logged
meep-eep
Forum Admin
Enlightened
*****
Offline Offline

Posts: 2847



View Profile
Re: Thoughts on rewriting the AI
« Reply #26 on: April 30, 2007, 06:57:15 pm »

I don't see how that would benefit the evolution algorithm. In nature, these things seem to be side effects.
The concept of attractiveness seems to have evolved as an indicator of health and other properties which would make an individual more succesful. Once that mechanism of recognising attractiveness is in place, additional aspects which trigger the "attractiveness" mechanism but aren't beneficial to the survival chance of offspring will be selected.

In this artificial evolution, you can base the selection on the actual success.


Note that I do know that this is how the evolution of attractiveness actually worked, but it does seem to fit with what I would expect from evolution.
« Last Edit: April 30, 2007, 07:02:41 pm by meep-eep » Logged

“When Juffo-Wup is complete
when at last there is no Void, no Non
when the Creators return
then we can finally rest.”
Death 999
Global Moderator
Enlightened
*****
Offline Offline

Gender: Male
Posts: 3876


We did. You did. Yes we can. No.


View Profile
Re: Thoughts on rewriting the AI
« Reply #27 on: May 01, 2007, 09:06:53 pm »

They are beneficial, in that your AI's may 'speciate' and form populations which do not mix anymore because they are too different in internal structure.

Also, they may learn not to mate with AI's that are just like themselves (incest taboo).
Logged
meep-eep
Forum Admin
Enlightened
*****
Offline Offline

Posts: 2847



View Profile
Re: Thoughts on rewriting the AI
« Reply #28 on: May 01, 2007, 10:51:10 pm »

What's the use of speciation when there are no "niches" to fill?
Logged

“When Juffo-Wup is complete
when at last there is no Void, no Non
when the Creators return
then we can finally rest.”
Death 999
Global Moderator
Enlightened
*****
Offline Offline

Gender: Male
Posts: 3876


We did. You did. Yes we can. No.


View Profile
Re: Thoughts on rewriting the AI
« Reply #29 on: May 02, 2007, 01:24:53 am »

Overall strategies. If one is trying to dance at the edge of range and the other is trying to slingshot to get on the enemy's 6, crossing them would kill both. There would be certain ways of combining them to make it stronger (make them sort of sub-behaviors within a larger AI), but it wouldn't be the same old mix and mate.

This would give alternate strategies time to grow into their own before being brought back into any hegemonic structure that may emerge... that is at a local optimum.
Logged
Pages: 1 [2] 3 Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!