Saturday, May 23, 2009

Things to learn from The Witcher (the huge comparison post)

Somewhere in the comments of an older post Ben asked me about the NWN2 water, and I compared it to the Witcher there, and got the idea for a comparison of the two games.
Now, I've talked a lot about The Witcher in my last year's posts, I don't really want to repeat all that, and the two games are very different approaches of a Roleplaying game where you can't just say this one is better or not.
However, the two games have something in common, and that's the Neverwinter Nights 1 roots, and it's amazing how different two games based on the same technology can turn out, and even more what CDProject Red squeezed out of the old Aurora Engine (thereby customizing it a lot) while Obsidian decided to make their own partly backward compatible Electron engine for their approach.
But let's start with what triggered this post, the water. Ben told me that water movement was something he was missing in NWN1 and asked if NWN2 had something like it. The answer, to my best knowledge, is no, only a few optical tricks can give the slight impression of a river actually flowing, but in most cases it still looks like a perfectly calm lake. You can adjust ripple and waveforms a little, but that's it. Also, the realism depends very much on the lighting, in many cases the NWN2 water, even though having steep hardware demands when every option is enabled, looks much more artificial than The Witcher's, which is technically the more outdated solution. But see the screenshots.

As you can see, the river gives quite the impression it's flowing, and when Geralt goes for a bath, the water has that slight "flow around" effect. Not the most awesome realism ever seen, but it works. Now for NWN2:

Do I have to say more? Disappointing, isn't it? Now, to be fair, there are more options for water and a few tricks to make it more realistic, but whatever you do, you won't get the movement you have in the Witcher screen 1.
By the way, see the wonderful buildings in screenshot number one? If I could build a PW with the Witcher's placeables, oooooh yes, that would be it. Oh, that reminds me, The Witcher has a toolset too, called Djinni. Have a screenshot:

If you enlarge it, you'll see that it doesn't hide it's roots - you have quite a few sections there starting with "Neverwinter..." or NWN. Sadly, there's two problems: First, you can't play The Witcher in Multiplayer, and you're usually stuck with Geralt as only character (he's not a bad one, but a world full of Geralts would be boring after a while). And, we don't have a terrain editor in Djinni. We have to stick to the prefabs that come with the game, or use a 3D Editor to make our own terrains and import them into Djinni. That just as a side info, for Middleforest I'll have to stick with NWN2, no other way.

Now for a few things I saw in the Witcher and that I'd love to see in NWN2. Some things might be possible with some effort, some things nearly impossible, but since both Squatting Monk and I talked about ambience recently, I'd like to show you a little about the ambient system in the Witcher. So let's visit a country inn:

We enter and look around. It's early in the morning, just very few guests and the Innkeeper is sweeping the floor on the right. Since thee's not much to do here in the main room, Geralt goes around the corner and starts a little fistfight....

After we broke the fat guy's nose we go back for a drink, and see what happened in the meantime: A cat walks up to the window to enjoy the sunlight and a new NPC has entered and took a seat at the table, waiting to tell Geralt a tale for a beer...

We look around and see at the table behind us a quest NPC has appeared too... the cat sits and licks it's paws...
... and the Innkeeper has positioned himself behind the bar where Vesna, the barwench, has just appeared too and prepares to serve. In a few moments, she'll walk about talking to the patrons, and in the evening we'll meet her outside on her way home, where we might have to protect her from some thugs...

Or let's head over to Abigail, the Witch. It's again early morning and she just awoke and prepares to leave her bed and make breakfast:

We're polite and don't disturb her, so she chooses to ignore us and, after some breakfast at her table, starts sweeping the floor until we finally have enough and speak to her:

So this is the daily schedules NPCs have, exactly what Squatting Monk dreams about in his recent Ambience post.
But there's more, again something SM mentioned, and that's the weather system. See what happens when the weather suddenly changes to rain:

Scripting something like this would be a pain in the rearside, but imagine this in a persistant world... one can still dream, no? Or, well... there's an idea I have to look into... mayhaps CD Project Red has done that scripting work for us already? I'd have to dig in Djinni for NWN-compatible scripts.... but before that, a few more ambient things that make the Witcher's world so alive. Like, ambient animals. These are no creatures like in NWN2. In Neverwinter Nights(1/2) everything that moves is a creature and is clickable, or highlighted. You want some rats running around? You have to place creatures there, with factions, they will be highlighted when you point your mouse on them, they are clickable, they block your path etc. etc. etc. In the Witcher, we just have ambient creatures you cannot interact with, they are for the atmosphere. And see how that looks:

We see a few goose and decide to scare them...

They are scared.

Some pidgeons on the path, what do pidgeons do? Right...

The Witcher is full of these... rats that run from you, small frogs at the lake, hens in the Inn, etc.
But now an example for another type of ambience you will find in the game quite often: Random reactions of NPCs. They react to a lot, we've already seen the weather, but another example would be they pass another NPC on the road and make a snide remark, or they see Geralt walking by and make a comment. One example I like very much are the kids you often see playing on the streets, balancing on sidewalk edges or dancing or running about. Here's a nice one:

Kid stops playing as Geralt approaches and looks stunned...

But nosy at the same time....

Other comments include "Your hair is like milk!" Or, if a girl, "I'll become a barwench when I'm grown up!".
It's also amusing to see who suddenly joins you when you decide to rest at a fire. You sit down at a lone fireplace, take a small nap, when you wake up suddenly a few people sit around you throwing around random comments of all flavours from "I need a drink" over "I hate nonhumans" to "My balls itch". The ambience in the Witcher really makes half of the game, sometimes I laughed tears about the behaviour of some NPCs I saw down the road. And I still wonder, if all that is based on the old NWN1 engine... shouldn't it be possible?

Well, so much for my huuuuuge Witcher comparison. As you can see, the game is full of ideas and I only scratched the surface yet. A lot of it's content is worth being ripped off, and if you haven't played it yet. go ahead and get it, it's even running multiple times smoother than NWN2.


Michael A. Sinclair said...

Okay, you're going to have to be my idea engine. I got a ton of things I wanna try from this post. I wonder if I can rig up a barfight system, for starters, so if you attack someone with bare fists (or an improvised weapon, maybe? there's a thought) the fight can end with KOs rather than a massacre.

The ambient animals are a nifty idea, too. While you can't do non-interactive animals in NWN, you can rig up the fleeing behaviors. I've seen that sort of thing in Memetic AI. Might have to dig into that.

Keep up the long posts, me likee. :)

Sherincall said...

One thing to keep in mind is that The Witcher is a single player game. For a SP NWN(2) module, it wouldn't be hard to add most of those things. But for multiplayer there are quite a few caveats:

1) Performance. It can be a real pain in the crapper to balance CPU cycles with those fancy things.

2) Repeating. You have to find a golden middle between making all events happen once (Because then you'd run out of events really fast) and having them happen regularly (Because then it'd kill the atmosphere rather than enhance it)

3) PCs don't have a predetermined story. In a SP game you know exactly what the PC is and can tailor the events for them. In a PW, the pc can be anything, and it'll require a lot of scripting to make it work like in single player.

However, it is doable. We'll see what SM's baby will be like, but I'm thinking it will be rather close to what we all dream of. Once I get some more free time, I'll buy The Witcher and see what they've done in there. (You can open their official module in Djinni, right?)

Casa said...

All valid points, Sherincall, however...

1.) Performance has always been one of the main points I was seeing critically. In NWN1 times there were already a few "rules for building" I successfully ignored - I usually put things in first and only disable when needed. When we look at the old Bioware ambient system with heartbeats, there used to be rule of thumbs on how much one can run at once without hurting berformance. Now I wonder, if we're basically running the same stuff from back then on 5 year newer machins, can it still be that much of an issue? I don't really plan to overdo things, but a few outstanding NPCs with a schedule would be very nice, take a barwench for example.

2. You'd really have to see how they did it in The Witcher, the NPC actions are so random (and not that outstanding or exaggerated) that "the joke is getting old". I agree one has to be very careful here, having the same NPC walking always the same round through the city can become the opposite of what was originally intended easily.

3.) Again I agree, but the ambient emotes and stuff in the Witcher are absolutely not focused on your character. They just hang around, react to each other sometimes and often simply ignore you. The kids are a fun exception, but they don't always run after you - I had to walk by a couple of times to make those screenshots for example, and the girl you see in one screenshot had absolutely no interest in Geralt at all. On another day maybe she would have.

Earlier I looked at the scripts I could find in Djinni, apparently all the legacy stuff is run as code and only their custom stuff is directly available, which basically is a huge AI system - all NWN script sources hat, on first sight, look more than familiar and almost as if they might even compile just fine in NWN... now, I'm terrible with scripting, but I sent a bunch to Michael, maybe he can find some inspiration in there.

Michael A. Sinclair said...

Damn, that's a lot of scripts. And long, too; inc_ai is nearly 6000 lines long. Still, I might be able to piece things together, though it'll will be hard without English comments. Thanks, this will be a fun project. :)

Now I gotta agree with Sherincall's comments, especially #1. Performance is really the key issue in a system like this. Yes, hardware is better nowadays, but there's engine limitations that cap how much you can really do with NWN. Most importantly, NWN doesn't take advantage of multithreading processors, one of the things that lets Oblivion get away with so much scripting (in that game, hundreds and even thousands of scripts run every second).

I'm trying to keep S&S's ambient system light, so it's flexible and can accomplish a lot but also remains a minimal strain on the server. Nevertheless, it's a lot of scripts to run. The other key, then, is minimizing server load in as many other areas as possible.

Bringing the server to life and making it seem like a real world is one of the most important points of this project to me (and I think you feel the same about Middleforest), so I'm willing to sacrifice a lot to make room for a good ambient environment and detailed building. Thankfully, Sherincall's knowledge and his work with FunkySwerve are helping me to cut some of the fat and make room for such things. I dunno what I'd do without him. :)

Michael A. Sinclair said...

Ooo... hey, I found a Polish translator to help with the comments. Check out the description of AI_GetAttitude:

Attitude of object collects (take) for object oSource oTarget. Does not have define personal attitude Jesli, this attitude become (stay) on base of owned profiles okreslone, attitude does not have profiles jesli and attitude become (stay) in other cases (accidentally) that neutral okreslone.

Okay, maybe it doesn't help that much.

Ben Harrison said...

Wow, I see what you mean about the water! I'll probably never be satisfied with the water effects in an RPG (I've been in/looked at real rivers too much for pretty reflections and movement to fool me), but I'd have expected NWN2's to be more impressive.

Animals fleeing when a PC comes within x distance would add so much to immersion. Maybe it's the fact that my other hobbies cause me to run/climb around the countryside, but a lot of devs/modders don't seem to appreciate how much a person's presence (not to mention a big, armoured person's presence!) impacts the natural environment, in subtle and unsubtle ways. And I think even the most bedroom-bound gamers notice those things subconsciously.

I'd love to see those fleeing animals in S&S, Michael.

Sherincall said...

Fleeing animals are planned to be a part of the AI I'll work on once I have some more time. (Unless SM already added them). Many more goodies from the AI, expect details in a few weeks.

Michael A. Sinclair said...

The fleeing is up to the AI system, but it's not hard. A simple OnPerception check for if what the animal is seeing is a threatening creature is about all you need.

Getting the animals back in place is different, though, and it's being handled by the ambient system. You have the animals milling about a waypoint or two, and they're called back whenever they aren't fleeing.

Put the systems together and you can get Witcher-ish functionality. Just vary how far the animals flee. Deer might run a good ways, but geese (okay, we don't have geese, so... chickens?) could move only a few meters, just enough to get out of the way.

There's other things you could do, too. Cats, for example, might follow passing PCs.

What're some other things you'd like to see animals do?