Trimming the Grimoire

I’ve been hard at work with the game the last few days… There are many bugs to hunt down and features to test!

Part of the fun of playing the game is the refinements you can add to make gameplay better. For example, I realized that swapping between player statistic screens was a bother, having to go back out to travel mode and press a different key. So I changed it so you can go back and forth between characters while on a stat screen by pushing left and right.

Another change was to have it so you can select a player while using services in town; previously the active character was automatically selected. I decided the whole “active character” thing is best kept in travel mode only.

I’m running close to empty in most of my modules for space; several modules I only have around 100 bytes or so of free space left. This means no major new features can be added, and it makes me nervous about any huge changes that may need to happen.

So on the topic of spells…

One thing I’ve noticed after playing the Ultima series is how under-utilized spell systems tend to be. In Ultima III the most used spell in the game was disarm traps, because it was the only way to safely open chests left by monsters. In Ultima IV many spells weren’t used because you had to mix them before you could cast them, which made improvisation in combat difficult. Ultima V had some fun-looking spells like Flame Wind which NOBODY ever used because by the end game your party was strong enough using magic axes to not need spells.

So when I wrote up my spell list a long time ago, I had a goal. I wanted a spell system that was easy and fun to use, and had spells you would WANT to cast because they were cool or useful. In particular, because it was tactical 2D combat, I had a bunch of spells that altered the terrain by creating walls of fire, barriers, and similar things.

But now that I’m actually PLAYING the game, I’m not using those spells at all. In fact, the list of spells is very long with ones I haven’t touched or needed to. So now I’m asking myself “Is this or that spell really needed?”

I originally had 72 spells in the the game. I realized that most of the spells in the first book were getting ignored because they were just pale copies of more powerful spells. I also changed a damage type in the game which meant I had a serious spell gap where the players would have no means to cause that kind of damage. As for the terrain altering ones, they are consuming a lot of memory to support and create, and passive effects like them are just not as fun as I thought.

So now I’m taking a moment to remove the code for these spells and tighten up the spell list. I now have 60 spells instead, which I think is more manageable for both the player and the designer. That also means I can free up a little space in the combat module as well.

Posted in CRPG, Design, TI-99/4a | 2 Comments

Great Balls of Fire

Another video, this time of the fireball spell. I did a video in the older game engine some years back, it was by far the most popular video I did. 🙂 It’s also the one that comes up most frequently in search engines.

One advantage of writing up an FX testing program is I can actually refine the FX a lot easier. I noticed before my fireball’s circle of sprites was moving too slowly and creating a blocky effect. By speeding it up, it actually makes a proper circle.

I’ve also noticed, with the speed of my effects, that four sprites actually looks like a LOT more on the screen, because I’m moving them fast enough to create the optical illusion of more.

And if I change colors at 1/60 of a second rate, it actually creates a pleasing weird hybrid color on the actual TI monitor! (Classic99 doesn’t do this, it in fact occasionally creates a weird optical effect that looks like two sprites of different colors slightly out of sync with each other.)

I’ve still got debugging to do though with the actual effect map of the spells; fireball worked fine but cone attacks didn’t. They are directional so they’re a little more complicated. Onwards…

Posted in CRPG, Design, TI-99/4a, Video | Leave a comment

Anchors Away

Another video, this time of the sailing in action!

The hardest part of it is plotting the ship’s course, which is stored in a transaction. This particular map is slanted which made counting the steps particularly difficult…

Ranged weapons are implemented, as are thrown weapons. The latter are certain melee weapons (like daggers) which you can throw one time per combat. Since this also disarms you and leaves you fighting with bare hands, it’s not always the best option… There are of course some weapons in game that magically return to you each round.

I’ve done a bunch of work with large monsters as well, there was a lot of complications there to sort out. I originally had special attacks enabled and I was surprised and pleased to see my dragon breathe sleep gas at the party! Unfortunately it was also accompanied with a bunch of video buffer overruns and it looks like the sleep state isn’t working quite as intended…

So next is to make sure monster ranged attacks work as intended, and get the special attacks sorted out. I also need to test every single spell in the game to make sure they all work as intended.

Posted in CRPG, Design, TI-99/4a, Video | Leave a comment

Combat 2.0

Combat in action! I still need to re-implement ranged weapons, thrown weapons, and test all spells but looking good…

 

Posted in CRPG, TI-99/4a, Video | 2 Comments

Many Thanks

A very happy Thanksgiving to everyone! I am always thankful that I have at least a few people paying attention to my project. Despite taking WAY too long on it. 🙂

I’ve been working on an FX tester recently. FX is a huge part of spellcasting in combat, and I need to be able to fine tune that code specifically in isolation so that I can make it perfect without having to hack the game.

There is a lot of aesthetics going into the design, so I need to be able to play with graphics, colors, and other factors quickly. My original “move sprite from A to B” code wasn’t quite perfect either, often over-shooting the mark. I’ve come up with a design that both allows different speeds by only opening interrupts to display sprite position changes at given intervals, and is also completely deterministic so they won’t “shoot past” their mark.

Hopefully I can get most of the engine work done and focus on content… I may have to start beta-testing with only the first 25% of the content complete.

Posted in Assembly, Coding, CRPG, Screenshots, TI-99/4a | 2 Comments

Alpha Ongoing

So I’m definitely in alpha stage with the game engine.

For those of you unfamiliar with software, alpha testing is typically testing of the project with internal testers, and using both white and blackbox testing. At the moment, the sole project employee is me, so I’m doing all of it. 🙂

In the near future, I will have a beta test with a select group of people. I haven’t decided yet on who; feel free to post on this thread if you are interested!

Bear in mind though that being in a beta test means actual testing work, not just playing the game. I would expect bug reports and lots of constant feedback. If you’d rather just wait for the official release to enjoy the game, there’s nothing wrong with that.

Today, I had the unique pleasure of fixing a bug and then seeing several features I hadn’t tested yet work perfectly!

This particular combat, I can see my multiple monster generation system worked like a charm! The rats poisoned occasionally on melee attacks, and the monster AI was fairly good too.

I still have several combat bugs to fix. The fighter, for example, should not be able to cast spells… In fact, the whole spell system has to be fully tested.

I may have to write another side-tool engine to test the FX effects as well. I noticed while debugging the trap ones that there’s a LOT of “artistic adjustment” to make them look just right, and the best place to do that is in a separate tool so I can just cycle through FX and fine-tune them.

Posted in Assembly, Coding, CRPG, Design, Screenshots, TI-99/4a | 1 Comment

Phat Lewt

Despite not having a post for awhile, I’ve been very busy on the game! I’ve been updating the progress page with various bugs and issues. There’s a LOT of code to test and fix; in particular I know the FX code has a lot of issues to deal with.

It’s early to start on it, but I already made some adjustments to game mechanics. I found my first set of encounters the monsters were just a little TOO hard to drop quickly, and they’re supposed to be a nuisance not a full on battle. Hit ratio seems fairly low too; my fighter has swung and missed three times in a row, he should be a bit better than that.

One thing I ended up adding to the game because I had a new module for combat encounter generation and resolution is a complete “you found a chest” system for post-combat. I’m still working through bugs, but you can see it in action here:

 

 

 

 

 

I designed it so if a given character is chosen to open the chest, all the others take a step away from it. (Like ANY good adventuring party does.) I need to make sure they don’t move over obstacles like trees though. 🙂

I still need to test the item distribution system as well. The game checks if the player who you try to give the item to has a full backpack or not, offers the option to trade to another player, or discard an item from your backpack to make room. Lots of logic to debug!

Posted in CRPG, Design, Screenshots, TI-99/4a | 2 Comments

Work in Progress

Quick share of some screenshots of where I’m at…

So initially I got a nice video garbage screen when going to combat. Lots of bugs with functions not returning to the caller, workspace overlaps, and video buffer overruns. After getting a lot of that sorted out, I finally have the display showing up and it reaching a point of “user input”:

The initial encounter screen. This is mostly good. There is the lack of a plural on the monster name. (Yes, it was supposed to add an ‘s’ on the end.) And the position of the units isn’t correct; my party came from the left so they should be on the left and the monsters on the right.

Hmm, it’s missing the “Your turn guy, this weapon ready” line. And the commands look a little squished. And his actual CHARACTER is gone from the map and the sprite “blink” effect looks corrupted. But at least it’s at a stage where the character can do something.

One step (and debug) at a time…

Posted in CRPG, Design, Screenshots, TI-99/4a | 2 Comments

Garbage Time

Despite the lack of posts, I have not been idle…

After a lot of testing, I’m satisfied with my battlemap generator. I’ve populated the data table with some entries that are undefined (graphics sets in later parts of the game) but all the core graphic work is done. I still have other portions of the encounter engine to test, but I can do that in live running rather than in a test program.

The next step? Running the full game and getting into a fight. Then putting a breakpoint in the debugger to try and figure out where it crashed and why. Repeat repeat repeat… 🙂

Playing World of Warcraft, while a bit of a time-consumer, is also useful for thinking about game mechanics. A bit of a side bar on that…

Since I haven’t played since the Pandaria expansion, I’m enjoying a lot of the new ideas they’ve introduced, like garrison campaigns. The stat/level squishing that occurred shortly after Pandaria and more recently before Battle for Azeroth also helped to make the game stats less crazy; before your hit points were up in the 500k range! They actually ran into integer overflow problems with raid bosses; because the base code was still using 32-bit integers and the raid bosses hit points were set high enough to exceed the max positive. I’m noticing though in Azeroth that item levels and stat bonuses are getting out of control again…

I was worried about the level scaling at first, but it works pretty well. You can now do either Northrend or the Outlands from 60-80, and Pandaria or Cataclysm areas from 80-90. I’m certain they’ll be doing something similar for Draenor and Legion soon so you can play either area from 90-110, there’s more than enough content to do it and stick to one. Funny how Draenor suffers the same issues that Burning Crusade did; it’s a bit of a “side trek” to visit and players get bored and resentful having to play through the content with their alts. Legion content is VERY desirable to play through, as it’s the only way to unlock the new races to play.

However, I do NOT like the dungeons, and I haven’t for awhile. The original classic game tried to introduce some interesting story points and offered very non-linear designs. Modern dungeons (pretty much since the first expansion) are extremely linear and dull. Contrast the original Blackrock Depths instance, with a colorful and huge dwarven city, to the dull linear design of Grim Batol and you can see the difference. My favorite thing is to out-level the dungeons so I can go in and just solo them if I need to. Otherwise, I have to just run the dungeons with a bunch of strangers using the finder who are ONLY interested in clearing it as quick as possible and getting gear.

Anyway, back to my CRPG…

I originally had my experience levels going up exponentially; I decided to relax that a bit and try and make it less step at the higher levels. Time and play-testing will also help adjust these values.

The most important often-overlooked aspect of CRPG design is pacing. You want to make sure your world is not just large but also rich in content. You want to avoid the following:

  • Having a big map that has only one town and a bunch of monsters, nothing interesting to explore in various corners
  • Your characters have the most powerful weapons in the game before the halfway mark
  • You’ve reached maximum level long before the endgame
  • Towns that are simply repeats of other towns offering basic services
  • Completing quests changes nothing other than your party; the game world seems unaffected, peasants still complain about the evil thing you defeated, etc.

I’ve no doubt that my present material for the game will go through some serious revisions as I go along. I’ve already noticed places where I’ve repeated myself a bit, and I want to make sure I make everything fresh and interesting.

Posted in CRPG, Design, Gaming, TI-99/4a | 6 Comments

Random Thoughts

And now a side-trek on random number generation…

Pseudo-random numbers have been a part of software design for awhile. It’s a field that is still very heavy in the mathematics area, because a large part of it is about trying to design an algorithm to create a random value quickly but also predictably.

However, if you started with BASIC in the old days, all that was hidden from you. You just called a RAND or RND function and got a number. The better BASIC languages offered a way to change or update the random seed, but otherwise you just used what they gave you and didn’t know what it did under the hood.

For most 99’ers, the earliest best example of an assembly random number generator came from the source code for Tombstone City, a cartridge game from Texas Instruments. The source code was provided with the Editor/Assembler package as a learning tool. (Sadly, as a teenager, I wasn’t aware of this. Studying source code may have made my early frustrations with assembly programming easier. Ah well…)

Here is the routine from it:

RANDNO LI   R4,28645
       MPY  @RAND16,R4
       AI   R5,31417
       MOV  R5,@RAND16
       RT

As you can see, not a lot to this one. Let’s say you started with a random seed of 0 and went a few cycles:

  • 0 * 28645 = 0 + 31417 = 31417
  • 31417 * 28645 = 65149 (low word) + 31417 = 31030
  • 31030 * 28645 = 55118 (low word) + 31417 = 20999
  • 20999 * 28645 = 26947 (low word) + 31417 = 58364

This is pretty much what every pseudo-random algorithm does. It generates a sequence of values using the prior value as a key to generate the new value. It also creates a predictable sequence, which can be useful in situations where you want the randomness to be more controlled. It also produces an exact sequence of 65536 different values; changing the seed value just changes where you start in the sequence.

However, it consistently produces an even/odd pattern. In some cases, this may be desirable! But for most random routines you want the even/oddness to be variant.

A simple fix, which is what I introduced and it did the trick at the time, was to throw in a bit shift of an odd value on the random seed, as follows:

RANDNO LI   R4,28645
       MPY  @RAND16,R4
       AI   R5,31417
       SRC  R5,5
       MOV  R5,@RAND16
       RT

By shifting the bits an odd number of times it broke up the even/odd cycle. It however still creates a predictable sequence since you are always shifting by a predictable amount.

So my next solution was to have the bit shift be determined by an outside factor.

The TI-99/4a has a vertical sync clock which ticks at 1/60 of a second. By using that value to determine the bit shift, I was able to have it shift to a completely different place in the sequence in an unpredictable fashion:

RANDNO LI   R4,28645
       MPY  @RAND16,R4
       AI   R5,31417
       MOV  @CLOCK,R0
       ANDI R0,>000F
       SRC  R5,0
       MOV  R5,@RAND16
       RT

@CLOCK in this instance is a word that I increment every time there is a vertical sync.

But even THIS one is not perfect… because when I tried to use it to generate random map content, which involved consecutive calls to the random function in a tight time frame when the vertical clock did not actually change, it created strange symmetric patterns every 4th or 5th iteration.

So I decided to change the routine, for the map generation at least, to a different approach:

MASK   DATA >B400
RANDNO MOV  @RAND16,R0
       SRL  R0,1
       JNC  NOCARR
       XOR  @MASK,R0
NOCARR MOV  R0,@RAND16

This rather clever routine avoids the use of multiplication (which is unavailable in many assembly languages of the era, and is cycle-costly) and uses XOR instead to invert the bits when there is no carry. This creates a predictable sequence that varies high and low.

Let’s step through it a bit, starting with 0:

  • 0 >> 1 = 0, No carry, XOR >B400 = 46080
  • 46080 >> 1 = 23040, No carry, XOR >B400 = 60928
  • 60928 >> 1 = 30464, No carry, XOR >B400 = 49920
  • 49920 >> 1 = 24960, No carry, XOR >B400 = 54656

So this one worked better, since it wasn’t relying upon the clock value. Until I reached a particular map where I was placing random tiles in a smaller area. Suddenly every single map produced the EXACT SAME pattern of tiles in an odd diagonal line. I realized then that I had to go back to the drawing board.

The solution (at present anyway) is to use a different clock. I needed one that counted faster than 1/60 of a second, and wasn’t reliant upon the vertical sync, which requires you to have interrupts enabled to update the value.

I found one in the interface chip the TMS9901, which has a 14-bit counter value you can set. It decrements it at clock-cycle speed so it’s VERY fast. It requires a bit of setup in your program to initialize with a value, but after that it’s readily accessible. After I put this in, my random values are EXTREMELY random and satisfying.

* Somewhere at program start
* Set up 9901 counter
       CLR  R12             * CRU base of the TMS9901
       SBO  0               * Enter timer mode
       LI   R1,>000F        * Set counter to 15
       INCT R12             * Address of bit 1
       LDCR R1,14           * Load value
       DECT R12
       SBZ  0               * Exit clock mode, start decrementer
* Random function
RANDNO LI   R4,23729        * Load with 15-bit value
       MPY  @RSEED,R4       * Multiply by the random seed
       AI   R5,31871        * Add a 15-bit value to the lower word
       CLR  R12             * CRU base of the TMS9901
       SBO  0               * Enter timer mode
       STCR R0,15           * Read current value (plus mode bit)
       SRL  R0,1            * Get rid of mode bit
       SBZ  0               * Exit clock mode, decrementer continues
       SRC  R5,0            * Rotate seed based on clock value
       MOV  R5,@RSEED       * Copy back to RSEED
       RT

Alternatively, if I was coding in a system that lacked such a handy counter, I would try and create some kind of clock that is incremented by other parts of my program that I could use in it’s place. The most important aspect of it is that it can’t be in the random function itself!

One other option, that occurred to me afterwards, is that I could have opened the interrupts on the TI during the random function so that the clock value would get incremented. I’m reluctant to do this, though, because in many places I’m doing more during interrupts than just a clock, and they would steal resources away from map generation.

So for now, I seem to have enough randomness to use everywhere in the CRPG. 🙂

Posted in Assembly, CRPG, Design, TI-99/4a | 5 Comments