Live data from Hacker News

Ask HN: Game devs, what is the hardest part about designing an AI for your game?

news.ycombinator.com

51–60 of 89 posts

Re: Ask HN: Game devs, what is the hardest part about designing an AI for your game?

#51
Like others have said, balancing play-ability is hard. Another problem is users may perceive the AI cheats which hurts fun.

But I'd say another hard thing is that every game needs a different approach to AI. Some need path finding, which is well documented. Others need resource balancing which is less so. The newer and rarer the game mechanic, the more novel the AI.

I would say Machine Learning is not useful except in a handful of games and if yours is not in that category, you risk spending a lot of time for little pay off. And even if in those categories, ML will be working to win not to maximize fun so they could end up being too good or to cheaty looking.

Re: Ask HN: Game devs, what is the hardest part about designing an AI for your game?

#52

Earlier quoted context omitted.

Depends on the game. The entire genre of strategy games could probably benefit from smarter AI. More so for 4X style games. Mostly, the current AIs act like players, but make terribly inefficient decisions that get 'balanced' at various difficulty levels by throwing more resources at them or other advantages. So the games vary between being absurdly easy, to being difficult simply because the AI cheats, and even then…

TA:Spring had these AIs that would exploit shit in a terribly annoying way. Like, you had ballistic projectiles that would take a while to arrive at the target, and your units would fire them. Well, the enemies had them too, except the AI would exploit its superior micro by firing off the projectiles at maximum range and maximum inbound velocity and then immediately shifting outbound. You can't move your bloody units…

Yeah, that sounds less like a 'smart' AI gone wrong and more like a typical cheating AI. In this case, instead of an actual cheat it's just able to act at superhuman speeds. Similar to the speculated issue with the Starcraft AI. Even though that one was constrained in actions per minute, it wasn't really constrained the same way a human is.

In general, the smarter you make the AI, the more you have to work to give it constraints to keep it from cheesing the player the same way players often cheese dumb AIs.

In the case of an RTS, you can force the AI to manipulate a cursor and view area the same way a human does. Only give it partial information about areas outside the current view. Put limits on cursor manipulation. Maybe add a fudge factor that makes its clicks land randomly within X distance of its target, where X is based on the average speed the cursor has moved in the last half a second. That alone would make it harder for it to give orders to a bunch of individual units fast enough to out-micro a player, and you're really just giving it constraints similar to a human operating a mouse.

Re: Ask HN: Game devs, what is the hardest part about designing an AI for your game?

#53
post #49

Earlier quoted context omitted.

TA:Spring had these AIs that would exploit shit in a terribly annoying way. Like, you had ballistic projectiles that would take a while to arrive at the target, and your units would fire them. Well, the enemies had them too, except the AI would exploit its superior micro by firing off the projectiles at maximum range and maximum inbound velocity and then immediately shifting outbound. You can't move your bloody units…

Which Spring AI was this? I don't remember any of them being any good. I made a Spring AI back in the day (it wasn't very good either).

I saw it do it with BA, but I don’t remember the name. It was many years ago. Perhaps RAI? Was that a name?

Re: Ask HN: Game devs, what is the hardest part about designing an AI for your game?

#54

Earlier quoted context omitted.

All players want to win. The level of difficulty is equal to the level of accomplishment, but games have to be made for the average rather than the exceptional, so many better than average players won't be challenged by the difficulty. Nobody is going to invest the resources into a real AI just for the hardest difficulty modes. If it cannot be used on Easy/Normal, it simply isn't happening.

> Nobody is going to invest the resources into a real AI just for the hardest difficulty modes. Which is really sad because "hard" difficulties in most games just mean that you have less health and NPCs do more damage or their "cheat factors" are turned to 11. They're still the same stupid NPCs as on "easy", but now they just headshot you behind cover and have zero recoil / perfect accuracy. It's technically difficul…

The "tank huge amounts of damage" thing has annoyed me going back to the old RPG games on NES and SNES. How do we make the game harder as the player progresses? Give enemies more HP and DMG values. Ok, how does the player combat this? Have him aquire levels/skills/equipment that increases his own DMG and survivability to restore things to the same balance they were earlier in the game. Repeat ad nauseum. Some variations restrict the player enhancements to DMG so they're forced to chip away at enemies in long dull fights. Others restrict survivability, which tends to result in shorter, more random fights, while others allow near infinite enhancement, but lock it behind boring, redundant grinding.

Re: Ask HN: Game devs, what is the hardest part about designing an AI for your game?

#55
post #35

What I understand from machine learning is that the actual learning takes a lot of compute power and learning data. So you can't have and AI that adapts during gameplay. The AI will "just know the optimal move for any given play state.

If your game doesn't give competitors perfect knowledge of the game state, it would make sense for the AI to track previous activity of its current opponent as part of the 'play state' for making decisions. For instance, if it doesn't know where the enemy is, but the enemy has attacked from this direction every time so far, it would prepare for another attack from that direction. Or if the last time the AI made a given offensive move, the player countered effectively a certain way, it may modify its next offensive to overcome that counter. The longer the game, the more it could appear to be learning to counter its opponent, even though, as you say, it's just making the optimal move given the current state of play.

Re: Ask HN: Game devs, what is the hardest part about designing an AI for your game?

#57
post #45

Earlier quoted context omitted.

Please... head over to Paradox Interactive and seek to join their team if you're bummed out to a point of thinking that. (And you're welcome to link to this comment in your application.) Their audience is basically desperate for a better AI that does better strategic and tactical thinking rather than pathfinding, weighted decision trees, and a couple of high level heuristics. Here's what I and I'd gather many others…

My understanding of the latest-gen Pdox games is that parts of the AI are shared at the level of the Clausewitz engine, and that Clausewitz in turn was developed for EU3 , but designed as an extremely general engine for 2D games, not even just GSGs. So in some ways the HOI4 AI, for instance, is using techniques that might have worked great for EU3 (and, in my experience, worked fairly well in Victoria II, if you trea…

The only Paradox game I've played is Stellaris, which has god-awful AI. Looks like it uses the Clausewitz engine, so perhaps that's the reason. But the AI empires are terrible at balancing their economies, and it doesn't take long for the player to completely outstrip them, even when giving the AIs advanced starts and bonuses. And then the military AI isn't very good, to the point that when it is outmatched by a stronger opponent, it basically sits and waits to be slaughtered.

The only remote challenge comes in the form of the endgame 'crisis' which is basically an empire that appears late in the game with huge armies and has no economy, just scripted reinforcements and possibly some scripted counters from other special AI entities. None of the regular AI empires will have advanced enough to even think about fighting it, so it mostly serves as a check to see if the player has played efficiently enough to that point to stop the threat, and marks a good point to end your game once you have.

The scripted events make for a somewhat interesting game, but if they could provide an AI that actually made the universe feel like a competition in the early and mid game, and like the other empires were a factor in the end game, it would bring the game to another whole level for me. Of course, they'd probably have to fix their general game balance as well, which an a whole other issue.

Re: Ask HN: Game devs, what is the hardest part about designing an AI for your game?

#58
post #29

Watch the talk about Civilization's AI. Seriously, game AI does not need to use advanced ML techniques, and probably shouldn't if you want players to have fun. The trick is coming up with fast algorithms, with a semblance of personality to make it interesting. Difficulty is not required for the AI to be fun in most cases.

What talk is that? Last time I tried a Civ game, I was underwhelmed. That AI just isn't fun to play against, to me. And the games run too long to play against humans in a reasonable timeframe on normal settings. I'd love to play Civ with competitive AIs.

"Playing to Lose" : https://www.youtube.com/watch?v=IJcuQQ1eWWI

Personal preferences aside, they specifically talk about how to make the game "fun". For example, they try to account for things like real-world leader's personalities. "Gandhi" shouldn't just attack his neighbors unprovoked, but maybe "Caesar" should.

And why do the AIs even bother to ally/trade/help the player at all, since the player is the only enemy that really matters anyway? Because the player is also the only person that matters in terms of having fun, and making the game too hard isn't any fun.

Re: Ask HN: Game devs, what is the hardest part about designing an AI for your game?

#59
I think any game with strategy is going to have to use reinforcement learning to have any hopes of being understood by its players. Concerns around cheesing strategies can be mitigated for real time games using constraints and cheesing in turn based strategy games is a symptom that maybe the game you're working on isn't that strategic.

Ultimately Chess, Go, Dota, Starcraft are compelling games to watch and play because the skill cap is so high. No hand coded AI for such a game could ever prepare you to enjoy playing any of those games professionally or get to a point where you can understand professional play. High level strategy in those games would never even be discovered had we not had a large population of players playing those games for long hours.

Odds are most strategy games won't be as successful as any of the above games but the newcomers could still have compelling strategic elements that gamers could explore had they been able to find other players that are slightly better than they are so they learn but at the same time aren't frustrated by too big a skill gap. A small multiplayer community is why the strategy game market is pretty bleak except for a few large players.

Reinforcement learning can provide a better experience to your players because you the game developer don't need be the world expert at the strategies of your game to create a top level AI. You just make sure the rules of the game are there and self play will take care of the rest. You can constrain the AI such that it's enjoyable by both your newest and most devoted players. You can discover OP strategies and better guide your design process. Excel is great for balancing but if you want to make a game complex enough then balancing will be a tremendous challenge without a larger team.

If you're interested in leveraging reinforcement learning for your game, I run yuri.ai which helps game developers do exactly that. So reach out to me at mark@yuri.ai if I can help!

Post reply on HN