Qbasicnews.com
Writing Fightin Game aligorithms and AI - Printable Version

+- Qbasicnews.com (http://qbasicnews.com/newforum)
+-- Forum: QBasic (http://qbasicnews.com/newforum/forum-4.html)
+--- Forum: QB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-11.html)
+--- Thread: Writing Fightin Game aligorithms and AI (/thread-668.html)

Pages: 1 2


Writing Fightin Game aligorithms and AI - Kofman - 04-21-2003

As I have posted before I've began to work on a fighting game: Read more here.

Concerning fighting game aligorithms and AI. Can someone help explain to me some of the basic concepts and some of the more advanced ideas people have for a fighting game. Or how I can practice in order to perfect AI. I wont extremly hard but not impossible.

Looking for ideas, and so forth, but please include bits of code to better describe what you mean.[/url]


Writing Fightin Game aligorithms and AI - toonski84 - 04-21-2003

the only method i know there is to make attacks depending on your position, distance attacks if you're far away, melee attacks if you're within range, throws if you're right next to him, and uppercuts if you're within range coming down on a jump, which would be why some ai's are so cheap on the "hard" settings.


Writing Fightin Game aligorithms and AI - wizardlife - 04-21-2003

Making a bot for anything is difficult, but for a fighting game it's many times worse. The reason? A bot is always supposed to lose. For the game to be fun, the player has to win. But it has to be hard -- they have to EARN the win. Making a bot that always wins is easy, you just have all the combos to the best moves hardcoded and pwns every time. You need one that it is deliberately
'dumb' sometimes, but doesn't appear so.

For a simple example, in my duelling game project, when I originally wrote the code for the homing missiles, they flew exactly to where the enemy is. Now what I've done is that every single cycle when it's checking the enemies position, it adds a random value -15..15 to both the X and Y, so the position is intentionally miscalculated.

In the end, it means that not only can the missiles miss, but they swerve and wobble and look really cool. Even in a one-dimensional case like this, the deliberate 'bug' makes a better product.

If you get to making a bot, keep this in mind.


Writing Fightin Game aligorithms and AI - Kofman - 04-21-2003

oh man that's great feedback. I really appreciete all of this. Keep your experience coming :bounce: :rotfl:


Writing Fightin Game aligorithms and AI - Piptol - 04-22-2003

I made one a few years ago. So here's my advice:

1) Each move should have both a damage rating and a priority rating. So when fighters hit each other at the same time, higher priority wins (eg. dragon punch in SF would be priority 10). This allow you to have damaging moves which can be easily stopped by eg. a well timed jab

2) The computer doesn't always have to be doing something it's ok for it to stand still for a bit and respond to your moves appropriately. makes it seem a bit more 'human'..

3) I used the range-based move selection toonski mentioned, sometimes overriden with a random move (for same reason wizlife said). Make sure you have a number of options for each range (eg fireball, jump towards, walk forwards etc) to stop the cpu player getting 'cheaped'.

That's all I have for now Smile


Writing Fightin Game aligorithms and AI - wizardlife - 04-22-2003

Quote:1) Each move should have both a damage rating and a priority rating. So when fighters hit each other at the same time, higher priority wins (eg. dragon punch in SF would be priority 10). This allow you to have damaging moves which can be easily stopped by eg. a well timed jab

Priorities? Doesn't that instantly render low-priority moves as worthless?

I would do it so that in the masks for your characters performing moves, colour the fist or leg or whatever differently so that you can tell it's the attacking body part. Whenever an attacking part contacts a non-attacking part, the recipient of the blow goes into 'stun', immediately terminating whatever move they might have been in.

This way a high punch won't hit a ducking character, but that ducking character can 'interrupt' it with a low sweep kick...


Writing Fightin Game aligorithms and AI - MechCommander42002 - 04-22-2003

Sorry man i know nothing about aligorithms


Writing Fightin Game aligorithms and AI - Kofman - 04-22-2003

Quote:
Piptol Wrote:1) Each move should have both a damage rating and a priority rating. So when fighters hit each other at the same time, higher priority wins (eg. dragon punch in SF would be priority 10). This allow you to have damaging moves which can be easily stopped by eg. a well timed jab

Priorities? Doesn't that instantly render low-priority moves as worthless?

I would do it so that in the masks for your characters performing moves, colour the fist or leg or whatever differently so that you can tell it's the attacking body part. Whenever an attacking part contacts a non-attacking part, the recipient of the blow goes into 'stun', immediately terminating whatever move they might have been in.

This way a high punch won't hit a ducking character, but that ducking character can 'interrupt' it with a low sweep kick...

That's another issue. When you hit someone how do you know it a hit. How do you make sure that the the only part dealing the damage is the tip of the punch or the tip of leg or whatever part is actually supposed to make contact. And that when the openent throws an uppercut and misses. How do you make sure that you can hit him back while he's in that pose. Or the bigger question is "should you be able to"?


Writing Fightin Game aligorithms and AI - wizardlife - 04-22-2003

Quote:Sorry man i know nothing about arithlogans or whatever there called

'Algorithm' is just a really fancy word for the logic of what's going on. If a game has the same 'algorithm' as another game, that means they use the same sort of data structure, the same variable manipulations, the same sort of scripts, the same drawing order, etc...


Writing Fightin Game aligorithms and AI - wizardlife - 04-22-2003

WTF? I think these threads are all getting mixed up... Kofman, you gotta take the advice of the folks here and build a simpler game to start. Don't concern yourself with trying to code collision detection and bots until you have characters that can move around...