Posted on 01/23/2015 - 16:41
Looks like yesterday's font success may have just been a plateau. When testing non-latin characters today, I ran into several issues.
As a first test, I decided to use cyrillic to see if I could change in-game text to show non-latin content. I packaged a cyrillic font, changed some source code, and fired things up. And only the commas came through.
Thinking that maybe this was due to hard-coded text not being UTF-8 compliant, I decided to try placing the cyrillic text in the neogame.xml. However, even that didn't work.
At this stage, I started to doubt whether the font I was using was actually a cyrillic font. Maybe I just grabbed a decorative Latin font that looked cyrillic? Two fonts later (including the MS standard "Calibri"), I was pretty sure that wasn't the case.
Digging deeper, I decided to check the character codes that the game was displaying. Did the character codes match the Unicode specification for cyrillic characters? In short, yes. Those looked okay.
Finally, it occurred to me that maybe the ttf->swf app I was using wasn't packaging all of the glyphs in the font. Maybe it was only packaging the latin chars? Judging by the file sizes before and after, that seems likely.
So my next step was to download the hxswfml project source to see if I could figure it out. I've checked out the source via SVN to my local machine, and started digging around. There are probably over a hundred folders here, though, so progress is slow. That, and it appears it was written in Haxe 2.0, and the current Haxe 3.0 has some specification changes (such as switch statement pattern matching). Fortunately, that was a quick code edit to fix.
And that's where I am now. I'm ready to compile a debug version of the converter app, and maybe I can step through the code to figure out where it decides which glyphs to copy. More on that next week.
And speaking of next week, I'll be out of the office on Monday. My wife's birthday is that day, so I'm hanging out with her. I should be back on Tuesday, though. And hopefully with some more news on the convention booth!
Have a good weekend, all!
Posted on 01/22/2015 - 17:20
I think I've got a workable solution for fonts!
Please be real please be real please be real...
What you're looking at above is the title screen of NEO Scavenger using a font that is loaded from the game's data folders when launched. This font is not installed on my machine, nor was it created using Flash CS4. Rather, the font was converted to swf format via a free online, open-source tool.
What this means is that I think I can make the game support user-specified fonts, and that the user doesn't need to purchase Flash Professional ($$$) to convert the fonts to the right format. Or in other words, use whatever fonts you like, including other languages!
Now, before we get too carried away, I still need to run some tests. I need to verify that there's a way for the user to specify font name, size, etc. in some config file that the game can read. And I also need to look into the font conversion tool a bit more to see what my options are for using it. (E.g. can I host a copy of it on my site? Should I just link to it?)
However, this is big news for modders who have been asking about extended character sets. Tomorrow, I'll see if it works with non-English fonts, such as Cyrillic, Chinese, etc.
Man, this was a last-minute surprise, and pretty much what I was hoping for. It just took several days of plumbing the depths of the internet to find some comment at the bottom of an archived forum from 2011. You know, a regular day in the life of a Flash programmer :)
Have a good night, all!
Posted on 01/21/2015 - 17:47
Today took a turn for the boring early on, but later suddenly diverted into scary-yet-exciting territory.
First, the boring. I had a lovely chat with KPMG Canada this morning, wherein we discussed US and Canadian tax law, GST registration, tax treaties, and the maelstrom of forms one must navigate. That's right, it's getting to be tax time, and this year, I want someone at my back that can help.
Last year was a bit of a last-minute scramble after I personally finished Canadian taxes, and then folded under the pressure of figuring out US tax law as a Canadian business resident with US citizenship. I finally went with a professional tax preparer for the US portion, but I felt somewhat left out in the cold after working with them. They did the job, but it was hard getting them to respond to questions.
This year, I'm hoping to get an early start. And with Steam Early Access having a pretty big impact on sales, I want to make sure a pro looks things over. KPMG comes pretty highly recommended when it comes to cross-border taxes.
So this morning was tax discussion and accounting review as I gathered materials to get a quote on their fees. Fun times!
However, just as I was finishing that, an interesting turn of events happened. Namely, it appears I may be visiting a certain conference this year, with a whole booth to myself. (What's the emoticon for scared-yet-excited?)
I was sort of unprepared for that. I figured I might have a really tiny presence at the conference, but it turns out I may need to figure out how to fill a 10x10 space with NEO Scavenger decor. Plus, I need to figure out what I'm willing to budget for the event. It's going to cost much more than I originally planned, but maybe there's a way to make it worth the expense.
I'm thinking it may be possible to create a real spectacle of the booth space by decorating it like a post-apocalyptic campsite, jury-rigged out of old trash, tarps, sticks, and fake trees/plants. Like, "welcome to my noise-trap-bedecked slice of forest, complete with trash can fire, grocery cart, sleeping bag, and makeshift shelter."
The decoration part should actually be a lot of fun, and thanks to NEO Scavenger's trash-friendly setting, pretty cheap, too. However, how will I integrate a PC playing station or two into the area? Should I have a table? Chairs? What about signage? Should I have a backdrop behind the fake trees? Lights? A stand with a canvas screen-printed with the company or game logo? And should there be giveaways? Cards? Pins? Game keys?
Not to mention, how am I going to transport all of this gear to and from the con, and what will I do with it all when done?
Lots of questions. Lots of dollars. Lots of stress.
But hopefully, also lots of awesome :)
Posted on 01/20/2015 - 17:40
I actually diverted from font research today after stumbling across a pretty major bug. One player on the Steam forums noticed that their buttons stopped working, and they had a save game that seemed to reproduce the issue on my machine. Yay!
However, I later discovered that the issue might've been due to me loading an old neogame.xml that was lacking some data. Still, the save game helped me pinpoint some weak areas in the code that break when certain data values are corrupted.
First of all, the save game seemed to have some items with NaN durability, and this was causing issues when the AI tried to compare item values during looting. The value comparison was always "true" when AI checked, meaning the AI would get confused and infinitely switch between looting the same two objects. This caused an infinite loop in the game, resulting in the game locking out the player and ending turns over and over until the player died.
To fix this, I added some code to validate the item durability and to reset it to 1.0 if it becomes NaN. It's impossible to know if the NaN was getting close to 0.0 or was closer to 1.0 before it broke, but at least 1.0 is a safe fallback number. It just means items with broken data last longer than they should. This also fixes the AI confusion infinite loop.
Tracing the problem backwards to the source, it looks like the game also managed to screw up the date info. The previous turn was set to NaN hours ago, which means everything in the game that degrades had a durability of NaN because it had been degrading for NaN turns. (See how NaN spreads like wildfire?)
To avoid this issue, I added a fallback value to the game's date info, too. As above, this default value may screw up some finer timing issues in the game, but at least it saves things from a complete crash. (And in practice, this NaN date was the result of missing data in the old neogame.xml file, so it shouldn't happen unless someone accidentally deletes it or modifies it in neogame.xml incorrectly.)
Weather had a similar issue, as that was also something I migrated to the neogame.xml file recently. So I fixed that in a similar way.
Finally, after fixing all of the above, I noticed a huge performance issue that appears if the game thinks a large number of hours has passed since the last turn. (Which was the case in the save game I was testing after I reset the "last turn" date to the beginning of a new game.)
Basically, whenever the player sees a new hex, the game checks to see how many hours have passed since the last visit. And for each of those hours, it checks to see if the hourly scavenge sites have appeared. Normally, this is only a handful of hours per hex, for 5-15 hexes, so most people don't notice it.
However, in the bugged save game, the last turn was a ridiculous number of hours ago. This meant that the game checked for scavenge sites a ridiculous number of times for each revealed hex while the save game was loading, and there was a huge pause with a black screen while it did. I thought the game crashed when it happened, as I'm sure a player would, too.
So I've adjusted this code to check for cases where more than 10 hours have passed, and if this is the case, it will act like the hex had never been visited before. I'll need to playtest this a bit to see if it feels right.
A bit of a detour from my font plans, but I think this was some necessary bulletproofing for the game. This may also help with some of the hard-to-track bugs people report. The ones that happen randomly after long play sessions, which may be the result of NaN-like data creeping in.
That's all for now. Have a good night, all!
Posted on 01/19/2015 - 17:44
Hope everyone had a good weekend! I actually fired up Skyrim again for the first time in a while. I'm not sure what made me think of it, but I had a hankering to explore a fantasy world, and I never really got far with my mage character. I managed to have some fun gaining magic powers and following mage quests before I hit a rut.
Back at work, I discovered had a lot of catching up to do on PR. Quite a few messages came in on Friday evening and over the weekend, including an interview request, and there were also several reviews posted. Some highlights include:
- FraggedNation Developer Interview - I chat with Daley of FraggedNation about NEO Scavenger and it's development.
- RetrospectiveGamin's NEO Scavenger Review - One of the more concise and authoritative reviews I've seen.
- NEO Scavenger: A Terrible Good Game - He hates it, but he loves it. I loved the (semi-NSFW) tone of the piece.
- Indie Megacast Ep. 64: NEO Scavenger - Chris, Patrick, and Rob ruminate about their experiences in NEO Scavenger.
That last one was harsh, but fair. User-experience is definitely a weak suit for NEO Scavenger, and it shows in this podcast. And while it was hard to listen to their frustrations, it was also very useful for me to learn where I failed to communicate to the player. I get the sense that at least some of them really want to like the game, but the game's UI and lack of communication work against it.
Ultimately, however, this is good info. I think if I can improve the interface in future games, I might reach a new group of fans who are deflecting off of the current UI.
I probably still have a bit more PR to do tomorrow. It's been a few days since I've checked tech support forums. But once I do that, I hope to be back into the dev environment and coding!
Have a good night, all!
Posted on 01/16/2015 - 17:37
So the fonts situation has stalled somewhat.
As mentioned yesterday, I made some early progress loading fonts embedded in external swf files and using those to alter NEO Scavenger's UI. The drawback, however, was that most people won't have the tools necessary to create swf files for their fonts. The only way that verifiably works so far is using Flash CS4 (or any Flash CS edition) to export a font installed on the user's machine. And this software is pricey.
While discussing that, however, it occurred to me that I could also try to just load fonts that were already installed on the user's machine. So I set about rewriting the font-loading code to simply load a text file that defines which fonts to use for which UI stuff. I got that to load, and started testing, and...
...no dice. The text file loaded, the settings were updated in NEO Scavenger, but when it came time to render text, I just got blank space. Some more testing, including hard-coding the fonts to use known system fonts such as "Verdana" and "Garamond," also failed. Out of desperation, I tried asking Flash to tell me which fonts were installed, (i.e. Font.enumerateFonts(true)), and oddly, it spat out a litany of fonts. Including the ones I was trying.
Digging further, I noticed I could query each listed font for "hasGlyphs," which basically checks if that font could be rendered with the supplied example text. Asking it to try "Hello World" on all of the fonts, only three came back positive. And they were the embedded pixel fonts that I added to NEO Scavenger.
The weird thing is that some websites seem to be able to do it, such as this one:
Though one notable difference is that this site doesn't have its own embedded fonts. Further research suggests that this may be a...wait for it...limitation of Flash. Namely, Flash can either render embedded fonts (a.k.a. "CFF") or system (a.k.a. "device") fonts, but not both. I'm not sure if that's true, or if this can be switched on-the-fly, but that was the gist of what I read on Adobe's site.
There may be more things I can try. Perhaps I can try not embedding the pixel fonts at all, and loading them dynamically when the game starts, to see if that allows me to use system fonts. Alternatively, maybe I need to go back to looking for easy ways to convert TTF files to SWF so modders can actually use this feature. Or, maybe I need to drop moddable fonts altogether.
I think it's worth at least one more day of research, however. So that'll be Monday.
Hope everyone has a good weekend!
Posted on 01/15/2015 - 17:44
There are a few other modding enhancements I wanted to try and fit into the next update, so I decided to tackle one of the harder ones today: fonts.
A lot of folks have asked for the ability to change the font. Often, this is so they can begin doing translations of the game into their native language. And in other cases, it's for aesthetic or legibility reasons.
In theory, Flash allows us to use fonts in 3 ways:
- Use a font installed on the user's machine.
- Use a font embedded in the Flash app.
- Load a font from an external swf file.
NEO Scavenger currently uses option #2, which uses my custom pixel fonts for the various screen sizes. These fonts are embedded in the app when I compile it. Unfortunately, my font only has the Latin ASCII characters, so accented, Cyrillic, and other non-English glyphs are not possible. And since it's a compile-time embed, end-users cannot change it.
As my first test, I decided to see if I could make #3 work. I generated an swf with a random TTF font inside it, and added some code to load it and use it on the title screen. The good news? It worked!
Now here's the bad news: I generated the font swf using Flash CS4. CS4 is Adobe's professional Flash editing software, is pretty pricey, and I can't see the average modder wanting to drop a few hundred bucks just to convert TTF files to SWF.
There are some font-to-swf converters out there, but I have yet to find one that works. The online one I tried failed to produce anything, and the SWFTools app I downloaded seems to have generated an older SWF format that NEO Scavenger cannot read. (I.e. an AVM1Movie instead of the AVM2Movie format that AS3 requires.) It's possible that there's another converter out there that works, but I have yet to find it.
FlashDevelop may be able to generate an SWF from a TTF. I was poking through some features, and it seems like it could work. And what's more, FlashDevelop is free, and open source. So I'd feel comfortable recommending it to modders. (It's what I use to code, after all!) However, it's far from trivial to use. One would have to install it and the requisite libraries, and have some familiarity with IDEs to get it to work. Not ideal for casual modders.
As I typed this news, it also occurred to me that I kind of ignored option #1. Normally, that option is a non-starter because you can never tell which fonts a user has on their machine. However, if the modder provided the font, it could be installed on the user's machine, and the game would be able to load it (I think). In this case, the modder just needs to edit a text file to tell the game which fonts to use, and provide the text file and font to the end-user (or the URL to the font, if they want to avoid copyright/licensing issues).
It still may be possible, so I'm going to keep looking into it. Here's hoping I can figure something out!
Posted on 01/14/2015 - 17:45
Hey folks! As many of you likely saw, the site underwent some updates today. I had to update the content management system and some of its modules, so the site had to go offline for maintenance just after lunch. Fortunately, the process only lasted a few minutes, and seems to have gone smoothly.
Back on the game, I started looking into some more modding enhancements. One of the first things tackled was the aforementioned PassTime method. I fixed this to update not only the player's items and conditions, but the game world date, weather, visibility, and items in all hexes. Now, PassTime should feel more like time actually passed, with the exception of creatures roaming/aging (which would cause complications if they interrupted a player during an encounter).
In addition to the above, I also moved some more game data into the GameVars table in the xml. Previously, these were all hard-coded, and modders couldn't change them. But now, anyone willing to tinker in the xml can change the following:
- fCloudChanceJan - % chance of clouds in January
- fCloudChanceJuly - % chance of clouds in July
- fCloudChanceVar - % these numbers can fluctuate from year-to-year (e.g. 30 would mean 15% in either direction)
- fPrecipChanceJan - % chance of precipitation in January
- fPrecipChanceJuly - % chance of precip. in July
- fPrecipChanceVar - % these numbers can fluctuate (again, 30 would mean 15% up or down)
- nStartDateDay - The day of the month at which the game starts. (1-31)
- nStartDateHour - The hour at which the game starts. (0-23)
- nStartDateMonth - The month at which the game starts. (1-12)
- nStartDateYear - The year at which the game starts. (YYYY format)
- nStartHexX - The x coordinate of the starting hex (column number, from 0)
- nStartHexY - The y coordinate of the starting hex (row number)
- nTempJanHigh - Average high temp in January (degrees F).
- nTempJanLow - Average low temp in January (degrees F).
- nTempJanVar - Amount these averages can vary (degrees F). E.g. 30 would mean +/15 degrees
- nTempJulyHigh - Average high temp in January (degrees F).
- nTempJulyLow - Average low temp in January (degrees F).
- nTempJulyVar - Amount these averages can vary (degrees F). E.g. 30 would mean +/15 degrees
With these variables exposed, players should be able to alter the starting hex, starting date/time, and climate for the game. Combined with the existing abilities to change the map data and hex art, this should open up quite a few possibilities for new settings.
For reference, this is the sort of stuff I was referring to when I mentioned improving modding after launch. So if there's more stuff like this that you want access to in the game, let me know! I'll do my best to expose what data I can so modders can continue to kick butt :)
Have a good night, all!
Posted on 01/13/2015 - 17:26
I fixed a few more things today, both mod and vanilla-game stuff. One of the bigger fixes was the mod-merging issue mentioned yesterday.
After almost another hour of tracing code, it turns out that there was one small change I could make to ensure mods used the correct URL at the correct time, enabling mods to override other mods. The issue was in the image loading code. The game loads images in batches of 500 to avoid clogging the queue, and in order to start the 2nd (and additional) batches, it re-appends a command to load more images. This command was using whatever path the game loaded last for mods, including overrides.
To fix the issue, I just had to store the current mod's path somewhere I could get at it, and use that instead of the override path. Now, each mod changes that path before starting to load, and the batched image loader gets its info from there. The fix even allowed me to cut out some redundant code from the mod data loader.
After fixing that, I:
also made a minor change to Liza's faction info, since she was attacking Philip violently after Saginaw. She excommunicates Philip, but shouldn't hate him. Players who choose the non-sash reward and enter Saginaw with no moves left can get caught by her, and killed. So now, she uses the same faction info that King Eli does when he's in a better mood.
I also fixed an issue whereby Hatter wouldn't take the drum and vial after cutting a deal with Philip.
And what is the new toy, you ask? I bought an iPad! (I mean, ahem, iSlab.)
Since tablet editions are a real possibility, I wanted to make sure I had both an Android and iOS device to test builds on. And since my cheapo Android tablet is a 7", I went for a 10" iPad to get a different screen size. It's a used iPad 3, so I'm hoping that's a decent middle-of-the-road machine for approximating what most people will have.
Unfortunately, it was shipped with a 5W power adapter and a battery nearly dead, so 14 hours of charging later, I still can't really use it. I dropped by the store today for a 12W adapter, and that seems to be helping. It'll be interesting to see how it compares to the Android, as that tablet was pretty low-end specs.
And, of course, it'll be really interesting to see if I can get NEO Scavenger to run on it! (It's all theoretical at the moment, assuming Flash->AIR is a smooth transition.) I'll keep you posted as that situation develophave a good night, all!
Posted on 01/12/2015 - 18:07
Hey Folks! Hope everyone had a good weekend. I had some more quality time with Wasteland 2 this weekend, and I'm having mixed feelings about it. On one hand, I find it to be a polished piece of work with slick UI, engrossing character creation, and an interesting setting.
However, I also feel somewhat disengaged from the playable portion. It seems like 90% of the items are "junk," and the remainder are weapons, ammo, and health kits. I haven't found many items I've gotten excited about. On several of the quests, I feel like I'm missing critical info and just clicking on everything blindly. The NPC's feel more like monologue vending machines, and I'm finding it hard to care about what's going on.
Combat is a mixed bag. I like the arcs of fire, friendly-fire, scarcity of ammo, movement points, crouching, ambush...it's a pretty solid tactical experience once turns start. But at the same time, I feel myself missing the ability to setup an ambush before the encounter starts, or recovering and laying the multitude of mines I've disarmed. It feels like I'm always stumbling into firefights instead of planning assaults.
More generally, I think I'm discovering that I don't like the old-school crpg format. I kinda bounced right of Icewind Dale and Temple of Elemental Evil for similar reasons, after playing them for the first time last year. I'll have to think about this some more, and see what causes this feeling.
Anyway, today's work was a mix of bug fixing and starting modding renovations.
There turned out to be a bug in the map scrolling last week, and I finally figured out why. When I fired up the save game today, the problem was inexplicably gone. And just as I was getting used to it, it returned again. After almost an hour of scratching my head, I eventually figured out that it was caused by starting the game in a lower resolution, then switching to a higher one.
Basically, the map's bounds were only being defined when the game first started, and this was fine if the game stayed the same resolution or got smaller, since the scrolling would stop from overrunning the edges. However, when starting small and maximizing the window, for example, the edges weren't getting updated, so they cut into the map a bit. I had to add some bound-rechecking code on window resize events to solve this.
Also, I started looking into an issue some modders reported when trying to load two mods simultaneously. It looks like it may be an issue with one mod trying to override the other. The game is loading all the path info first, and then loads each mod in turn. Unfortunately, this means that mods loaded later can overwrite path info of earlier mods in the list, which happens when one mod overwrites the other.
I'll need to look into this more before I make a fix. I think it may just be a matter of storing a path for each mod separately, even if there are duplicates in the list. E.g.
nRows=3 &strModName0=AbnerMod&strModURL0=AbnerMod/path &strModName1=BruceMod&strModURL1=BruceMod/path &strModName2=AbnerMod&strModURL2=BruceMod/OverrideAbnerMod/path
Bruce's override mod for Abner's mod has a different path than Abner's vanilla mod. So the game needs to keep track of two mods named "AbnerMod," and load assets from each accordingly. Right now, the game just forgets about the first AbnerMod folder and tries to load everything from the second.
This will probably come up a lot, so I at least want to spend some more time thinking about it before I decide how to proceed. For now, though, it's dinner time. Have a good night, all!