The Dark Unknown: Time Dilation and Spell Durations
In addition to posting the first draft of his game’s spellbook, Goldenflame Dragon posted a lengthy update to the Ultima Dragons Facebook group, to bring us all up to speed on the progress he has been making in The Dark Unknown, his Ultima-inspired, browser-based RPG:
I have a “timeline” data structure, and whenever someone takes a turn at the end of it the time of their next turn is inserted into the timeline however much later. But, the map is dual scale- outside, and town/dungeon/combat map. Now, I haven’t loaded it to check, but in Ultima V I think every step, regardless of scale, was 5 minutes of time. But if you were inside a town, monsters on the world map would never move. I considered doing it that way, where if someone’s turn came up but they weren’t on the same map as you they just sleep until their next turn. But I wasn’t satisfied with that, because it could do weird things to the turn order of monsters on the map (the rate at which you get turns is partially Dex and partially inherent bonus dependent)- not that players would be likely to notice, but I still found it inelegant. I could just do two separate “timeline” structures, but that seemed like a good way to introduce subtle bugs.
So what I wound up doing is, if you’re on one of the “zoomed in” maps, time goes 100x slower. If you take 100 steps, dudes outside will have gone once. (They won’t approach cities, to prevent cities from being surrounded while you’re inside.) This seemed like a nice way to deal with the dual-scale maps, by having basically the time scale with the map.
But now I’m adding spells with durations. And this has become hilarious. If I made poison hit you for 2 damage every “minute”, you’d die immediately if you stepped out of a dungeon while poisoned. Buff spells would either barely last at all on the surface or last nearly forever underground. OTOH, mana regeneration also scales at the same rates. So ya know what? I think I can make it work. I think I’m fine with the idea of stepping into a dungeon and deciding how much mana you want to save for attack spells and how much to buff yourself and having those buffs last the whole run. Poison is now broken out into combat poisons (which expire after they deal X damage so you don’t take infinite damage on a slower timescale) and “Disease” which is what you might get from swamps (and deals damage on the slower time scale, so is barely noticed in a dungeon).
At present, he’s attempting to decide how to handle damage being delt over a period of time. He seems to have settled on going with a solution similar to that used in Ultima 4, where damage is dealt to the player at the beginning of the player’s turn in combat, although he was (for a while at least) toying around with the possibility of having the damage itself have a turn in the combat round.
Huh. I like to see some actual dev stuff around here every now and then. You might want to take a look at the time scaling of Ultima V, as moving in the towns/etc. advanced time differently than on the overworld map. The way I see it is that if a town is 32 tiles wide but one tile wide on the overworld, in-town time should advance per action at 1/32 the overworld rate. I wouldn’t allow that ratio to affect meat and potatoes stuff like damage or spell variables however, just the time passed per action.
Think of it like this. Time advances at the same rate regardless of being in or out of town (idle). When you commit an action, the action as a whole advances time at the scale specified by being in/out of town. All the calculations performed to create the specific action are not affected by the scale and remain 1:1. So time scale shouldn’t affect any of the calculations performed for an action, only the amount of time that elapses after the action has been performed.
Hope that helps and good work on the project!