Advertisement

Artificial Intelligence Design

Started by March 13, 2000 09:20 PM
5 comments, last by BeamMeUp 24 years, 9 months ago
I am writing an RPG engine reminiscent of Squaresoft''s Secret of Mana. Everything''s progressing well, except for the conversion to DirectDraw and the Artificial Intelligence for my creatures. I''m thinking of assigning each creature to a team, and holding an array for inter-team relations. This way, the player''s actions on one team may affect another, such as a guard / citizen relationship in a town. However, I''ve been having trouble designing the concept of group management - perhaps with a group leader, interpolation for movement on a fine grid, and communication between group members (possibly including attack strategies). I''d like to know if anyone out there knows of a relatively simple way to structure the cooperation of members in a group. I''ve looked on Gamedev, but that stuff''s more realistic, complicated AI than I require. Thanks a lot for your help. ----------- C++ is the language of the not-so-ancients. Learn to speak it well. B e a m M e U p
-----------C++ is the language of the not-so-ancients.Learn to speak it well.BeamMeUp
What''s the number of players that are on the screen?
I have a maximum of 3 players.
I''ve thought of this solution:
The viewport is created to show the human-controlled players (the computer controlled players can go off-screen. When they do, they''ll warp themselves back to its assistant).
Each computer controlled player has an assistant which he follows (the player stops when he has is close to its assistant, with a radius of 60 pixels). The following routines can be very easy. Just if the assistants x-position is bigger than the computer controlled player go up. The same goes with the y-position.

If you insert enemies in the game, you can set the characters behaviour to: attack enemy, ignore enemy, or evade enemy.

The problem I have is that when you jump of a ledge (like zelda), and two human-controlled players are on the side of the screen, you would fall but stay on the same place. Because you can''t go out of the screen.
Should I let the player wait for the other players (can be very annoying on short jumps), or let them warp themselves to him when he reach the ground?
Advertisement
If the assistant is computer-controlled, you could make the assistant follow after its leader closely, without collision detection until the player''s landed. You could store a temporary array of your character''s previous screen coordinates that the assistant follows through, therefore mimicking your movement. Once your jump is complete, the assistant moves freely again. The only problem I can think of is if you''re hit (or your assistant is hit) during that animation period...

However, if it''s a human assistant, what I would do is have a Sonic the Hedgehog - Tails (the whatever-he-is) relationship. You nominate one player as the "important" player, and should he fall off the screen, the screen follows him to keep him inside it. If the other players are pushed off the top of the screen, so be it; they should be placed directly above the player, just out of the top of the screen. That way, as soon as the player lands, his friends fall from the sky, and land alongside him. You are writing this section from a side-on perspective, aren''t you? Because that''s what I thought you were doing...

Bosjoh: Do you have ICQ?


-----------

C++ is the language of the not-so-ancients.
Learn to speak it well.

BeamMeUp
-----------C++ is the language of the not-so-ancients.Learn to speak it well.BeamMeUp
Yes, I am using a side-on perspective but it is also a bit top-down (like zelda). So you can also jump off ledges diagonal up/down/left/right.
I will think about your solution.

And BeamMeUp: I don''t have ICQ (due to the fact that there are some very childish people who abuses that program).
I have been thinking about your solution. It works if the cliff is high (when you land, you don''t see the top anymore).
Only there is a problem with not so high ledges (for example 1 tile). When the 2 players are on the very top of the screen (these are human-controlled), and you are almost on the other edge of the screen, and jump down, the human controlled players will still go off-screen. That shouldn''t happen.
I think it would be best to temporary disable the controls of the other players when one players jumps. And let the viewport only show the jumping player. If after the jump the other players are still on-screen, nothing will happen. I think it is best to use the warp method when they are off-screen.
Yeah, it may be better to warp the players (or move them without collision detection) in that case... but do you have any idea of how to design and structure the AI so that it works together, maybe with formations? I read somewhere a suggestion about nominating a group leader, and the group taking "orders" from that creature, but then I need to make the leader''s strategy structure part of every creature''s class, which is unnecessary. Perhaps I could create separate strategy classes, and assign creatures in a group to the same strategy class. It could hold information about current paths, destinations... or maybe there''s a better way... does anyone know how to structure a simple cooperative AI?


-----------

C++ is the language of the not-so-ancients.
Learn to speak it well.

BeamMeUp
-----------C++ is the language of the not-so-ancients.Learn to speak it well.BeamMeUp
Advertisement
If I understand it right you can select players and make them move/attack etc.
It might be best to nominate the center player as a leader. A circle around it as leader assistant, maybe another circle around it as assistant of the leader assistant (etc). Each character tries to follow its assistant (if characterx is smaller than assistantx then increase x etc.) if they are outside a specific radius. When they are in it they move the same as the player who he is assisting.

Just an idea

Edited by - bosjoh on 3/16/00 12:13:48 AM

This topic is closed to new replies.

Advertisement