Xiotex - Torn tendons and scripted AI

The only place you'll ever hear the truth
User avatar
Byron
level2
level2
Posts: 147
Joined: Tue May 13, 2008 3:48 pm

Xiotex - Torn tendons and scripted AI

Postby Byron » Wed Feb 04, 2009 2:31 am

I don't have a playable demo for this blog entry but I do have a fairly good excuse.

Last tuesday we had a charity Poker night at Introversion. Needless to say I didn't win and in fact the night turned out to be a bit of a downer. The Poker was great and the food the hostess provided was even better. The trip home however sucked:

As my train pulled into Clapham Junction I saw that my connecting train was already waiting at the platform so as soon as the doors opened I jumped out, ran down the stairs, through the tunnel and up the stairs onto the platform my next train was waiting on. As soon as I put my foot down onto this platform my calf muscle twisted in on itself and snapped back into place with a feeling that a consultant was later to describe as 'being shot'. I didn't fall over or anything and managed to hop onto the train just before it pulled off. I have to say the pain was intense and I worked out pretty rapidly that if I stood completely still it wouldn't hurt as much. My wife Susan met me at the station with the car to take me home. She wanted to take me to A&E (ER to those across the pond) immediately but I had an email from Microsoft I had to respond to about Darwinia+. So, I got home. Had a quick bath in the hope that the heat would help the muscle settle. Responded the email and waited for the phone call from Microsoft which came rapidly. After the call Susan finally managed to convince me via NHS Direct to go to the local A&E in Croydon. Now, up to this point I think I have just pulled a muscle.

Pretty surprisingly I get seen to pretty rapidly at A&E and you should have seen the colour drain from my face as the consultant announces that I have torn my Achilles tendon and will probably need surgery. So, I spent the next few days in hospital and narrowly avoid having surgery when they discover that the tear is not as bad as they thought and in fact I had badly torn my calf muscle - which will heal on its own. I couldn't get out of the hospital fast enough, however they insisted on me having a plaster cast on the leg which will probably be there for the next 8 weeks :(

So that's my excuse for not making a build for this blog post - been in hospital. The funniest thing was the response I got from Microsoft when they learned what had happened. I forgot to mention what had just happened to me when I was on the phone to them:

'Byron, you have some serious work focus abilities to have carried on that conversation last night without even mentioning that you were just in an accident! Rest up and our thoughts will be with you.'

I am a bit of a workaholic so thank god for iPhones so I could still do my job as producer of D+ albeit in a limited way.

While getting seriously bored and dreading the next round of hospital food I gave a lot of thought to the AI in Xiotex. I was inspired by the way a few of you modded the builds of the game I provided so I decided to completely open up the AI in the game by making it completely scripted. It's not been coded completely yet but the way it works is:

On load the game scans an AI directory for scripts. Each AI type has a single LUA script associated with it. Inside the script is various event based functions such as 'OnUpdate', 'OnInit' etc. OnInit will be called when the script is first loaded and allows the script to define the starting point of the AI unit such as it's initial state and also what mesh to use to represent it. I am also allowing the OnInit function to create the mesh shape itself. The OnUpdate function gets called whenever the AI unit needs to update itself which at the moment is every frame. This function is the brains of the AI unit. The game will provide an API that can be accessed from the script to do basic functions such as seek towards the player or launch a missile. So the only limitation for the modder is through the limitations of what the API can provide. it's looking cool so far and I hope to have a build ready to play with by the next blog post.

Having the AI scripted actually reduces the amount of work I need to do because previously I was hard coding each AI type. Now all I need to do is build a rock solid base AI type and a useful API. Having lots of AI types available to the game is useful because when the player enters each plane the procedural system picks a set of AI types that can be met on that plane. The AI can also be restricted to certain plane numbers and the current level of the player (i.e. so a level 1 player does not encounter a level 30 AI unit and immediately get tonked). One feature I am playing with at the moment is an online repository that the game can connect to to download new AI without having the player insert them manually or install them. However, there are security issues with Vista that I am not too sure about so for the time being it will be manual install but the basics are there.
User avatar
xander
level5
level5
Posts: 16869
Joined: Thu Oct 21, 2004 11:41 pm
Location: Highland, CA, USA
Contact:

Postby xander » Wed Feb 04, 2009 3:03 am

Oh, man! That sucks! Rest up, and get to feeling better.

As to work focus: a couple of years ago, I sprained my ankle pretty badly while playing kickball with a bunch of 6th grades. The sprain was bad enough that the doctor indicated that I would have been better off if I had broken my ankle. I spent almost three months in physical therapy. However, just after injuring myself, I returned to my classroom, and taught for three hours before the school day ended and I went home. Being a workaholic can suck. :(

Finally, with regards to the AI repository, it sounds like you are creating a much better version of what Spore could have been. ;)

xander
User avatar
shinygerbil
level5
level5
Posts: 4667
Joined: Wed Dec 22, 2004 10:14 pm
Location: Out, finding my own food. Also, doing the shinyBonsai Manoeuvre(tm)
Contact:

Postby shinygerbil » Wed Feb 04, 2009 3:10 am

That does suck indeed :< Take it easy and get well soon!

It seems that everyone is using Lua these days, it's definitely time I learned.

And I am also of the opinion that simple, easy-to-access online repositories (along with Lua) are The Way Forward™. :)
User avatar
cheesemoo0
level3
level3
Posts: 345
Joined: Tue Jan 03, 2006 1:19 am
Location: USA
Contact:

Postby cheesemoo0 » Wed Feb 04, 2009 4:37 am

Too bad you had such a bad accident. I hope you heal quickly. :D

I really like the AI idea. I have been tinkering with C++ for about a month now and it seems like I need to look into LUA.
The word is that it is easier anyway. Having online updates and modder friendly is certainly the way to go.

I don't think it is all that important to have a build anyway since I would rather have you spend your time working more on the program itself
than preparing the builds.

Good luck on the game and healing up!
User avatar
sfericz
level5
level5
Posts: 1336
Joined: Thu Mar 27, 2008 7:25 am
Location: USA
Contact:

Postby sfericz » Wed Feb 04, 2009 5:35 am

Byron: I hope your calf heals well. I slightly ripped my A.C.L. and never stayed off it for it to heal correctly. So now I always have problems.

Don't worry about feeding us with new builds, The first one you sent out is motivation enough to wait for a stable and enhanced version. No matter how long it takes. Just don't stop working on it please. :P


cheesemoo0: martin has turned me on to Lua, so far I can say that I am enjoying picking up and learning this language. I would suggest looking into it.
Weatherproof
level1
level1
Posts: 22
Joined: Thu Jul 17, 2008 5:18 pm

Postby Weatherproof » Wed Feb 04, 2009 7:07 am

Quoting Microsoft here:

'Byron, you have some serious work focus abilities to have carried on that conversation last night without even mentioning that you were just in an accident! Rest up and our thoughts will be with you.'

Same here.
MaW
level0
Posts: 7
Joined: Thu Oct 19, 2006 9:42 pm

Postby MaW » Wed Feb 04, 2009 8:11 am

I did something similar to my forearm - or rather, a careless person in my aikido class did it to me, although fortunately not as serious as what you've suffered. It's not fun and I'm still healing up, so take it easy.

Pluggable, moddable AI sounds like a superb idea. I'm an awful AI programmer, but as well as the talented folks who'll provide us with a nice selection, it might help some budding AI people learn how to do it. And, of course, help produce legions of coders to expand Introversion with in future years...

But how nice is it that it's feasible to write AI in Lua these days!
User avatar
Shwart!!
level5
level5
Posts: 1237
Joined: Sun Nov 12, 2006 1:36 am

Postby Shwart!! » Wed Feb 04, 2009 8:40 am

I'm sure I'm not the only one noticing a parallel between 'Soul Repository' and 'AI Repository'. Are you going to be dynamically ranking them based on their performance, too? :P
On a side note, having an early build with AI-coding capacity means there may be a large number of community-written AIs available long before completion. You may end up having to do pretty little of the actual AI coding, Byron.

At least, once such a build is released, I'm certainly going to be playing around with it.

Shwart!!
User avatar
Xocrates
level5
level5
Posts: 5262
Joined: Wed Dec 13, 2006 11:34 pm

Postby Xocrates » Wed Feb 04, 2009 11:17 am

Get well soon Byron!
RabidZombie
level5
level5
Posts: 2414
Joined: Fri Nov 18, 2005 10:09 pm

Postby RabidZombie » Wed Feb 04, 2009 7:08 pm

Sorry to hear of your accident. Stay off it to let it heal. Not working for a small amount of time is considerably less costly that having a permanently damaged leg.

As for the AI repository, sounds great. The only problem I see with it is that it could open it up to people wishing to abuse the system. Wouldn't want people uploading overpowered AI that replicates itself every frame.
User avatar
Pox
level5
level5
Posts: 1786
Joined: Sat Mar 03, 2007 11:23 am
Location: Melbourne

Postby Pox » Wed Feb 04, 2009 9:49 pm

RabidZombie wrote:The only problem I see with it is that it could open it up to people wishing to abuse the system. Wouldn't want people uploading overpowered AI that replicates itself every frame.


I don't think that would be an issue if it's done right - the AI API should provide the same functionality a human would have if controlling the same... units? Generally things like movement code, replication, etc, would be handled a layer below, so the AI and human players both have the same capabilities (other than reaction time and creativity, that is).
User avatar
Byron
level2
level2
Posts: 147
Joined: Tue May 13, 2008 3:48 pm

Postby Byron » Wed Feb 04, 2009 9:50 pm

RabidZombie wrote:
As for the AI repository, sounds great. The only problem I see with it is that it could open it up to people wishing to abuse the system. Wouldn't want people uploading overpowered AI that replicates itself every frame.


Very good point - will have to think through that issue.
martin
level5
level5
Posts: 3210
Joined: Fri Nov 19, 2004 8:37 pm

Postby martin » Wed Feb 04, 2009 10:46 pm

Pox wrote:
RabidZombie wrote:The only problem I see with it is that it could open it up to people wishing to abuse the system. Wouldn't want people uploading overpowered AI that replicates itself every frame.


I don't think that would be an issue if it's done right - the AI API should provide the same functionality a human would have if controlling the same... units? Generally things like movement code, replication, etc, would be handled a layer below, so the AI and human players both have the same capabilities (other than reaction time and creativity, that is).


That probably depends largely on the way in game AI works. what we've seen so far from xiotex is that enemy units don't move, maybe that because it's not been coded yet (I suspect so) or because AIs replicate themselves to any position in the local area, and thus "move" by spawning children where they want to move - in which case replication would have to be open to the script :P
this is just an example, I don't suppose AI in xiotex really works like that, although it would be quite interesting :wink:

EDIT:: Also, ranking the online AIs and spawning more successful ones on more difficult planes would be interesting.

And what exactly are the security issues? the AI cannot contain any malicious code, so long as your lua interpreter is secure surely?
GENERATION 22:The first time you see this, copy it into your sig on any forum and add 1 to the generation. Social experiment.
User avatar
Phelanpt
level5
level5
Posts: 1837
Joined: Thu Aug 10, 2006 4:20 am
Location: Portugal

Postby Phelanpt » Thu Feb 05, 2009 3:04 pm

Get well soon, Byron!

I love the idea for allowing external AI, but I'm not so fond of the automated repository, it would make it too easy to allow malicious code to execute.

But to spare your trouble coding AI, you could just release a version with a simple AI and API that could just run local scripts, and let people develop a few good AIs.
After being tested by the community, they could be put on the normal release.

It's not automated or fast, but it would be more secure, and save you the trouble of securing the lua interpreter.

(disclaimer: never coded in lua, so I have no idea how much trouble it would be)
User avatar
Byron
level2
level2
Posts: 147
Joined: Tue May 13, 2008 3:48 pm

Postby Byron » Thu Feb 05, 2009 3:49 pm

Phelanpt wrote:Get well soon, Byron!

I love the idea for allowing external AI, but I'm not so fond of the automated repository, it would make it too easy to allow malicious code to execute.



Don't worry - the scripts can only do anything within the sandbox confines of the game itself. All possible filesystem access or anything beyond the API of the game alone is being stripped.

Return to “Introversion Blog”

Who is online

Users browsing this forum: No registered users and 16 guests