So for the last few days, I’ve occasionally seen a weird graphic glitch like this; a big band of white at the very bottom of the screen, drawing over world and UI and everything. It would show up infrequently. Perhaps once every hour of testing, and it would last for about three seconds, and then not be seen again for another hour or so.
Well today, I finally figured out what it is. You folks who have the benefit of seeing it as a still screenshot have a better chance of guessing; you might be able to make out the half-illegible text at the bottom. This band of white is the remnant of the message display that would appear at the bottom of the screen in MMORPG Tycoon v1.1, when a user gained a level or completed a quest. That message display was drawn using the “overlay” system that I talked about in a few ancient posts.
Suffice to say that when I modified the VectorStorm rendering engine to focus on fast rendering rather than eccentric rendering, that “overlay” system stopped working. So with the new fast-drawing graphic engine, you don’t get v1.1′s gentle blue gradient backdrop; you just get a massive solid white block.
I was finally able to track down this graphical glitch today because I’ve fixed an awful lot more bugs today which resulted in it being visible on screen a lot more often than it used to be.
Here’s a small sample:
- PCs now fight all the monsters that are attacking them, before they continue on with other activities. (Previously, they would kill one and then get bored of fighting and go do something else instead, allowing monsters to continue attacking them, undefended)
- PCs will no longer stop to rest while closing to attack a monster.
- PCs now get quest credit for monster kills even if the PC is interrupted by monsters before reaching the canonical “quest location”. (which typically is in the middle of a whole bunch of monsters; previously, monster kills didn’t count until after the PC had reached that quest location). Now, if the PC kills a monster that counts towards a kill requirement for a quest, then he is immediately given credit for reaching that “quest location”.
- PCs will now successfully return to a quest giver to pick up the later quests in a quest chain. (broke this a few days ago)
- If a PC wants to do a quest, but there are no known quests available, he’ll become annoyed and do something else instead. (previously, he would sit exactly where he was, forever, until he eventually became annoyed enough to unsubscribe)
- Fixed PCs sometimes getting double-credit for monster kills.
- Fixed PCs getting double-XP for quest completion of combat quests.
Here’s the thing. I’m now at the boring point of development; debugging AI behaviour. It means I’m spending a lot of time just watching what the AI does, watching for things it doesn’t do at all or doesn’t do correctly, and then trying to fix it. I can often be just staring at a single PC for five or ten minutes, just watching as he runs quests, waiting for him to do something wrong.
So not the most fun part of the development process. Good thing I’m not making a game that requires a lot of complicated AI or anything, eh? :)
Today I noticed just how broken the AI is in multiple-monster-versus-one-PC situation. For example…
- When several monsters are attacking a PC and kill him, the monster which scored the killing blow will immediately go back to its spawn point, while the other monsters won’t notice that the kill happened, and will chase the PC to the graveyard where he respawns. (now fixed)
- When several monsters are attacking a PC and he kills one of them, he forgets about all the other monsters, and goes about his business while they attack him. Usually this results in him quietly sitting down to try to heal himself, while the monsters pound on him. Since the healing from “resting” is so strong right now, usually a PC can survive for quite a while, even with a couple of monsters attacking him at once. (now partially fixed; PC at least still recognises that the other monsters are there. This still needs a bit more work, though, so the PC will immediately begin to attack the other monsters, once he’s finished with the first one.)
Also, I played Team Fortress 2 for the first time today. I don’t have awesome FPS skills, so I wasn’t expecting to enjoy it much.. but I found I was able to do reasonably well and help my team as an engineer, or as a medic, or even sometime as a pyro. Fun! But I don’t imagine that I’ll be spending a lot of time on it in the future. After an hour or so, FPSes always seem to make my eyes itch.
I took a break from development yesterday, but I’m back to it today.
New today:
- PCs now can see QuestGivers from only 40 meters away (TODO: consider reducing to closer to 20 meters). If a PC moves within that distance from a QuestGiver that he doesn’t already know about, he’ll stop whatever he’s doing and go to pick up a quest.
- Modified (improved?) the PC AI code, so that PCs won’t rapidly flip-flop between different activities. That is, if he decides to do a quest, he won’t change his mind and go to socialise somewhere until he has at least fought a couple of monsters. (previously, he could swap back and forth rapidly)
- Slightly improved the behaviour of monsters, when closing for combat with a player. (still needs more work; they often dance back and forth around each other. They should approach each other and then stop; it’s just being a little tricky to orchestrate that.)
- Fixed the stats display when a PC is selected, such that the meters are drawn with proper colors, instead of being drawn black-on-extremely-dark-grey.
Tasks for tomorrow are:
- Make players and monsters approach each other for combat properly.
- Modify Grind and Quest AI code to make players find a specific monster within the grinding zone to fight, and approach it directly. (Currently, both sets of AI code just make players wander around at random within the grinding zone)
So today I worked on the “getting jumped on by too many monsters” problem that I mentioned yesterday.
First thing I did was to adjust the block used to represent PCs and monsters. Those blocks were a really weird size; I’ve fixed them to be approximately the dimensions of a standing human, so it’s easier to see scale and density. Second, I made it so that monsters wouldn’t spot PCs until the PC came within 10 meters (previously, was 20 meters). Third, I made it so that monsters wouldn’t chase a PC more than 30 meters from his spawn position (previously, was 80 meters). Fourth, I adjusted the distances that players and monsters tried to stand from each other, in order to fight. (They now try to stand between 1 and 3 meters apart, was previously 10 to 30 centimeters).
Finally, I fixed a bug in the PC AI. Here’s what was happening:
- PC is noticed by a monster. PC decides to fight it, and moves toward it.
- On his way to that monster, PC is noticed by a different monster. PC decides to fight it, and moves toward this new monster.
- On his way to that new monster, PC is noticed by yet another different monster. PC decides to fight it, repeat ad infinitum.
This, as it turns out, was one of the big reasons why the PC was being jumped by five to ten monsters immediately upon entering a grinding area; each time he attracted the attention of a new monster, he’d forget the monster he was already fighting, and charge toward the new monster, and this would inevitably snowball as more and more monsters noticed his headlong charge into the grinding zone.
All fixed now, though! The PC no longer switches targets if he attracts an additional monster; he stays where he is, and avoids attracting yet more monsters. With this change, my single PC is now perfectly able to grind through the monsters in the grinding zone without being killed.
This is the story of Kerry Fox, the single player who I’m letting run around in my MMORPG Tycoon game right now, to make AI debugging simpler.
Things I’ve been doing and noticing:
- In v1.1, the “Grind out a level” AI state just made someone wander around the region at random. That worked, because in v1.1, monsters were randomly scattered throughout every map region. Now that we have explicit grinding zones in v2, I’ve modified this PC AI state to find the nearest grinding zone and wander around inside that zone, instead.
- The monsters in the grinding zones are too densely packed together. An adventurer wandering into a grinding zone right now typically gets ganged up on by between five and ten monsters all at once. The adventurer doesn’t stand a chance.
- Monsters will chase a PC much too far. Right now, they have a “chase range” of 80 meters; that is, they’ll chase a player 80 meters from their spawn location, before they stop chasing and return home. In my small starting area, this has led to some funny behaviour. For example, after killing Kerry Fox, they ran to the graveyard where she was respawning (about 70 meters away), and killed her again. She then ran to the Inn (also about 70 meters away), to try to socialise with some other players, and a few of them even chased her into the inn. In the screenshot here, you can see a monster that’s still chasing her after she’s left the inn, and is now heading back toward the grinding zone as she goes back to trying to grind out a level.
Now, you might be saying “why is she trying to just grind out a level? There’s a quest giver right there; she should just pick up a quest, rather than grinding, right?” Well, I’ve been modifying how PCs pick up quests, and right now, they can’t see new quest givers at all.
PCs now need to discover quest givers. When they’d like to do quests, they’ll automatically pick up quests from every quest giver they know about, but they won’t go to visit quest givers that they’ve never seen. If a PC wanders near a quest giver while doing other things, they should stop what they’re doing, go pick up a quest, and then go back to what they were doing before. It’s just that last bit that I haven’t finished implementing yet.
So my todo list for this stuff:
- Finish implementing “notice nearby quest givers and grab quests from them.”
- Need more space between monsters in a questing zone. Either questing zones should be bigger, or the number of monsters in each should be smaller. Or both. (In the final version, both of these things should be adjustable. But I think they’ll be pre-set in the M1 build)
- Monsters need a much smaller chase range. I’d estimate that the chase range in most MMORPGs is nearer to 30 meters (although often seems to vary, based upon whether the player has inflicted damage on the monster)
- Monsters should stop chasing a PC after killing the PC. To go and spawn camp the player is just rude.
- Monsters should never chase a PC into a building.
On the other hand, most real MMORPGs have real problems with that last point. They place combat-ready NPCs near buildings, in order to quickly defeat any monsters that should stray too close to those buildings. Maybe I should just do something like that, rather than try to increase the smarts of the monsters to get them to avoid buildings.