View Full Version : AI(artificial intelligence)
e-monster
December 31st, 2007, 06:55 AM
hi, I'm making a super smash bros game and need help with artificial intelligence and i can make a character move and attack but the only problems i need is the enemy. i want to know how to make him move, attack, jump and get hurt, mainly like on this games enemy's: http://www.newgrounds.com/portal/view/333995 and i also want to know how to make my character jump if you could teach me or tell me how that would be great
slayerX2
December 31st, 2007, 06:03 PM
instead of just asking for some code, maybe people might help more if you've shown some attempt i mean that's how i learnt, I looked for tutorials read them and instead of copy and paste, i wrote the whole code out and read properly on how it all works, and if it were a good tutorial it would explain every little detail properly, so try to make some attempt, read some tutorials, and really grasp what there saying and play around with the code until you fully understand what it means :)
e-monster
December 31st, 2007, 08:20 PM
i did atempt it and i am asking if someone could help me not give me the action script, plus i figured out the jumping exept i cant make it so that when he jumps he does an action of jumping could some one help me on that.
four4swords
December 31st, 2007, 10:35 PM
can't you just have a "gotoAndPlay/Stop()" bit of code somewhere to make the character run the jump animation?
Mr beef
January 1st, 2008, 02:31 AM
Or do what I do. If I dont know It I start another part which I know I can do and I know I want. Seeming as Im making a Athalina-like game there is plently I can do. I started with making a circle move around, hitTesting small tester maps. Then I started with enemies. I had to go back to previous projects and check what I had done to see if I still knew what I was doing. Some problems came, so I left some notes on the problem and what I was doing for when I went back to it. I began on playing with music and different things I would need, like buying, equiping, dropping weapons. Then when I had finished all I could and had checked all I could and still had no answer I would come here.
To be honest the answers they gave me didnt directly help me, but it made me see new ideas to solve the problem. It also taught me new ways to do things. Now my game is working exactly how I want it to, with items enemies different maps, shops and more. But about 95% of that was my own work.
Asking for "help" for enemy AI would mean alot of time teaching it to you personaly or spending alot of time creating the very large code without having a clue what you game needed.
Sorry for the long post but the overall message is move onto things you can do, even if simple. Of course if its a mess around game then dont even try such complex AI. My char and enemies were just little blue and red dots chasing each other around.
e-monster
January 1st, 2008, 07:50 AM
i tryed a few goto and stop things and played around with it a bit but it still wouldnt work
hatu
January 1st, 2008, 11:50 AM
AI is very complicated. You can't just throw a magical actionscript piece at your game to make your enemies intelligent.
Here are some good articles to learn about the ideas behind game AI
http://www.gamedev.net/reference/list.asp?categoryid=18
You should start by reading this first. Especially the Overview of AI
http://www.gamedev.net/reference/articles/article200.asp#sec2
ArmoredSandwich
January 2nd, 2008, 10:06 AM
hmm what i do is make the enemies exactly the same as you. The object that you control has methods to move in directions, jump, fire etc.. The enemy would have the same methods. The methods of your object are being called when ur pressing a key and the objects of the enemies are being called when a statement is true or false...
but im no pro at ai just yet :S :P
gl hf
hatu
January 2nd, 2008, 10:41 AM
Here's one pretty basic (and bad) example of some kind of AI with flash from a few years ago
You can move the target which is the player in this case with your mouse.
The enemy will move towards you until he's at the right spot and punch you, then try to avoid you for 5 seconds and then start looking for you again to punch you etc.
edit: one more note. the think variable doesnt do anything at the moment but you could change it to make him kick or whatever, that's why it gets a random number between 1-10 every time
exodus ze great
January 2nd, 2008, 04:01 PM
hatu did u use flash cs3 for the AI because when i open it, it says unexpected file format, im using flash 8
hatu
January 5th, 2008, 11:58 AM
Seems like I did. Here's 8
rahul_7star
January 5th, 2008, 01:03 PM
can't you just have a "gotoAndPlay/Stop()" bit of code somewhere to make the character run the jump animation?
hey dude he is asking 4 codes so tell him d code of jump ok
if u fail , i will send u how to jump a player by codes ok
fw2803
January 7th, 2008, 06:58 AM
Never think of complicated AI unless you're really skilful... Flash would not be able to work out complicated ones. On the other hand, simple AI such as Distance AI, Random AI etc. can already make enemies very difficult to beat.
For example, a platform game. Enemies can be put at some vantage points so the player cannot hit it easily. Then with only simple distance AI, you can have the player killed.
aiMarz
January 13th, 2008, 01:19 AM
AI... I wonder what that is.
Look, like some people stated above, it's a lot easier to do A.I. after you realize what Artificial Intelligence really is. Albeit, there are a lot of misconstrued ideas of what Artificial Intelligence is. In a simple Smash Bros' Game you can use multiple different algorithms like stated by fw2803.
He is correct about using Distance A.I. and Random A.I. as possibilities but I would also use a little bit of Pathfinding A.I. as well. Because if you get far enough away you also want them to use the advantage of laying out paths on the field to maybe get the upper edge over your character.
Again though, if you don't know the basics on A.I. just yet, I would suggest doing a little bit of reading and then post back when you have a couple of ideas on what you might think the next step is.
samedi
January 27th, 2008, 03:05 PM
hi
maybe you could define the crossroads and turns as objects with an array inside each object that describes which other object can be reached from there with a straight line. like hypertext or something... a simple turn would have 2 "links"
and if the car is farer than a certain distance the cop doesn't try to follow him, it tries to get to the closest road object instead...
for a really stupid cop it would be enough to "record" the order of the road objects the player walks trough...
samedi
January 27th, 2008, 03:06 PM
it went in a totally wrong window.... sorry for that
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.