The Ugly Part of Refactoring

Refactoring

Today’s commit of GearHead-1 is at that ugly stage of refactoring where everything compiles but nothing works properly. The TSDL_Rect records which previously defined the positions of various bits are being replaced with DynamicRect objects that update their position based on the screen dimensions. My next step is to rearrange all of the needed zones so they end up somewhere sensible, and after that I can worry about making them pretty.

I’m thinking of adding the open source font Orbitron for titles and headers. Actually, if it reads well, it could probably also be used as the main text font. Unfortunately, playing with fonts will have to wait until the game is fully playable again.

Full Screen Map Working

GH1_FullScreenMap

Two tasks complete- the game screen is resizable, and the map display takes up the entire screen. The next big challenge is to decide how I’m going to arrange the UI components.

The Original Layout

GH1_OriginalLayout

This is what we’re starting with. Much of the screen is filled with blank space. The map takes up a little over half of the visible area. It is clearly a product of the 90s, if not earlier.

Idea #1: Ultimate Layout

GH1_UltimateDisplay

In this layout, styled after a game I may have played far too much of in my childhood, all the UI components get shoved over to the right hand side of the screen. When the mecha control menu is active it takes space from the top half of the message console. This display scales well as the screen gets bigger since the height of the message console can always be increased.

Ultimate layout with full-desktop window.

Ultimate layout with full-desktop window.

One problem is that because of the shape of the isometric tiles, horizontal screen space is more valuable than vertical screen space. At 800×600 you can see further up and down than you can left and right. Even at 1366×743, you can see one tile extra in the vertical direction than in the horizontal. Also, it may just be because I’m not used to this layout yet, but I often missed messages popping up in the console.

Idea #2: Wizard Layout

GH1_WizardInterface

In this version, also named after an RPG of yesteryear, the interface is scrunched to the bottom of the screen. The message console retains its original position, while the character info display gets cut down to just the most important info and moved to the lower left corner.The panels are transparent so they don’t block the map display.

Originally, I planned for the mecha control menu to appear to the right of the message console, but I’m not sure that’s the best place for it. Another option would be to extend the message console to the full width, and stick the mecha control menu above the PC’s head as needed, as shown below:

GH1_OverheadMenuConcept

Artist’s conception.

Is that a weird idea, or do you think it works? The control menu would probably also be semi-transparent.

Wizard layout with full screen window.

Wizard layout with full screen window.

As the window size changes, the Wizard layout UI elements remain centered at the bottom. Personally, I think this looks better than the Ultimate layout since the play area covers the entire screen. It also has the advantage that it’s basically the same interface as used in GearHead-2. One concern is that it may not be easy to read text on the semi-transparent panels. My other concern is what to do with the mecha control menu.

So, what do you think? Please vote for your favorite layout in the comments.

Scarn the Cyberdoc

GH1_Scarn

I just started a new campaign, this time with a cyberdoc/robotics expert. My plan is to concentrate on personal scale combat and eventually retrieve the Argoseyer. I can’t remember where all the bits of it are but I’m not about to let that stop me.

GH1 World Map Encounters

800px-Spaghettata

Someone recently asked me about how world map encounters work in GH1. I wrote the following explanation, which hopefully makes sense of some of the spaghetti in ADV_FederatedTerritories.txt. Read on if you dare. Continue reading

Graphic Weirdness

I’ve started work on updating GearHead’s graphics. The first step is to clean up some of the weirdness inherent in the source, which honestly is a whole lot of weirdness. Today’s big accomplishment: the game window can be resized, and the dialog console reacts to the size. It’s the only part that does react but at least that’s a start.

GH1_ResizeStart

Things Dungeon Monkey Eternal can learn from GearHead 1

DME_vs_GH1_Mk2

Continuing from yesterday’s post, there are also a lot of things that DME could take from GH1.

Goals require meaningful choices

One of the great things about GearHead is that there are a lot of paths for the player to take, each with their own risks and rewards. Many of these paths require particular skill sets; if you want to recover the Argoseyer, you had better be really good at personal scale combat. The player will make different choices depending on whether they want money, experience, reputation, gear, or to practice a particular skill. This allows long term planning and anticipation.

In Dungeon Monkey Eternal, on the other hand, every adventure is pretty much like the adventure before it. Due to random generation some might offer more experience, others more gold, but that is beyond the player’s ability to control.

Fairness is overrated

The first time Xiap walked into Snake Lake, he was attacked by an assassin that he had no chance of defeating. During the fight he ran into a mall and bought a gun. With the help of some nearby guardians, the assassin was defeated. It was awesome.

At the moment, DME scales adventures to exactly match the level of the party. This can feel uncomfortably safe.

NPCs should matter

One of the most important things the PC should do in GearHead is to make connections with NPCs. You need people to ask for rumours, people to give you missions, and lancemates to join your party. The act of making alliances with certain NPCs is likely to make enemies of other NPCs. Every NPC is potentially important.

In DME, on the other hand, most NPCs are just scenery. The few NPCs that are important are usually only important once, and once their part in the quest is over you will never need to see them again. I think adding dynamic plots and a GH style chatting system would help out here.

Another advantage that GH1 NPCs have over DME NPCs is portraits. Having a recognizable face, even if it’s a face shared by dozens of NPCs in the game world, gives the GH1 NPCs a sense of personality that the DME NPCs lack.

There will be consequences

Finally, choices in GH1 can have lasting repercussions. Fight the Bone Devil Gang for the Federation Defense Force and you’ll get trouble the next time you try to enter Kist. Steal one little antique vase and the Guardians will never let you forget about it.

Actions in DME should change things in the persistent world. Of course this would be easier if there was a real campaign world, as opposed to just a Moria-esque between-mission village. It would also be easier with dynamic plots.

GearHead-1 v1.201: The Inevitable Bugfix

GH1_Scarn_vs_Vespa

I’ve just uploaded a bugfix release of GearHead-1 to GitHub. It fixes a crash that occurs at the conclusion of the kidnapping story. You can download it from here:

https://github.com/jwvhewitt/gearhead-1/releases/tag/v1.201

This version also includes several of Michael Deutschmann’s patches and fixes some minor scripting problems.

Important note for Windows users: I’ve moved the gharena save+cfg files from the config folder to the user folder because the config folder is a PITA to get to in Windows. When upgrading to the new release you can find the old folder by doing a search for file “gharena.cfg” on C drive, then copy your save games and config file to the new gharena folder that will be created in your home folder the first time you run v1.201. Sorry for the inconvenience.

Lessons GH1 can learn from Dungeon Monkey Eternal

DME_vs_GH1

Over the past few years I haven’t been able to do much programming, but I did cobble together a new entry in the Dungeon Monkey series, Dungeon Monkey Eternal. It’s a fun tactics RPG which is played in short coffeebreaklike adventures. This was my first major project in Python, and a big motivation behind its development was to test some of the systems I plan to use in the next GearHead. Here are some of the things I’ve learned.

Know where you’re going

I dove into the development of both GearHead-1 and GearHead-2 without any clear plan. I knew that I wanted to make a mecha RPG set in a sandbox world, but I didn’t have a clear picture of what the completed state of the game would be. Instead I just kept building and building, occasionally painting myself into a corner.

With Dungeon Monkey Eternal, on the other hand, I decided what features the final game would have before I started coding. Although these plans changed several times throughout development, simply having an end state to work towards was a big help. I could anticipate the effects of things that were not finished yet. This brings me to the next point…

Finish one thing before moving on to the next

Make sure that a newly added thing works well before charging ahead and adding more stuff. A lot of GearHead’s features were added with the expectation that I’d go back and improve them later… then I never did because I kept jumping ahead to the exciting bits. It’s best to get things working well the first time. Then you can relax and forget about them, at least until conflicts with another feature start causing problems…

A little bit of beautification can go a long way

Graphics is one of those not-so-fun things I kept putting off. I kept telling myself that making GearHead look good would take too much work, or that I wasn’t very good at graphics (despite the fact that by day I’m a cartoonist; young Joe was a contradictory guy). Well, I’m happy to announce that you don’t need a million hours (or dollars) to make a game look presentable. Just a little effort can make a big difference to a game’s appearance.

Ugly memo browser from GearHead-1 and ugly console display from GearHead-2.

Ugly memo browser from GearHead-1 and ugly console display from GearHead-2.

Compare the two GearHead examples above to the Dungeon Monkey Eternal examples below.

Dungeon Monkey Eternal popup menu and text display box.

Dungeon Monkey Eternal popup menu and text display box.

It didn’t take very long to add a border and textured background to the Dungeon Monkey Eternal panels, but it looks far nicer than simply dropping a colored rectangle on the screen. The same goes for making sure that the size of the panel matches the content that will be placed in it. Next look at the use of terrain:

DMEvsGH1_terrain

There are several different versions of each ground type and the forest tile. This breaks up the shapes and stops those areas from having an obviously repeating pattern. There is a transition between the grass and the dirt, unlike the abrupt change seen in GearHead. The walls have been decorated so you can tell at a glance which building is the library and which is the armor store. None of these features are particularly hard to implement, but they make the map look much better.

Better AI beats bigger baddies

All NPCs in GearHead use the same combat AI, and consequently they are all relatively predictable. Dungeon Monkey Eternal uses several different AI types. Individually they are still rather stupid, but the presence of types means that the player has to be ready to use different tactics.

Good AI can make a monster more dangerous than simply increasing its level or abilities. An archer who attacks at range but doesn’t flee from the player characters is kind of dangerous. An archer who attempts to stay away from the party while still maintaining line of sight is more dangerous. An archer who stays away from the party, maintaining line of sight while hiding behind cover, who specifically targets the party’s mage or other vulnerable characters, is super dangerous.

Procedurally generated text is what is good in life

DMEvsGH1_OrkLanguage

Currently, the way personality traits are handled in GH1 is that for any dialogue line that should be variable, there’s a list of alternate versions corresponding to different personality traits. So for instance, the same greeting should have a default version, a shy version, a sociable version, a cheerful version, yadda yadda yadda. Writing multiple versions of every line of dialogue is extremely labor intensive, and it ignores the fact that most NPCs will have more than one personality trait.

Dungeon Monkey Eternal makes good use of procedurally generated text. Several techniques are combined: a context free grammar expander is used to expand tokens into sentences, then a phrase substitution function swaps words based on the character’s dialect. This happens for both the PCs and NPCs. Dwarves talk like dwarves, orcs talk like orcs, and fuzzies talk in LOLspeak. It works pretty well.

This technique could probably be implemented in GH1. It would require reworking much of the existing dialogue to add tokens, but even that would be less work than trying to fill out all personality trait variations in the old system.

Make the information easy to get

DMEvsGH1_CharSheet2

One of the big problems with GearHead is that a lot of information is effectively hidden from the player. More information needs to be visible, and just as importantly the ways this information can be used should be more obvious.

Current GearHead1 Goals

Mikki, Watu, and Seok-hyun from "How to be Human"

As I’ve said before, my current goal for GearHead-1 is to polish up what’s there rather than to expand the game. Here are my top priorities for things that need improvement.

  • The plots and other scripts should work consistently and without too many errors. I realize that it is probably literally impossible to eliminate all errors, but at the very least I can systematically go through the contents of the Series folder and make sure some minimal standards are met. For now: make sure the combat missions use the threat function, set memos correctly, and clean up on exit.
  • As far as I know the GH1 core story can’t reach a deadend state, but I want to run some tests to make sure.
  • The SDL version of the game should be better looking. Everything that needs graphics should have graphics- there are still a number of things which don’t have a proper sprite. The graphics should serve their intended purpose of conveying information to the player. They should look unified and attractive. I plan to use some of the lessons I’ve learned from Dungeon Monkey Eternal here. For now: draw sprites for each of the wall types, add sprites for the props and monsters that don’t currently have one.
  • The interface could use a checkup. The most commonly used interfaces- Character screen, Field HQ, Inventory, and Message browser- need to play nicely with one another. Mouse handling could be more intelligent.
  • Sexuality in GH1 is really really weird. There is no such thing as homosexuality, but being bisexual is basically a superpower. This can be improved.
  • Some of the improvements from GearHead-2 should be imported, such as the inventory/part browser info display and the personadex. At the same time, the improvements I’m making to GearHead-1 need to be ported into GH2.
  • Speaking of GH2, the SDL mode map display should take up the entire screen just like in that game. There’s no reason for over half the screen to be filled with panels that are usually not in use. Also, the SDL screen ought to be resizable, and fullscreen mode should query the video card to start in a sensible mode. Have you ever peeked inside the sdlgfx.pp unit? I obviously had no idea what I was doing. Seriously, look at GHFlip and tell me if you can figure out what I was thinking.

Note that this list leaves out various improvements and refactorings that would maybe improve the code base but have zero impact on the user experience. For instance, did you know that it’s possible to declare objects in FPC without switching to ObjPas or Delphi mode? Turning the gear records into objects would simplify the code immensely, but it would take a long time to do and it wouldn’t improve the game in any way that would be visible to players.

I think this list of goals is quite achievable. Is there anything else you think I need to do?

GearHead-1 v1.200

Seargent Huff from The Last Human AliveI’ve just uploaded a new release of GearHead-1 to Github. You can download compiled versions for Windows and Linux, as well as the source code, from here. Let me know if you have any trouble… I haven’t done this in ages and just hope I packed everything right.

Version 1.200 compiles with the latest release of Free Pascal. It now uses the FPC SDL units, so you no longer need to download JEDI SDL separately. Linux uses should have SDL 1.2, plus the associated SDL_ttf and SDL_image packages, installed. For Windows users, all the needed dlls are included in the precompiled zip.

Try it out and let me know what you think. The complete list of changes is beneath the fold. Continue reading