Scripts / [Unoffical] AI Thread (Heavy Scripting)

Author
Message
Corno_1
GameGuru Tool Maker
14
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 12th Sep 2015 10:59 Edited at: 12th Sep 2015 11:00


Hi,

I am a little lazy at the moment and I read a lot of threads:"Can I have AI vs AI in GG now?" The most common answer is, it is on the vote board.
So I decided to stop being lazy and make a new project. This project is a AI which fights against Ai and the player and in this thread I will show my small success on the AI road.
Of course everybody is invented to modify the script and upload it. A communtiy AI would be cool.

Attention heavy scripting and advanced math knowledge needed

So what I thought how it could work:
1) Select AI out of a List
2) Rotate to this target
3) Make him damage

There should be some more things, but they are the most important and they work, even when there is a lot of pottential to optimize it. Please do not bash me with information lecture. I have them and I hope I can implement some things

So first I create a AI_List and a target List:


and fill this in the _init function(You could read this later in the full script)
Then I search for a target:

if the player is nearer than any enemy AI, the AI chose the player as target and it works like the standart AI_soldier.lua
Ok now we have a target, then we must rotate to him:

It is very simple if you undertstand that
sinus=side_opposite_an_angle/Hypotenuse
If you calculate this you have an angle "alpha"
Why you must add 90,180 degree show this picture.(I know I can not paint very good. Forgive me)


Now we have a target.
Then we want that the AI is in attack position:


and of course he should damage the target:


Of course this are just the ground basics, but I will develope more.

Sorry for the big post

Attach files:
2 pictures
Ai script(I called it darkai_soldier according to the old FPSC Classic AI which is called Dark AI )

Have a nice day and thanks for reading

Corno_1
My dream is to develope games, which makes fun when I create it and fun when other people play it.

Attachments

Login to view attachments
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 12th Sep 2015 13:39 Edited at: 12th Sep 2015 13:47
your rotation is really long... i just use this

to rotate 1 object to another (if you know the entity of the target)
or


you would place the x and z position of the target location (so you dont need to rotate to an actual entity)

the rest looks solid, i did the same script a while back but i don't use it cos it can't check for obstacles (which is why i used a real object as a bullet but still not happy with the collision)
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11

Login to post a reply

Server time is: 2024-11-16 16:41:59
Your offset time is: 2024-11-16 16:41:59