The Ur-Quan Masters Home Page Welcome, Guest. Please login or register.
Did you miss your activation email?
October 12, 2024, 05:42:26 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 6721 times)
Elvish Pillager
Enlightened
*****
Offline Offline

Posts: 625



View Profile
Thoughts on rewriting the AI
« on: February 21, 2007, 12:22:54 pm »

The AI code is an awful, awful mess. It manages to describe a decent AI, as AIs go, but with this base, it would be far less worthwhile to build on the current code than to start over completely froms scratch.

Currently, much of the code is generalized in a way that only really works for about half the ships in the game. It also only works against about half the ships in the game, as it's terrible against Orz, Chmmr, Utwig, Thraddash, Mycon, Syreen, Spathi, and Androsynth. (Yeah, there's others, but those are the ones that can mainly destroy the AI with complete impunity.)

So, where to begin? Clearly there's _some_ things that generalize across more than one ship (how to maneuver for a gravity whip, for instance) so it'd make sense to have a lot of utility functions that all the AIs draw on - but unlike the current system, to have them only for specific uses, desigining the main intelligence completely on a per-ship basis.

There are also some things that there seems to be no sane way for the AI code to find out - like the size of the ship it's flying. Maybe it'd be better to rework much of the current non-AI code before even starting to try to write an AI.

(There's also the possibility of writing a learning AI and running it for a while for each individual ship, but that approach has all its own issues...)

The more I think about it, the more I realize how huge a project this is. I did write an AI for tw-light, but that was mainly a wimpy AI to try to replace the even wimpier AI that was already in place. And IIRC, tw-light has better code than UQM anyway.

Hypothetically, who here both has programming skills and would be willing to help a new AI project if it got off the ground?
Logged

My team of four Androsynth and three Chmmr is the most unfair team ever!
My mod
Novus
Enlightened
*****
Offline Offline

Gender: Male
Posts: 1938


Fot or not?


View Profile
Re: Thoughts on rewriting the AI
« Reply #1 on: February 21, 2007, 02:28:29 pm »

Hypothetically, who here both has programming skills and would be willing to help a new AI project if it got off the ground?
I've been considering doing myself essentially what you've proposed (I think I have enough AI experience to get it done), but there's quite a lot of work there for one man. Although it's unclear where I'm supposed to get the time from, I do have an interest in participating.
Logged

RTFM = Read the fine manual.
RTTFAQ = Read the Ur-Quan Masters Technical FAQ.
Valaggar
Guest


Email
Re: Thoughts on rewriting the AI
« Reply #2 on: February 22, 2007, 09:32:05 pm »

I've got no experience in coding, but I do know that there are 25*25=625 different match-ups (A vs B and B vs A being taken into account separately) to code if you go this way. Assuming that you do one per day, you'll need two years to finish! Two per day, and still you have to work for an entire year.
I presume you want to do scripts for more than one match-up, right? For example, no matter what ship you have, you MUST avoid crashing into a Thraddash afterburner flame!
I repeat, I am not a programmer...
Logged
Death 999
Global Moderator
Enlightened
*****
Offline Offline

Gender: Male
Posts: 3874


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


View Profile
Re: Thoughts on rewriting the AI
« Reply #3 on: February 22, 2007, 10:05:08 pm »

PART I: if we were to do a learning AI.

Quote
Assuming that you do one per day, you'll need two years to finish!

We could set up a Boinc project...
Wink

More seriously, we could have it be of a form where it reports the results of battles, then makes learning decisions.

Start off with a quick seris of, say, 25 one-on-one matches for each pair, at first against the Awesome AI, then against itself. That wouldn't take too long if we let it go on turbo.

Then send out that AI to volunteers. I don't think we'd have trouble gathering those. Each plays the AI and sends in the AI reports. Those are gathered and the resulting modified AI sent out for future waves.

The problem, of course, is what sort of learning algorithm would we use? Genetic algorithms on logic flows? Neural net weighting of actions using Newton's method to maximize results?

I would favor the former, but it would probably take longer to converge. You'd need a virtual machine, and of course there's the overhead for running the genetic algorithm. But it's always fun to see two computer programs 'getting it on', as it were. Funky stuff happens.

PART II:

I get C-like languages, but my only AI experience is when I scoured the SC2 AI to root out bizarre behavior bugs that became most obvious in AI vs AI matches. Also, not too much time.
« Last Edit: April 21, 2007, 05:40:17 am by Death 999 » Logged
alexo
Zebranky food
*
Offline Offline

Posts: 6



View Profile
Re: Thoughts on rewriting the AI
« Reply #4 on: April 20, 2007, 07:08:35 am »

Hey,

For a long time now I've been working on evolving AIs for games.  I am looking for a way now to plug my stuff into UQM.
I've got the source but its a little overwhelming since I don't have much C experience, all of my stuff is in Java.  After reading a lot about JNI and NLink I'm pretty sure I know how to call C from Java and vice versa, however I can't seem to find where I'm supposed to plug it in.
Are there any central APIs for selecting the next ship, and for controlling the ship and reading the environment?
I am willing to dig into the C code to do this because watching supermelee evolution would be very interesting.


Cheers,
Alex Ostrovsky.
Logged
Slylendro
*Many bubbles*
***
Offline Offline

Gender: Male
Posts: 208



View Profile WWW
Re: Thoughts on rewriting the AI
« Reply #5 on: April 20, 2007, 10:23:43 pm »

instead of being a graphic geek, I wish I was a C++ geek ! or better yet a c++ graphic designer geek [!]
Logged

It is as though your species' brain is too small to hold a simple thought
such as, WE WILL KILL YOU FOR DISOBEYING!
This is not a complex idea.
guesst
Enlightened
*****
Offline Offline

Gender: Male
Posts: 692


Ancient Shofixti Warrior


View Profile WWW
Re: Thoughts on rewriting the AI
« Reply #6 on: April 20, 2007, 11:30:34 pm »

I know I probably should not dignify this thread with a responce, but here we go.

I recomend against this for the following reasons: (1)your initial post is asking for help, (2) the scope of the problem is too big any way you slice it, and (3) this discussion may be appropiate for TimeWarp, I don't forsee the UQM community as a whole thanking you for making the sylandro more difficult to beat.

Academicly it's an interesting discussion, you know, "what would it take to make a good AI in this game?" but practacally I think anyones time would be better served on other activities like making waffles from scratch.

Mmmmm, waffles.
Logged

A new game and it's code each week. Please visit Cymon's Games
Shiver
Guest


Email
Re: Thoughts on rewriting the AI
« Reply #7 on: April 21, 2007, 12:25:14 am »

I'm told that good AI is the hardest thing in gaming to code. That said, the best place to start would be to give the AI some sort of script that recognizes Thraddash afterburner jets as extremely dangerous.

You could apply similar logic against the Spathi, except I wouldn't want the story game Ur-Quan and Kohr-Ah to be able to mop the floor with Fwiffo. Newbies need to be able enjoy UQM too.
Logged
countchocula86
*Smell* controller
****
Offline Offline

Gender: Male
Posts: 345


Culture 20!


View Profile
Re: Thoughts on rewriting the AI
« Reply #8 on: April 21, 2007, 01:38:01 am »

I think reviewing the AI is a great idea. It doesn't have to be part of UQM, it could be its own "mod" for those that want to be able to play on their own (for example, on a laptop while taking a bus from home to university) but what a bit more of a challange.
Logged

I like to think you killed a man. It's the romantic in me.
Elvish Pillager
Enlightened
*****
Offline Offline

Posts: 625



View Profile
Re: Thoughts on rewriting the AI
« Reply #9 on: April 21, 2007, 02:27:38 am »

You could apply similar logic against the Spathi, except I wouldn't want the story game Ur-Quan and Kohr-Ah to be able to mop the floor with Fwiffo.
Good luck defeating the 4 Ur-Quan and 4 Kohr-Ah leading up to the Sa-Matra, too... Wink

(Yeah, I'd leave the "awesome" AI or whatever in the main game ^_^)
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 #10 on: April 21, 2007, 06:37:42 am »

Regarding...
I recomend against this for the following reasons: (1)your initial post is asking for help, (2) the scope of the problem is too big any way you slice it, and (3) this discussion may be appropiate for TimeWarp.

All very good points, but luckily summer is here and I have no more school, so i'll be trying some code hacking to get this working.  I'll obviously open source all my stuff, i think UQM could be the ultimate AI testbed.


@Shiver
Totally agreed, it would also be cool if it learned its own scripts to see what it comes up with.  We'll have to see this coming summer if i get this working.

@countchocula86
Yes for sure it should be an external "mod".  I was thinking maybe making it a netplay client that controlled a ship as if over TCP, this way the C code is not touched at all.


Cheers all! Thanks for the great replays,
Alex Ostrovsky.
« Last Edit: April 23, 2007, 06:42:46 pm by alexo » Logged
Elvish Pillager
Enlightened
*****
Offline Offline

Posts: 625



View Profile
Re: Thoughts on rewriting the AI
« Reply #11 on: April 21, 2007, 05:05:13 pm »

All very good points
I must have missed that post. Actually, those points are not good at all:
Quote
(1)your initial post is asking for help,
It is not.
Quote
(2) the scope of the problem is too big any way you slice it,
Improving the AI would be a daunting task, yes, but not that infeasible.
Quote
and (3) this discussion may be appropiate for TimeWarp.
...with the small problem that TimeWarp melee isn't much like that of UQM, so there's no sense comparing them.
Logged

My team of four Androsynth and three Chmmr is the most unfair team ever!
My mod
meep-eep
Forum Admin
Enlightened
*****
Offline Offline

Posts: 2847



View Profile
Re: Thoughts on rewriting the AI
« Reply #12 on: April 24, 2007, 12:51:02 am »

For a long time now I've been working on evolving AIs for games.  I am looking for a way now to plug my stuff into UQM.
I've got the source but its a little overwhelming since I don't have much C experience, all of my stuff is in Java.  After reading a lot about JNI and NLink I'm pretty sure I know how to call C from Java and vice versa, however I can't seem to find where I'm supposed to plug it in.
Are there any central APIs for selecting the next ship, and for controlling the ship and reading the environment?
I am willing to dig into the C code to do this because watching supermelee evolution would be very interesting.

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.
Logged

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

Posts: 625



View Profile
Re: Thoughts on rewriting the AI
« Reply #13 on: April 24, 2007, 01:40:24 am »

Incidentally, I rewrote a bit of the AI code the other day, and thereby made the AI quite a bit more sensible about when to shoot. Also, I was able to make the AI Utwig a _lot_ harder to fake out (and probably better at shielding, at the same time.)
Logged

My team of four Androsynth and three Chmmr is the most unfair team ever!
My mod
countchocula86
*Smell* controller
****
Offline Offline

Gender: Male
Posts: 345


Culture 20!


View Profile
Re: Thoughts on rewriting the AI
« Reply #14 on: April 24, 2007, 02:58:02 am »

Oooooh thats awesome EP!
Logged

I like to think you killed a man. It's the romantic in me.
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!