Slants and Wraps

It was a frustrating weekend filled with regressions and complex problems to solve…

The travel module is by far the oldest code in the game. Iterations of it go back all the way to 2005. As a result, some things that DID work long ago weren’t working now.

Boats, for example, were completely broken. At some point I completely removed my original code, so I had to re-write it from scratch.

A big part of that was that I decided not to have your boat “carried” by moving water. The main issue is that it breaks the turn-based nature of the rest of the game, and it also requires checking for moving water tiles on an interrupt.

Light was another broken part, I found every single cave I went into was fully lit. I investigated and discovered I had never re-integrated light properly after changing the LOS algorithm. This lead to a two-day maddening exercise where a few simple code changes BROKE the LOS algorithm and I had to chase down why.

But the worst thing this weekend was slants and wraps.

I designed the map engine to allow me to project maps not only in squares or rectangles, but also as rhomboids, a slanted rectangle. This means making sure that when both you and mobs move, they move with correction to the X axis in relation to the Y to account for the slant. It also affects placement of mobs in the map window. The short explanation here is, you NEED yourย  Y differential because you need to calculate what actual window thresholds are per line. It took a lot of experimentation and code cycling to get this right.

The other thing maps can do is wrap. Normal map mode just extends the last character on the edges to infinity; stepping off the map forces a reload to a new map. Wrapped mode means it projects to the other edge, and creates a closed loop. Projecting the map isn’t too bad, but mob placement once again gets complex; you have to account for the fact that a mob and you could be at opposite ends and thus extremely close, not far away.

On the plus side, transactions are working well. I got the gambling module working great, and buying and selling works too.

Next on the list, I have to fix up some other services (healing, identifying) and make sure the new inventory system (removing and using equipment and items) works as intended.

Posted in Blog, Coding, CRPG, Design, Screenshots, TI-99/4a | 3 Comments

A Quick Word

My work at converting the dialogue system to sectors instead of records is complete! Now all incidental text for a given set of mobs is stored with the mobs themselves, and transaction text is with the transaction codes.

Effectively, you only need three pieces of data and a sizable buffer space to do variable-length records in a sector system: The base sector to start in, an offset value in that first sector to start your data at, and a number of sectors to read. In my case, my VDP file buffer has a maximum size of 4K, which is 16 sectors. More than adequate for my needs, it fits neatly in a single page of AMS memory, and I can bit-pack the sector count as a nybble (4-bits) and use a single word to store both a base sector and sector count.

I tested it on the hardware tonight and it was VERY fast… loading a map or transaction takes a few seconds, but after that it doesn’t have to refer to the disk at all and pretty much generates the text instantly.

Onward with the bug fixing… At this point, I don’t think I’ll have combat ready in time for Fest West. But I think I can get most of travel and management done. We’ll see…

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

Do-Over Dialogue

So… I need to re-engineer my file system for dialogue.

I hadn’t loaded the current game executable on my actual TI in awhile, so I decided to try, mainly to make sure I hadn’t introduced any problems. Initially I had to fix my file creation tools to make sure sectors were padded out properly; TI99Dir wasn’t happy with incomplete sectors when copying to disk images.

After that, the game ran well… until I reached my first bit of dialogue. Quick pause as it accesses the disk, and a single message pops up. Okay, not too bad. Go to my first complex conversation… and it’s literally taking 2-4 seconds to load EACH LINE OF TEXT. Including your dialogue options, which pop in like snails one after the other.

It’s my own fault, because I forgot a critical fact. Limit your single file accesses as much as possible. The overhead of opening, reading, and closing a file is not too bad if you do it once, but if you’ve designed a system that requires constant access to different files, you got a problem.

My first thought was, why not pre-fetch all dialogue for transactions? Well, no, that won’t work. It would STILL have to access each individual record, which means you’d offload the sluggishness to the beginning.

The answer is simpler than that… don’t store dialogue in separate files. Store it WITH the pertinent data you’re loading. Then you only do an open/read/close operation once. As long as you have the buffer space for it, you can read in all the data at once. CPU memory is NO concern with the AMS, I can earmark pages to store data.

This means abandoning the record file system and using direct sector access as well. So I’ll need to re-write my content tools to generate tight and compacted sectors of data with offset values and delimiters. It will be a LOT of work to re-write but the end result should be a much better experience on the actual hardware.

It also makes me realize my original non-AMS design, which relied heavily on off-loading data to disk, even things like item names, would have ran like a snail in Doc Martens on the actual hardware. I’d have been so disappointed and frustrated if I’d continued down that path!

Some disadvantages is I lose the ability to avoid duplicate text. Your common dialogue options, for example, will either have to be replicated in every data block, or I will need to consider a “common/custom” system so it can read options from memory for common ones (Buy, Sell, Leave, etc.) and from the data block for custom ones.

The other problem is waste space has the potential to be worse; I may end up with a lot of unused bytes in a given sector because I simply don’t have anything to fit in there. I think I already had a lot of waste though in the current file system, so it may not be too bad. I won’t know until I assemble a new model and see how the numbers look.

Finally, one particular data set (mobs) will require me to save the data BACK to disk. That means preserving the original sector data for saving. Mostly house cleaning concerns, although if my mob files get larger due to storing text data, it may push them beyond the game disk’s size. I may have to abandon the idea of making the game work with 180K DSSD disks and go right to 360K required.

Best roll up the sleeves and get to it then…

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

Conversation Starters

After a lot of back and forth, I finally got transactions working… Well, mostly. I’m debugging new issues all the time. ๐Ÿ™‚ But here’s a short video of one in progress:

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

Quick Update

Gotten quite a bit of ground covered since my last post… All the bugs I first encountered are fixed, but there’s plenty more to deal with. ๐Ÿ™‚

I took a brief side-trek to write myself some console applications in C# to help with my work. My original method of compiling the game was as follows:

  1. Build each module source using A99, creating an object file
  2. Using Classic99, load the object file into memory, then dump the memory into a binary file
  3. Copy the memory sections with program data into my program file where they are loaded from

Not TOO bad, but I was quickly running into annoying problems, like anytime I changed code significantly in the root module, I had to also build the start module or things stopped working there. (Because addresses were offset from expected values.) And the fact I had to navigate with the mouse to do loading and debugging in Classic99 slowed me down quite a bit too.

Fortunately, Mike Brent helped out by sending me a simple object to binary program he’d thrown together. I was able to adapt it into a new binary for my purposes that translated the object file into a straight binary file, removing the need for Classic99 in the process entirely.

Then I wrote another console app that did binary copying from one file to another, only requiring you to supply base addresses in both files and a length. That lets me copy the resultant binaries into my program file directly. So now I can compile, build and create the program file all by clicking a single button!

Right now I’m debugging the statistic screens. I discovered that I hadn’t populated real values for item data at all, so that was my first fix. Besides that, mob movement seems weird; my monsters aren’t chasing me and they’re moving across water and other “inaccessible” tiles.

All you can do is just deal with each problem one at a time. Sooner or later you WILL fix them all.

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

Stop and Go

Debugging in assembly language is rather like being a plumber…

You have this pipe, and it’s full of gunk, debris, hair, and other bits of nastiness. It also has various redirects, T sections, valves, andย  a bunch of other things. All you want is to run the water into it and have it come out into a bucket at the end. But EVERY time you do, the water gets blocked and stopped somewhere, and you spend minutes finding the blockage and correcting it. Then you get a few inches further, then bam, another block. Find, fix, and again… And again… AND AGAIN…

So I’ve been trying to get the game to launch again with a newly created character. After much sweat and toil I FINALLY got this:

Not quite right… Better than crashing

Let’s see, where to start…

  • Your character is supposed to be on an elevated cliff, so he should be able to see over the mountains
  • The water pattern is wrong, animation must be messing up
  • Two status effects are indicated active which shouldn’t be active at all
  • Why is the stamina bar down from full a bit?
  • Two of the options are displaying as characters instead of text
  • You can’t move or do anything
  • And finally, the sound is going berserk upon launch, when it should be silent

Time to cinch up the overalls and grab the wrench…

Posted in Coding, CRPG, Screenshots, TI-99/4a | Leave a comment

Demo Anxiety

Back from Con, it was a blast! Meeting David Tennant and Billie Piper was especially cool. ๐Ÿ˜€

Back on the game, I decided to step back from combat engine work for a bit and get the rest of the game functioning. At the moment it doesn’t even come up to a playable state, and I’ll want that for the convention next month. I spent a few hours dealing with various errors caused by some refactoring I did (the debugging tool in Classic99 is PRICELESS in this regard) and got the character creation and introduction fully functional again.

And it went total black screen when it tried to launch the game… it turns out none of my map data was in place. ๐Ÿ™‚ So I’m working on getting that all populated.

I’m also re-working my elevation system. I had intended to store the data uncompressed but I realized I could actually compress it VERY easily and store it in a much more efficient way in sectors with offsets. Since there are only 4 elevation levels, I can store them using RLE with a single byte indicating up to 64 characters for a given elevation.

The big issue there is writing a tool that will let me define elevation for the various maps without losing my mind… I originally was going to incorporate it into my map/light editor but it’s complex enough that breaking it out into it’s own tool is the best idea.

One nice accomplishment was finishing my transaction and mob tools so now ALL text in the game is embedded with the transaction scripting and mob definitions. Now I can add and remove text easily and just rebuild the entire thing in seconds. That’s going to be very useful for content creation and fixes down the road.

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

Con Bound

A quick update…

I’m going to be at Emerald City Comic Con for the next four days, enjoying myself! Always a nice way to recharge the batteries.

My revisions for levels/experience and bit-delimited text are largely done. I then decided to make some tools updates. Combat work is proceeding slowly because I need to make sure I have sufficient graphics space for all the map types I want to make… I have to take into account content that is not actually completed yet.

Originally I had text encoding separate from mob and transaction encoding, which meant I had to hand-update everything if a change was made. I realized that this was unsustainable, so instead I modified my script encoding to allow me to insert text directly into the scripting code:

 

 

 

 

 

 

 

 

 

 

Mobs are the same, as some are merely single-line text providers. The biggest issue was I had to change my common delimiter from commas (which text can have) to pipes (which I don’t use.)

I also intend to give “names” to transaction blocks so that I can reference them in my mob file by name. That way if a given transaction increases or decreases size, the reference remains the same.

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

Revisioning and Ranting

Work continues, but I had to take a step back and revise code…

I’m revising all my code to use bit-delimited text as much as possible. I was able to use a lot less data tables for constructing interface screens, which reclaimed some memory and is, honestly, much more elegant.

I also made a major change to the game structure, adding in levels and experience. My main decision there was I wanted to provide some way for players to feel like combat is worth going through. Attaining a new level will increase health and stamina and give you a skill point, which can be used to raise any skill you can find a trainer for. Level requirements are, like Ultima IV-VI, exponential. So the maximum level you can have is level 10, which would take awhile to reach. Completing side quests and main quests will also give you both experience and skill points, so it’s not the sole method of advancement.

I think I’m still on track for a playable demo by Fest-West ’18, fingers crossed! One thing I am very glad about is that I have never asked for donations or money for this work, nor have I ever considered using crowd-sourcing. Case in point…

I am going full disclosure here. I’ve seen plenty of times on the Internet where people talk about drama and problems but then don’t disclose any details or say “Oh everyone knows about it” or “Read the forums/comments if you want the story”. I feel differently. Someone screws me and I’m going to tell you EXACTLY who it is so you don’t give them money.

I am one of the top tier investors on the Judge’s Guild “City State of the Invincible Overlord” reprint Kickstarter. The project was slated to be completed in December of 2014. It is four years past the original date. The project updates are just full of excuses as to why they haven’t finished it. (Moving, new job, sick family, etc.). They also mentioned they are trying to offload the project to an external company or group to complete.

I’m honestly really angry about this. This is the 3rd Kickstarter project that has failed to deliver anything that I’ve invested in. I’m seriously contemplating never using Kickstarter again. Talk to me AFTER you’ve delivered your product and are selling it retail, thank you.

The first Kickstarter that let me down was a massive dungeon module/setting by James Maliszewski of Grognardia. At some point in development his father passed away. He shut everyone out and refused to hand the project over to someone else for over a year. When he finally did, the new group immediately offered refunds to anyone who wanted them, which I took.

The second was the Knights of the Dinner Table Live Action series. It was produced by the infamous Ken Whitman, who afterwards I researched and discovered has been cheating gamers since the 80’s. I’m honestly more angry at Jolly Blackburn for NOT disclosing his history than at Mr. Whitman himself. Ken delivered three videos, one of which has awful audio problems, and then disappeared. I’ll never get my $50 back on that one.

Anyway, back to my own work… I’d like to do up game boxes and feelies and whatnot for it, but in the event they cost more than I can put out on personal funding, I may consider using a buy-in or crowd-source to do it. But I’m going to make sure the game is done first AND that I can meet the deadline I set. I won’t be one of those guys. You get very few chances to retain trust in business endeavors.

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

Bits and Battlemaps

Continuing my work on the combat module, and finishing up the start module! Some updates…

While studying a hex dump of Castle of Tharrogad for the Color Computer 3, I noticed an interesting data pattern… All the text strings had a curious high-value ASCII character at the end instead of the expected letter. I realized that they were using the topmost bit as an end-of-line indicator.

Most “strings” in assembly either use a length value (A byte typically, which means your string can be a maximum of 255 characters) or a null terminator at the end of the string. (typically a 0-byte) In the case of both methods, every string takes up it’s characters in memory + 1. But with a bit-delimited method, it takes up exactly it’s size!

Now you may ask, quite fairly, what does one byte per string matter? Even on a vintage system it’s not THAT much. But in practice, I found I was wasting a lot of instructions to populate the necessary registers to write text to screen. Plus, using the standard multiple byte write routine, you would have to push the length byte into a register then shift it to make it a word value, resulting in burning six bytes of instruction space for EVERY text string.

I wrote a specific text-to-video routine which looks for that bit, and only stops writing when it encounters it. It also can move through entire blocks of sequential text, so that I can only set two values (screen address and text address) at the start, and just change the screen pointer for the rest! The result is my interfaces can be built much more efficiently in memory without a great deal of trade off in performance.

I also made some adjustments so that I could start using compressed text in memory for the Start module. This became necessary as raw uncompressed text pushed the module size to close to the limit. I reclaimed over 2K in space by using compression and the natural text block writing system the game natively uses.

For the battlemap work, after writing out various designs and trying different edge cases, I think I finally hit upon a workable method. Here’s how it will work…

A few years back, I wrote a TI-BASIC game called Aperture, a simple version of Portal. (Which you can find on the TI Game Shelf.) It features 16 different levels with a wide variety of features. How did I do it? I used a procedural generation process, storing different drawing operations such as horizontal line, vertical line, box, and so forth, as well as placement of special objects. Each level took up a couple hundred bytes of dataspace on average; the more complex the level design the more it took.

I realized that this kind of system would work for battlemaps too. When you want to draw features in a two-dimensional format, you’ll find most linear compression methods are very binary; either they are fantastically good or extremely inefficient. This defeats that making the complexity of the screen the only limitation.

The design is as follows:

  • Each tile has a “code” indicating it’s general type such as grass, hills, forest, and so forth
  • Up to 16 character patterns are loaded from memory for the battlemap, some are indicated as “open” spaces and others as “blocked”
  • The various patterns (relatively stored as 0-15) are drawn and plotted. Some methods will scatter patterns at random
  • If you have blocking tiles surrounding the player, these tiles are used to draw “walls” for dungeon and building corridors
  • For each map, a common “wall” and “floor” are stored in the map array data in the event that it can’t determine an exact type

My rough calculations right now show that I should be able to store all the battlemap generation data in around 1 kilobyte. That should be workable!

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