Saturday, July 4, 2009

Design: Small Details and Scripting Tales

I'm afraid I don't have any new screenshots to show off, as lately my work on the module has been polishing up some area design and doing some scripting. As a programmer, generally I don't find scripting too taxing, but I do sometimes get hit by issues that take quite a while to nut out. This week has raised two such problems.

The first issue came out as a result of me being sick of fighting a horde of orcs/bugbears/giants/generic enemy X who all come at me with exactly the same appearance and weapon. So I decided to implement a relatively simple script to give creatures a random weapon upon spawning. While the logic for doing so was relatively simple, the script didn't work, and the creatures spawned in weaponless. After a lot of testing, I eventually tracked down the problem to the fact that NPCs can't equip a weapon that isn't identified. Frequently, creatures will have an unidentified magical weapon in their weapon hand, which poses no problem. However, if the item is in their inventory, and they have to equip it, then it must be identified before the equip is attempted, otherwise the attempt will fail, just like it would for a PC.

The second issue was a result of my trying to produce some atmosphere for one of my areas. This involved spawning a creature at a random location near the a PC and then making it move. This worked fine... except for that periodically, the game would crash! Such undesirably behaviour had me stumped until I hit upon the realisation that the creature was spawning in a non-walkable area and attempting to move - causing a crash just like a player trying to move in an unbaked area. After hunting around in the toolset, I found the FindSafeLocation function to solve the problem.

The reason I spent so much time fighting these bugs is because I feel it is small aspects like this that makes games special. I want players to have a unique experience while playing this module, and it's these small things that I feel go a long way to providing atmosphere and polish, even if the majority of players don't notice it. I'm reminded of a note in the Readme for Maerduin's Harp & Chrysanthemum, begging players to read at least one item description. I appreciate that dedication, and it's wonderful to see when players enjoy those small things. Trust me, every time a player notices those little details and smiles, the designer gets a real kick out of it.

4 comments:

Lance Botelle (Bard of Althéa) said...

Hi AmstradHero,

I appreciate your sharing your problems. These are the kind of things that I keep at the back of my mind in case something similar happens to me. id weapon .. check ... safe area spawn in ... check. :)

And I know what you mean about the small things / details. I too probably spend more time than is (in all most likely) worth just to feel more comfortable about something. I did something similar fopr my villagers. I did not want to dress each one differently as a template, so I used a script to dress them. :)

Lance.

AmstradHero said...

Lance: Happy to hear that! My exact aim in making this post was to help other people so they didn't need to go through the same headaches that I did in solving these problems!

Birger said...

Man, bugs can be really bothersome sometimes! Escpecially when they keep buzzing in your ear ... ;)

I've added your blog to my blogroll so if you could do the same for me, that's be awesome!

Unfortunately I don't have any helpful tips to help you with your bugs but if wish you good luck with the bug-squashing! :)

hilda dada said...

Sounds very interesting! I will check this out! scottsdale fire systems