Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

XP's limits?(AI script)

Im thinking in create a very complex and huge IA script. But im wondering if it will be too much for RGSS. I have heard a lot of times that IA is one of the hardest things and also specially cpu-intensive.

These is a quick map of what im doing. I have designed it, coded something and have the algorithm in work...

The idea is to give some human habilities to the monster, like knowing to attack opponents with low hp or learn about elemental weakness.

There exist 12 IA levels. Each adds some extra inteligence to it. IA 12 is a very advanced one that might play like some humans.

There is a list of the things what im pretending the IA to do:

-Dont attack opponents with bad status that disappear with that monster action(skill,atac)

-Dont attack opponents with raised defenses to something(status,rows,defense...)

-Attack oponents with lowered defenses to something.

-Attack opponets with 20% or less of life.

-Evaluates effectivity phsyic attack vs magic.

-Lear about elemental resistances.

-Supposes enemy total hp.

-Can think in the combat future, saving PH and trying to do defensive things first.

-Knows to evaluate a scan on opponent.

-Help his allies.

Also i was thinking in that beyond some IA level the monster will use the other monsters learned information, and in the mx it can use also the actors one.

It also work with actions ratings and add a random component. It uses actions lists with a rating value thats settlefd with a lot of checkings everytime...

What im thinking is.... ¿this will be possible? Too bad if i design all the algorithm just for seing that the rgss cant take it in a reasonable time. Maybe someone can estimate if im overrating AI or not.

Im also wondering if im using the best algorithm. Now i create a action list array with all posible actions, evaluating all the valid enemy actions and valid targets.
Action list uses: action_type, target, scope, skill/item_id, and rating. I use this information because i was thinking thats better to use some more memory here that having to recheck or find other values.
Then i check for every of that conditions, adding some value to the rating if its true.
For last, i find the max and erase the other ones. The last selection is random.
 
wtf are you always writing IA? Oo

What kind of battle system do you use?
A turn based front-view system has way less problems with performance in comparison with e.g. an ABS.

I think none of your points should be a problem, perhaps except for "Can think in the combat future, saving PH and trying to do defensive things first.".
If you haven't done it yet, you should first start thinking about the AI before you start coding. That's one kind of program, which easily gets unclear if you start directly without making any thoughts.

About the way you do it, I guess I'd make it the same way.
 
ive been working on the same thing for about a week :/ it seems like you are always working on the same script as me lol. to add my two bits, i already wrote the AI for a healer that acts like the player(pain in the ass to kill lol) idk if you want my opinion, but what has been working for me is A) remove the gay ass rating system xp uses. b) switch over to state setup(im currently using: strong, ok, weak. and it has been working wonders)

edit: oh ya you wanted limits, dont worry, ive written tons of ai code in the past its where ive spent most my time in programming, and so far i havent been able to cause any issues with my ai and the battle system(default and Tekaniaki(or what ever) tried)
 
I think someone figured out in the past that you can execute 10000 frames a second in XP's RGSS Player. That's lots of room for your AI, while it does need some smart programming to not overload the system unnecessarily.

As for your way to do it, while it's not bad, I'd like to suggest an alternative: Keep up somewhat of the simply-random selection (because yeah, a bit of irrational or subconcious choice is natural for humans as well) by randomly choosing the action type, such as attack, defend, skill, item, whatnot, unless there's a real emergency to heal or whatever. Then go from there: For example, if you rolled a skill use, run your AI algorythm to decide which skill to use. Again, take a little bit of randomness in here (maybe about 25%), so your battles become at no point predictable.
If you really wanna go fancy with it, you could create a system that makes it less likely to act specifically in the beginning, however the longer the battle lasts, the more dedicated your enemies will get, and therefore use more on-the-point attacks.

On a side note, what's really a cool feature is elemental recognization: If your characters are weak or strong against certain elements, your enemies will realize that over time and use skills and weapons accordingly.

Just ideas though...
 
I think someone figured out in the past that you can execute 10000 frames a second in XP's RGSS Player.
You mean "frame" like in "frames per second"? Oo
That wouldn't have anything to do with the AI and stuff :?:

(im currently using: strong, ok, weak. and it has been working wonders)
I wouldn't suggest states like that.
That may work, if your AI isn't too complex, but when you want to implement all the features on gerrtunk's list, you are better with the good old "if $game_party.actors[0].hp < 100" in my opinion :)
 
Blue":3ccx7jj4 said:
As for your way to do it, while it's not bad, I'd like to suggest an alternative: Keep up somewhat of the simply-random selection (because yeah, a bit of irrational or subconcious choice is natural for humans as well) by randomly choosing the action type, such as attack, defend, skill, item, whatnot, unless there's a real emergency to heal or whatever.

i do still use random stuff sa long as none of the emergency situations come up, like the user needs to heal or the enemys need to heal. i like to call that method "last_resort" lol

[rgss] 
def last_resort
    # please note this method is not done
    if AI::Healer[@enemy_id] == true
      #might use random target not sure yet
      self.current_action.decide_best_target_for_enemy
      self.current_action.choose_attack
    end  
end
[/rgss]

Neo-Bahamut":3ccx7jj4 said:
Plague180":3ccx7jj4 said:
(im currently using: strong, ok, weak. and it has been working wonders)
I wouldn't suggest states like that.
That may work, if your AI isn't too complex, but when you want to implement all the features on gerrtunk's list, you are better with the good old "if $game_party.actors[0].hp < 100" in my opinion :)

i am using that, just slightly more complex
[rgss] 
def state_changes
  @current_percent = (100 * $game_troop.enemies[self.index].hp / $game_troop.enemies[self.index].maxhp)
   if @current_percent > 90
     @state = "strong"
   end  
   if @current_percent <= 90 && @current_percent >= 40
     @state = "ok"
   end
   if @current_percent < 40
     @state = "weak"
  end
end
[/rgss]
AI is allways complex, i own about 20 books on the subject and i dont think a single one is simple lol
 
Plague180":1yp1mfck said:
ive been working on the same thing for about a week :/ it seems like you are always working on the same script as me lol. to add my two bits, i already wrote the AI for a healer that acts like the player(pain in the ass to kill lol) idk if you want my opinion, but what has been working for me is A) remove the gay ass rating system xp uses. b) switch over to state setup(im currently using: strong, ok, weak. and it has been working wonders)

edit: oh ya you wanted limits, dont worry, ive written tons of ai code in the past its where ive spent most my time in programming, and so far i havent been able to cause any issues with my ai and the battle system(default and Tekaniaki(or what ever) tried)

I know know, im evil. :devil: . I enjoyed a lot making your crappy autosave script useless and now i will do the same...

xDDDDD. Anyway this AI script and the improved save were started like 2 years ago... but i didnt take it seriolusly until now.

I also want to use this script as special learning purpose because its a system that works 99% out of the default scripts(it only gives the context). So, i have to do all the work.

Im going to design and think, plan... very well the algorithm and all before starting. Thats a think that its hard to do when editing scripts, i only planned 100% one object for a matrix tactics system.

Also this my first AI thing before my failure in a pygame game long ago...

Thanks for all your responses, i willl study what im going to do with it.

pd: IA is Intelgencia Artificial, im spanish.
 
gerrtunk":26gptd6q said:
I know know, im evil. :devil: . I enjoyed a lot making your crappy autosave script useless and now i will do the same...
lol!!!!! no one is using either of our scripts :P and i dont really care when you released your it gave me a reason to start working on other things i wanted :) im more then willing to help you along the way :) since we are doing the same thing diffrent ways we both could learn alot :) then again though, i code way diffrent then you so idk :P lol let me know id love to talk about AI More.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top