Jump to content

Well... This Will Be Fun


Kamikaze_Badger

Recommended Posts

Well, I'm working on some AI for The Redwall Strategic Game or whatever it's called. Problem is: How in HELL do I get everything to work out right? What I want to do is set it up so it dosn't do anything unless the player comes within it's range of sight. Here's what I've got so far:

 

 

 

/*
** Current rough draft of the enemy AI. This assumes that the player has armor
** and health
** Some code (c) Sam Tootell unless otherwise noted
*/


#include <iostream>
#include <string>

// Ok, so we're going to assume that the player has 50 armor and 100 health
// later on in this source file

int nPlayerArmor;

int nPlayerHealth;

// We'll also assume that the player has a weapon that does N amount of damage
// per attack. The enemy will have 25 HP and 0 Armor later on in the 'rithm

int nEnemyArmor;

int nEnemyHealth;

// Now we'll get the amount of damage done by each weapon. We'll assume that
// it deals out 10 damage, 6/10ths of that will be absorbed by armor

int nEnemyWeaponPower = 10;

// That's it for the armor and health. Now onto perimeters
// We'll assume that the enemy has a sight of 5 whatever:

int nEnemySightPerimeterFront = 5;

int nEnemySightPerimeterLeftDiag = 3;

int nEnemySightPerimeterRightDiag = 3;

// The directional ones are for diagonal sight

// Onto hearing, we'll assume that the enemy can here twice as much as he can
// see. Walls will be only slightly more complicated. Tell me if you want them
// involved as well

int nEnemyHearPerimeterFront = 10;

int nEnemyHearPerimeterLeft = 6;

int nEnemyHearPerimeterRight = 6;

int nEnemyHearPerimeterBehind = 4;

// If you're wondering why there's only left and right and no diagonal, it's
// to simplify things a bit

// For locations:

float flEnemyLocation

float flPlayerLocation

// The . in the floats will be used to differentiate between the x and y axis.

// Now, onto the actual stuff...

int main(void)
{
    do { /* nothing */ }
    
    while ( flPlayerLocation != flEnemyLocation )
    
}

Share this post


Link to post
Share on other sites

Did you actually code that yourself or just copy it out of a book or something?

 

Because all you have so far is just declared some variables and started a do while loop. I for one have no idea what game you are talking about. Maybe help us out a little with some background info about the game or whatever it is so we might be able to try and help. But in the mean time, really you have nothing for code so will be very very difficult for us to help you out. You are asking the plain generic question. "How do I program?" Its like looking for a needle in a haystack.

Share this post


Link to post
Share on other sites

a good place to start is to incorporate movement first. If your control to break out of the loop is for the player to move into the compouters range, and neither player can move, then you will loop forever. It would be a much better idea to get some other craptions put together before you start working on the loop variables.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...