Archive for December, 2009

at long last, a proper enchantment system


In keeping with my efforts to take prior hacked-together, code-ugly mechanics and revamp or replace them with proper, flexible, extensible systems (such as the scroll->spell magic system transition), I took the time yesterday to replace the existing mechanics for item magical enchantments/resistances, and replace it. I also went through and did something that I’ve been wanting to do for awhile, which was to make it so items stashed in a shop are invisible to everyone except the person who stashed them.

The New Enchantment System

Previously, items were given exactly one magical enchantment (or resistance, in the case of armor). For an enchantment, the amount of enchantment damage granted by the item was fixed by the type of damage it was. Striking was 4 points of damage, Ice and Fire were 6, Lightning 8, Poison 10. Resistances were more flexible, as armor could give resistance to a particular type of magic in 10% increments. It was also implemented in a very ugly fashion behind-the-scenes, overloading item fields that were used for other things in different item types. It was horrible to work with. So, I’ve replaced it with a system whereby any item can have up to 4 enchantments, each with a different type and amount. Similarly, any item can have up to 4 resistances as well. (more…)


rebalancing and re-architecting


Not much of interest to players has transpired recently, but nonetheless I’ve been quite busy with the code. The big thing that’s happened lately is restructuring the way monster groups are handled on the back end. As I mentioned recently, there’s now an AI Director inside twilight that handles spawning pseudo-random groups of monsters in appropriate places. I said at the time that I wanted to get the conventional monster groups integrated into this framework, since it provides some pretty significant resource-savings by only having the monsters spawned when there’s actually a player nearby. Today I did this. I also integrated an Analysis module into the codebase to allow me to visually verify power curves and balancing.




Christmas-Eve and Christmas are both wonderful days, because once you’ve got all the traditions out of the way, you’re presented with an opportunity to lock yourself away and code without interruption, under the guise of playing with your new toys. Or something like that.

Anyways, between yesterday and today I sat down and rewrote much of my SSH server code. It’s now much more standards-compliant, and overall robust. I’m not sure it’s to a point where I’m ready to release it yet, but it’s getting there, so the hope is that in not-too-long I’ll be able to release a free ssh server library that roguelike devs can just plug into their roguelikes fairly easily. There are some unsettling things about this that are probably largely uninteresting, but it is worth noting that my biggest hesitation is not wanting to introduce an insecure SSH library that foolhardy devs will use for things that really do need the extra security that stronger cryptography can provide.

As an unfortunate consequence of all the mucking about I did in the code, things got munged up to a point where the OpenSSL DSA code would segfault while trying to sign the SSH packet HMACs with the existing twilight DSS signature. For whatever reason, just letting it generate a new signature resolved that. I don’t understand it, it shouldn’t happen, but I also spent hours debugging it from several angles and consistently found that it was a problem in OpenSSL that I couldn’t really control. The upshot of all this is that the signature has changed and your SSH client is going to bitch, whine, moan, and perhaps refuse to connect unless you purge the old signature out of its cache. Sorry.

Once I’ve done a few last code audits to ensure that I’m confident that libmoosshsrv is RFC-compliant, I’ll probably throw the tarball together, write up some quick documentation, and release it.

magic gets the treatment


So between yesterday and today I found/made the time to go in and hammer most of the utility spells that wizards and necromancers have into the new “skill” system. This means that no longer do wizards have to farm up healing/ice scrolls, and necromancers don’t have to get their fire/lightning scrolls. Instead, they buy these spells from the Priest of Caladan and the Tutor of Aether in the first town, near the Master Swordsman where warriors buy their skills. This is very beneficial from the perspective of giving quick access to spells, and also provides me with a way to get rid of the nasty scroll-gathering process. I took some liberties transitioning the magics from scrolls into spells, so there might be some balance changes, but I think I’ll get all that sorted out in time.

Thoughts for the Future

Next on the agenda will be making prestige-class skills be a bonus skill on top of your normal skills. I also need to expand the spell selection a little bit. Right now there isn’t any spell representative of Striking anymore. This should be a really positive move for magic though, and I’m glad I finally made the time to do it.

All this being said, I’ve had a nasty hunch all throughout the process of hammering magic into the skill system that I was forgetting some little caveat, so don’t be surprised if things are a little buggy for awhile.

when I get bored things happen


I got really really bored yesterday and today, so I finally sat down and figured out how I wanted to incorporate more interactivity into warrior combat. And after I did that, I coded it all up. So now you can talk to a Master Swordsman in the very first town you spawn in, and if you hand him enough money he’ll teach you various skills that you can use in combat. You use skills in a way that’s sort of similar to World of Warcraft. You’ve got 4 skill slots that you can fill with skills, and then you select your active skill with a hotkey. The next time you attack, that skill gets triggered and has its effect, then it has a “recharge” span of time. While it’s recharging you can hit one of your other skill hotkeys to change your active skill.

Right now there aren’t all that many skills (9 different skills with 5 tiers of each), but I want to get a basis for how valuable/powerful skills should be before I get all crazy-creative. They do make combat more interesting, for sure, and it gives you a couple of different ways to play the game. If you’re really hardcore then you manage your movement, and your active skills. This takes a lot of concentration and precision, so it’s kinda tough to do. If you’re not that hardcore you can just turn auto-attack on and only manage your skills. I anticipate that this is how most people will play the game, and it’s a lot more approachable. I suppose you could also just set your active skill before battle and then only control your movement, but that doesn’t seem either as fun or as effective as either of the other two approaches.

One really important thing that I want to stress is that for awhile now, you’ve had the ability to edit and change your keybinds. I don’t think this is advertised well enough in-game, but it’s really helpful to be able to put your hotkeys where you like them, especially for skills. I really hate where the scroll hotkeys are, since so many terminal emulators don’t handle the F-keys very well. Unfortunately it’s hard to come up with a dozen sensible hotkeys elsewhere on the keyboard. Perhaps a 3 key system (prev, next, activate) would work, but I’m not sure.

On the note of stuff in the game that isn’t advertised, I’m really feeling like I need to put everything I know about the game down in some sort of comprehensive wiki, cuz I feel a lot like many of the features in the game aren’t easily-accessible. For example, the PvE, PvP, and “campaign” dungeons probably don’t get much traffic, just because people don’t stumble across them enough.

In addition to the skill stuff, I noticed that some class/prestigeclass combinations didn’t make sense, such as a warrior who’s a firemage. That’s just silly. So I went back and restricted certain prestigeclasses to certain base classes. Right now the only prestige class that everyone can be is Summoner.

it’s up now


So, as promised, I’ve sorted out the bugs in the new code, and have committed it to the public server. I’m not sure it’s quite dynamic enough yet, I may need to up the number of roving bands of nomads and the races that can be nomadic and that stuff. The static groups that stay where they’re spawned are pretty cool though, even if not always placed the best. One of the really neat things about this new feature, from the code side, is that I went through the trouble it took to get the groups to be dynamically managed. That means, when no player is within reasonable distance of them, all the monsters belonging to them get slain, and then they get spawned in when players get close. So I can have pretty much as many groups as I want, and they aren’t a resource drain, cuz they only exist when they’re actually doing interesting stuff. It’s tempting to try re-structuring the old-style (hand-created) monster groups into being dynamically managed too, but I don’t think it’s important enough to devote the time to right now.

As a small bonus on top of this, I also added a little feature by adding the concept of racial foes to the race definitions. It doesn’t really change much in the game, but if AIs see each other and are “foe” races (an angel and a demon, for instance), they will fight each other, even though they’re both “monsters.” ¬†About the only time you’ll ever see this is if a couple migrating groups of monsters that are foes happen to cross paths, but if a player happens to see it, they should appreciate it I think.


improved dynamics


It should surprise no-one that I’ve been extremely busy with work and school lately, but nevertheless, I have not forgotten about Twilight. I was daydreaming at work during a slow day, and for some reason Left 4 Dead and Twilight crossed my mind at about the same time. I’ve never played L4D, but I’ve heard/read something to the effect that the designers wanted the game to function as a sort of director, in an action movie, where the players are the stars, or some such. Once that occurred to me, some old comments that some #rgrd-ian had made bubbled back into my memory. That particular individual was waxing eloquent about wanting full dynamic ecosystems in their roguelike, or something like that.

To my mind, that’s just silly. Go play DF. However, it did occur to me that I could have an AI analyze the game world, pick out particularly suitable locations for inhabitations of particular race types (based on what sort of terrain those races like), and automagically spawn a group of monsters there. It could even have these groups of monsters migrate from one suitable location to another. So I wrote an AI that does exactly that. It’s not quite as polished and fancy as I originally envisioned, but it certainly adds to the randomness of encounters with monsters (in race, level, and location). As an outgrowth of this, I don’t have to spend all my time adding meaningless monster groups to the map. I can just make the map, add the meaningful (for story purposes or atmosphere or whatever) monster groups, and let the AI worry about the rest.

I haven’t updated the public TwilightMMORL server yet, both because I’m having some issues with my host, and also because I’m not 100% convinced the code is stable yet. However, at some point in the not-very-distant future, it will be updated, and I think things will become a lot more dynamic and interesting all around.