21 January, 2018

Simply put

Programming the Casio fx-9750gII

Everything should be made as simple as possible, but no simpler (Einstein)

Writing programs can be pretty rewarding, when everything works right the first time. It can be a complete and utter pain if you get something wrong, and can be even worse if you don't know the language you're supposed to be working in. Thankfully I think I'm finally getting my head around Casio BASIC.

Computer programs (and calculators too) spend 95% of their time waiting for user input. This is certainly true in a program I've been developing since before 2008. I've made several changes in it over the years, yet I'm still striking some of the same issues today that I did when I first started development.

There's bugs in my calculator!

One bug I had in my code relates to just how fast the calculator works, meaning that if I keep it too busy doing other stuff, it's got less time to take notice of something happening when I need it to. Casio BASIC has a function called GetKey that looks to see if a key's been pressed while it's running (that's important), and pass back the value. If it doesn't see that one's been pressed, then it'll simply return 0 and exit, and won't wait around until a key has actually been pressed. It only seems to wait for about a tenth of a second, though I'm not sure if the speed of the calculator matters.

This can have an impact if the program asks you to choose from a list of choices, and you've put the calculator into a busy loop so you can make it actually wait for a key to be pressed. There are a couple of ways to do this. In short, the loop you use should be really short, and shouldn't involve anything else except waiting for a key. Don't draw bits of the screen, then wait for a key, then redraw the screen, wait, etc. Just wait for a key and loop; if one doesn't turn up, go back to the beginning of the wait loop, which simply looks for a key.

I'd done exactly this in most of the rest of my code, but in this one function I'd forgotten that. I didn't click to what the problem was until I was developing the help functions. I ran the help program and was striking exactly the same issues that I'd struck back in my other routine, meaning that I'd made the same mistake.

Waiting Around

The bug I'd had worked a bit like this pseudocode:

LBL 0
DrawScreen() #Takes significant time to execute
GetKey->K
If K=1; Then Goto 9; IfEnd
If K=2; Then Goto 12; IfEnd
If K!=3; Then Goto 0; IfEnd
Lbl 9
...

Because I was including the DrawScreen in the wait cycle, the calculator was doing what I asked. It takes time to draw the screen contents on this calculator (sometimes on the order of a couple of seconds); it's certainly not a HP Prime or TI-84CE in that regard. Because of that, the calculator would wait for a tenth of a second, decide I hadn't pressed a key, then draw the screen again (taking perhaps a fifth of a second or so), then ask if I'd pressed a key, ad infinitum.

This was awkward, because the program was prompting for one of two values, but I was having real problems actually trying to select either value. It's never a good look when the user has to hammer the key they want just to get the calculator to take notice. Put simply, I was expecting the calculator to accept a key while it spent more time (possibly five times as long) to draw the screen than it spent waiting for a key. A calculator's often single-threaded, so can't do multiple things at the same time.

Apply flyspray

The way I eventually fixed the code was to add a label directly before the GetKey function, and jump to that if I hadn't matched anything I wanted:

LBL 0
DrawScreen() #Takes significant time to execute
LBL 1
GetKey->K
If K=1; Then Goto 9; IfEnd #Jump to first function
If K=2; Then Goto 12; IfEnd #Jump to second function
If K!=3; Then Goto 1; IfEnd #Jump to beginning
Lbl 9
...

This sped up the calculator's response to me, because the only thing it was doing was either:

  • Asking what key had been pressed, and returning 0 if none turned up after 0.1 seconds
  • Storing the returned value
  • Checking the value against a list of other values
  • Jumping to a place
and it wasn't spending time repeatedly drawing the screen.

Conclusion

One thing I learned a while ago from a programming manual, though I can't remember which one: if you find and fix a bug in one place, go through the rest of the code to see where else that bug appears, and fix them all at the same time. This works best for small projects that are only written by one or a few people, but really really pays off for large projects too. The final moral of the story is, don't make the calculator do more than it has to. The battery life of your calculator will thank you for it, especially on bigger calculators such as the TI-89 Titanium or Casio fx-9750gII.

10 June, 2017

Minecraft World Of Colour update (1.12)

A Colourful Update

This'll be just a really short blogpost about a game I play a bit. I apologise that it's not up to my usual standard of post, but I can't think how to improve it yet. I've been watching the features gradually trickle in for this particular update while the snapshots rolled in, and I've got a final summation. Here's my rough off-the-cuff scores for 1.12:

Item Score
Parrots: 4/10
Colour Palette: 7/10
Glazed Terracotta: 4/10
Coloured Beds: 7/10
Bouncy beds: 1/10
Concrete: 5/10
Illagers: 3/10
Advancements: 2/10
Noteblocks: 6/10
Text-to-speech: 1/10
Toolbar saving: 4/10
Recipe book: 10/10 (I couldn't give 11!)
Exciting: 0/10
Total Score for 1.12: 54/130 (41%)

Mobs

They finally added parrots. Birds have been seen in mods before, but haven't turned up in the main minecraft until now. They're brightly coloured, come in five flavours, can be tamed with seed (NO, NOT COOKIES!!), and they dance when you put on a record. They hop off your shoulder when you jump, can't be fed cookies or you'll get dead parrots. They also appear to fly very very slowly, which puzzles me, as I've seen birds fly pretty fast in the real world.

Another Illager mob has also been added, the Illusioner. These are going to be a complete and utter PAIN to deal with for those of us with reflexes dulled by being older than 17. I'm already barely coping with updated skeletons. These might be a bit of a challenge for the CoD'ers and CounterStrikers amongst us.

Colours

An update to the game's colour palette affects sheep, glass, wool, coloured shulker boxes and the newly-minted concrete and beds. It increases saturation in most cases except for uncoloured shulker boxes (strange, that). I suspect there'll be people yearning for a slightly more muted palette, and maybe patching it back in via resource packs.

New/Modified blocks

Concrete blocks (and concrete powder) would have been boring if it weren't for the colours. They'll add to the available palette for creative mode, or to dress up builds with pure colours. It's also not flammable, unlike wool.

Plain colours are all very well, but how about the crazy blocks that are Glazed Terracotta? Basically a rename of hardened clay, the colours have been completely swapped out for wild 1970's patterns. I'm not sure about these blocks yet, they're a bit visually "loud" for me. I guess they'll add a little more interest to builds.

Coloured Beds. Haven't we all been waiting for this! They've even made them bouncy! Say wha?? Who bounces on their bed if they're over 8 anyhow? These are a nice addition. More's the pity they couldn't have coloured the sheet/pillows too. They've also made it so you can't just use three wools of any colour to build the bed. Now you have to find two or three sheep all of the same colours.

Additional Noteblocks. Now you can get five extra "instruments" (flute, guitar, bell, xylophone, glockenspiel) you can add to your musical creations. Again, not a big thing though it will slightly improve the quality of some music pieces that have been turned into noteblock tunes.

Interface modifications

They've updated the achievements screen and renamed them to Advancements. This screen has also had a reorganise into categories. I'm still bemused about this achievements screen rework. A nice feature for absolutely brand new players (the help boxes) can get rapidly palling the 14th time you see it if you're fond of starting multiple new worlds. Minecraft has also added the Narrator which reads out the text to the achievements you get throughout the game. This has the same fault that most text-to-speech engines have, that of not sounding natural enough. It's functional, but I'd not have bothered unless you need the functionality, i.e. you're "legally" blind but can sort of see the screen and just need a little help.

If you run purely creative mode (i.e. you're too wimpy to fight mobs and terrain for your resources) then Toolbar Saving will be a nice addition to the creative mode tools for building. This amounts to taking your hotbar and its contents and saving it aside in one of ten slots for later recall.

Have you ever forgotten how to build stuff like item frames, or redstone comparators? A new addition to the crafting screen now includes a button which opens a recipe book. This is by far my most liked update of the crafting screen. I've been waiting for an update like this, about the only thing I don't like is that you don't get all recipes by default but you work through the game getting them. It appears to be a rework of the crafting from MCPE/Console, and works well at least for me. I'm just waiting for resource packs to catch up with the button on the crafting interface. It's made a couple of minecraft recipe books somewhat irrelevant as a result though.

Finally...

This is a welcome update with new mobs, interface adjustments, colours and a recipe book. However, this isn't an exciting release. It seriously isn't, at least not for me. The best bit was the inventory recipe book. Now all they need to do is to include an onscreen map.

03 December, 2016

Slightly less poor brother and a distant relative

It's been eight years

First, I must mention that much like this article states, I take a long time to write articles for the blog. This one took a particularly long time before I was happy with it.

In a previous post, I described a purchase I'd recently gained. At that time, I compared it to the fx-82MS and Canon F-804P. I won't be reiterating that here, as I've said what I needed to in that post. Instead, I'd like to describe another recent purchase, the Casio fx-9750GII. It's a small upgrade from the G+, having more memory (about 62,800 bytes) and a slightly reworked OS and menu screen. It additionally features nearly 2,900 functions instead of about 900 for the G+. Those weren't the main reason I bought the calculator though. They're nice, but I can do something with this calculator I couldn't do with the G+. I can connect it to the computer with just a USB cable and some Casio software. This means I can create programs inside the Casio interface on the computer without pecking my way through keys on the calculator keyboard. That speeds things up dramatically for me.

USB support has become ubiquitous among more powerful calculators such as the HP stable (HP-39Gii/40GS/50G and others) and Texas Instruments (TI-84 Plus, TI-89 Titanium), and the same is also true for the Casio fx-9750GII/9860GII and equivalents. That allows me to connect it to my computer without any weird expensive bits of kit such as the FA-122, which was an after-market purchase of another US $37.95 or thereabouts. I originally saw this cable cost far more ($139 in 2008 dollars), so I never purchased it. In addition, the FA122's a serial connection, useless for most modern computers without serial ports.

USB capability makes things far easier because most computers have USB ports these days. Of course you require software on the PC side to exchange data with the calculator, but that's downloadable from Casio. The only remaining issue is that the ports are usually USB 1.1 speed, not USB 3. Even considering that, transfer speeds are still considerably faster than the original 9,600 baud connection through the FA-122. I also can't say if the drivers will play nice with Windows 10, the new kid on the block.

Time to try it out

As you can imagine, I've been having a bit of a play. I've basically duplicated the Grocery program I was using on the G+ , and it seems to work well enough. All the features that were in the previous calculator are here, though they've been slightly tweaked and added to. I now have full lower-case support, and I even have common unit conversions! I noticed that screen writes happen quite a bit faster, this could be due to the fact the calculator uses a SuperH SH-4a instead of the SH-3.

The fx-9750GII and fx-9860GII each come in two versions, the earlier one (SH3) and the later version (SH4a) providing some improvements from the Casio Prizm range. However, prepare to be disappointed if you want all the features of a fx-9860GII in your fx-9750GII, because they're not here. There's no backlight, though this is not much of a loss for me as none of my other calculators have one either. There's no "pretty-print" feature with fraction bars, superscripted exponents and other things. Results are represented in decimal form (3.142857) instead of "Math" mode (22/7). For fraction marks, you have what fx-82MS uses (which looks a bit like a little right-angle bracket), and carets (^) for exponents. You also can't use compiled applications (known as add-ins), there is no spreadsheet, and no eActivity functionality. These issues aren't going to kill this calculator, but these are some of the reasons why Casio released this calculator for considerably less cost than its big brother.

One other feature I found missing from my calculator is the inability to back up the existing flash image to a file. If you want to upgrade the flash—and you can—you'll have to be prepared to lose what's there already. In earlier BIOS versions (not 2.04.xxxx) I could have backed up the flash image using a program called fxRemote, but it seems that Casio have now removed that ability, and the same issue also applies to the latest fx-9860GII's BIOS code. Casio no longer officially provide BIOS updates for the 9750GII, so if you decide you want to update the BIOS, you'll end up taking a chance. It's possible to upgrade the BIOS, though the 9750GII doesn't have any updates beyond 2.04. Some people that have attempted upgrading have ended up bricking their calculators, making the calculator almost useless in the process. I did stumble across the original version I had of the firmware for the fx9750GII, so I at least have a backup.

EDIT: it turns out that Casio made an update after all, to change some things around for support of "Exam mode". They basically traded off vector math (and possibly a couple of other things) for Exam mode, which locks the calculator down to a certain set of functions for a specified length of time to make sure nobody can cheat. I'm not entirely convinced this was a good thing, however, I'm not the one making the decisions higher up in the Education boards. So, the latest (to date for Sept 2017 at least) BIOS version seems to be 2.09 for the non-French versions, and a 2.05-something version for the French variants.

Firmware upgrade...

I decided I'd take a bit of a gamble and try to upgrade the BIOS so it runs a fx-9860GII's flash update. The instructions are relatively simple, all that's needed is the most recent version of a flash image for a fx-9860GII, a USB cable—preferably the one that comes with the calculator—and the fxRemote program. As there are actually two files I could have used, I had to get the version for the SH4a, and not the SH3. I found the relevant files, fired up fxRemote and nervously watched as figures scrolled up the screen. Finally the job was done, and I had extra functionality in my calculator after an initial hiccup. I now reckon this Casio stacks up better than it originally did against the HP-50G even though the HP most definitely still has the edge, and for a much cheaper price than I would have ordinarily paid even considering I bought the calculator second-hand.

I also reverted to the fx-9750GII's image, partly to see if it could be done—it worked perfectly okay. So I can go back and forth between versions, but I'll stick with the fx-9860GII's image, as it gets me more functionality. And I'll stick to the version that retains the vector math. I don't need to take this calculator to an exam, so I can decide what I want to have on the calculator.

Grocery Program

The fx-9750GII has also allowed me to improve the grocery program I was working on. It might seem counterintuitive to write a program to handle what most of us take for granted, using our four-bangers (nickname for simple four-function calculators) with memory. However, this program has a little more beef to it, as I can break down the total grocery bill into five broad categories. I can also show how much tax I'll be paying when I pay over my cash. That rate is alterable, of course. About the only thing I've had to worry about has been differences between the newer and the older calculators related to new keywords not present on the original G+. Thankfully those have been minor, and have mainly been because of how the FA-124 program tokenises and copies programs between the calculator and the computer.

I also added support for five temporary values (usually used for price-per-kg figures to be used later) also displayed on the same screen. As a result, the screen now looks a little different than I first described back in the original article. Due to the ease with which I can transfer programs, I can also upload the program to hosting sites, so my simple grocery program is now up on Casiopeia.net. I go into more detail in this article.

Forensic result

Like the 9750g+, the 9750gII also has a similar internal range of digits supported (15) and the forensic result for asin(acos(atan(tan(cos(sin(9)))))), the 9750gII comes up with 8.999999998, or 8.99999999759468 if we extend it out to the calculator's full internal range. That's not much different from the other calculators I tested back in my previous post. This calculation here (sin 60 - 0.866025403) * 1E10) gives us 7.84439, just like the 9750g+.

Concluding remarks

I think I did really well for the money I paid. I got a calculator that compared favourably against the previous generation. I gained the ability to download programs to the calculator and back up the calculator's data files to the computer, and I paid no more than I did for the previous calculator. A gamble paid off when I was successfully able to get the calculator to behave like its big brother the fx-9860GII, although I've yet to find out if there are any disadvantages aside from the missing light. There may be some unseen results I don't know about yet. Lastly, I have a reliable backup for when my previous calculator eventually dies, although I'm not expecting it to for quite some time.

I'm happy.

I did find one strange thing though—I went to register the calculator at the official Casio website, but I struck a problem. Where it wanted me to enter in serial numbers, and even told me where to find them, there's no serial numbers to be found on the back of this calculator. That's not very useful for me. I don't know whether this version of the calculator was ever released with serial numbers, but at least the one I have, has no numbers.

Extra storage

The fx-9860GII SD adds a SD card socket to the many things the calculator already supports. You can use the SD card to store files and add-ons, though to use them in the calculator you still have to copy them to the calculator memory, as the calculator won't execute programs directly from the SD card. Thankfully the calculator isn't limited to 2GB like the default HP-50G, support for cards up to 32GB is now present in the most recent BIOS images.

Casio Emulation

A free standalone binary was provided to emulate the original fx-9860G-SD, but you won't be able to upgrade it to the current SH-3 based BIOS, the emulator simply won't support that. The emulator also doesn't import add-ins, making it only usable for BASIC files (*.g1m) and the supplied addins (*.g1e). Additionally, you've got to source the emulator. If you want an emulator that covers the later model, you'll need to purchase a yearly subscription for the emulator directly from Casio. It's up to you to decide whether you think having the emulated version is worth the cost.

“But wait, there's more...”

Old line. I just had to use it. Anyhow, I also bought a Hewlett-Packard HP-50G a little while ago for a significant discount off the retail price. I haven't evaluated this calculator properly, because it's a complex beast for someone still used to Casio calculators. It does everything the fx-9860GII does, and far more. It's been compared favourably with a TI-89 Titanium, whereas the fx-9860GII is compared more against the TI-84+. Engineers have loved HP products for generations, and while the 50G doesn't share all the strengths of the HP-48GX and relatives, it brings strengths of its own to the HP collection.

  • For starters, it's faster due to the ARM CPU. It's normally clocked at 75MHz, but can be clocked higher for a resulting increase in battery consumption. It's still emulating a Saturn environment though, so you won't get a true 75MHz worth of performance, more a somewhat-three-to-ten-times improvement over the HP-48GX.
  • The screen is easier to read even though it's still greyscale, and the resolution has been slightly increased (131x80). It's certainly not colour, but it's not bad.
  • Like other modern calculators, it includes the ability to use USB to install applications.
  • It has a SD slot for increased storage space. I made sure I bought a 2GB card specifically for the calculator, because there is a 2GB limitation on the size of the SD card. The filer can access all the files, but doesn't report the size of the card properly if it is 2GB and not merely 1GB. The only way to get support for more recent cards up to 32Gb is to install newRPL, which is still being developed and isn't as featureful, though it is a heck of a lot faster. It's also considered very much alpha software.
  • It can communicate with some older generation HP calculators and peripherals over infrared, and even retains a serial connector.
  • It's the most powerful calculator in the HP stable except for the Prime as of 2015.
  • It includes a CAS (Computer Algebra System). This CAS disallows the calculator from being used on a few rare exams that disallow calculators with a CAS (or in some cases with graphing capability).
  • It uses 4 standard AAA batteries, instead of the 3 batteries that previous HP calculators used. This allows the calculator to last longer on a set of batteries.
  • If you're at the computer a lot, the calculator will even run fine plugged into the USB cable, though it simply doesn't use battery power while the USB cable's plugged in, nor will it charge the batteries.
  • Equation libraries previously provided externally now come standard with the calculator, so does a periodic table.
  • There's collectively 512k of memory available for calculations, helping out in large calculations. You can't create something that's much bigger than about 200k though as the memory space is divided between ports.
  • Sound! Yes, this calculator has a speaker, just like the HP-41CX. Don't ask for MP3, but you will get tones.
  • It claims 2,300 functions, but if you wish to create other things, you can happily synthesise more out of the existing ones, or simply write your own using UserRPL/SysRPL. Do read the Advanced User's Reference commonly referred to as the AUR. It describes just about any UserRPL command you can use.
  • The functions provided in RPL amount to a stack-based programming language with a lot of strengths, if you can get your head around RPL and working with a stack. It's been compared somewhat to FORTH, and is definitely not like BASIC though many keywords can be recognised from other programming languages.

That's just a sampling of the features this calculator has.

What about RPN?

Yes, the HP-50G still has RPN (in the form of RPL), and indeed relies on it for the CAS mode. However, HP included an Algebraic mode for those people who just can't stand to be without it, and for whom RPN makes about as much sense as a fish riding a bicycle. This isn't the most intuitive mode to use, and it's a reasonable assumption that to use this calculator well, you'll need to learn RPL. Considering that RPN has a fixed stack size (four or eight elements), RPL is a welcome boost, as the stack size is only limited by available memory.

Thankfully, the calculator provides menus to navigate the available commands, and provides a complete catalogue of functions just as earlier RPL machines (28S, 41C etc) did. The available manuals also describe these commands if you need to look up how to use them. You may also need to learn UserRPL or SysRPL to create functions or programs that aren't already part of the 2,300 functions of the calculator. A lot of that information is in the Advanced User Reference, or AUR. An introduction to most of the common commands is in the User Manual, and the User Guide expands upon some of that information.

The manuals—regrettably for HP—reportedly aren't up to the quality of the manuals provided with the HP-48GX family, or even the HP-49. However, it will bring you up to speed if you're good at reading. There are forums where HP owners/collectors gather to discuss various models and programs running on them, and are considerably busier than the English casiopeia forums where Casio owners can gather. If you feel like a more complete picture, earlier manuals for the HP-48GX would be considered the pinnacle of reference manuals.

Because the main core of the calculator executes on a Saturn code emulator this opens the calculator up to reusing code from earlier platforms, as much of it will also work on the HP-50G perhaps with slight modifications. People can also code applications in the native ARM instruction set if they need the full speed of the CPU. However, we're still comparing apples to ocelots when saying one's better than the other. If you can live with waiting a second or two for your results, then running the code on the Saturn emulation won't make much of an effect and will save you from having to recode. But if you need speed, running code natively on the ARM platform may well reap rewards especially if your problem is a good fit for the ARM platform. You will have to source a GCC toolkit for HP's ARM CPU, and install a helper application so ARM code will run natively. Or, you could possibly use the tools provided on the calculator already, but you most certainly have to know what you're doing. This is after all a calculator aimed somewhat at the professional.

HP-50G storage and file access

Of course, there's the small issue of getting stuff onto and off the calculator from the computer. Thankfully, the HP makes this relatively easy, but it's easier if you happen to have a SD card reader installed in your computer, that way you can simply put files onto the SD card, remove the card from the computer, and insert it into the HP-50G. The file browser on the HP-50G can then be used to source the file you need off the SD card. I've installed several useful applications this way.

There's one wrinkle though. The HP-50G's filer can create subdirectories within the HOME hierarchy, but can't create subdirectories anywhere else such as the SD card, even though it can access subdirectories on the SD card. This is a limitation of the HP-50G, so you'd have to resort to using the computer instead. Under Linux, copying files to and from the SD card works much like a FAT floppy disk, don't forget to umount the SD card before putting it back into the HP-50G. One other limitation with the HP-50G is the lack of support for SD cards larger than 2Gb unless you install the newRPL environment mentioned earlier. If you don't have either a SD card reader or a SD card, then you're stuck with using a USB cable and HP's Connection Kit software. Accessing HP-50G files from Linux can be done using ckermit (the equivalent of the HP Connection Kit), as long as you've got the HP-50G connected to the computer through the USB cable. Don't forget to start the Kermit server on the calculator when accessing it with Linux, not the Xmodem server that the HP Connect software will ask you to use.

One other thing I discovered with applications on the SD card is that I can execute programs from the SD card, but they will get copied into the main memory first, and removed from the main memory when the program finishes.

HP-50G emulation

Like the Casio fx-9860 calculator, there's also a Windows emulator for the HP-50G. It can be found if you look really hard for it. The BIOS version string shows "HP50-C Revision 2.16", instead of the 2.15 revision currently available in real HP-50G calculators. It does have one puzzling omission—there's no support for libraries beyond the three supplied in the BIOS image. You cannot write to Port 2 whatsoever. I also can't find any obvious support for Port 3 (the SD card folder). Other Windows-based emulators supporting the Saturn emulation utilise the EMU48 emulator made by Christoph Gießelink, which doesn't allow you to emulate native ARM binaries, but is fine for everything that's meant to run on the Saturn-based processor. Again, there's no obvious support for a virtual (or real) SD card. I'm not sure what the latest version of EMU48 is, though the last time I edited this article, 1.59 had just been uploaded and had slightly reworked the Saturn emulation environment even though the version still doesn't support running ARM code directly.

Linux is also lucky enough to have a HP-49G+/50G emulator called x49gp, which does support the native ARM instruction set. It also supports the installation and execution of further libraries, and will work happily with a virtual SD file. However, the one lack of x49gp is that it won't connect to existing HP-50G calculators connected to the computer through the USB cable. The only way to get files into and out of the x49gp image is to use the simulated SD card, which is a file you can mount using the loopback device. Just don't have the filesystem mounted while x49gp is accessing it. x49gp has been around a while, and doesn't appear to be recently updated.

Conclusions

I don't see me buying any further calculators unless the fx9750s and the HP-50G all die, and I'm happy with what I bought. There's no doubt that I'm never going to use them to their full capability, but then these days, who does? I am relatively happy with what I'm using the fx9750GII for, and I love the feel of the keys on the HP-50G. It sounds crazy, but they remind me of the very first HP-34C I had, more than 20 years ago. I'm probably never going to buy the HP Prime, as the only real advantage I would have gained would have been the speed of graphing, which I never used anyhow. And I don't need colour for anything else I've been using the calculator for. I don't even need the touchscreen!

And now, I can finally post this article, vaguely piqued to know I haven't covered everything possible, and somewhat annoyed it's taken this long to post it. But, for what it's worth, I'm done. Again.

07 November, 2016

The life of a Flight Simulator pilot

Come fly with me

A few months ago, I bought Flight Simulator X on Steam. They were having a sale, so they were selling it quite a bit cheaper than normal. I got some extras to go along with it, and later on I bought some other planes. It was at that stage that I realised that if people get into flight simulation seriously, they’re up for some serious costs. Normally, when you buy a game, DLC is minimal, and you usually don’t have to pay exorbitant amounts for it. In the flight simulator world, good planes often cost, though there are some rare exceptions. Scenery usually costs. Special additional features mostly cost. A recent look at just the FSX add-ons for Steam came to a grand total of over NZD$3,000 for 137 items at the time. That’s a whole lot of extra cost.

And anyone else aside from Steam?

That doesn’t take account of the many vendors that sell you everything from a C172 Skyhawk trainer to an Airbus A321 and anything else you might want. In short, if you want a specific well-known plane, odds are that someone makes one available for sale. Then there’s the outlay on additional physical hardware to make the flight simulator feel more realistic. This can be something as simple as a joystick, or something as complicated as a collection of instruments, yoke, throttle and rudder pedals. You could literally spend hundreds of thousands of dollars to do a proper job of just simulating a 737 cockpit, let alone all of the other planes in FSX’s stable. This cost isn’t anywhere near the millions a proper full-motion simulator would cost, but it’s still a significant amount of wedge in anyone’s money.

How does free sound?

If you wanted to reduce the cost, there are planes, software accessories and scenery that are available for free. Most of the free planes aren’t up to the same high quality of standard as their commercial counterparts, obviously. The scenery also has some of the same issues of reliability and fidelity, with the free scenery mostly not having as high a resolution. It’s enough to get by, but often the really good stuff you can only get for a cost, and sometimes that cost is significant.

The version of FSX available from Steam has a couple of wrinkles to it, as Dovetail Games recently gained a licence to redistribute FSX, but only with certain changes. For example, there still isn’t a 64-bit version, and the SDK that used to be supplied with FSX Gold (or FSX Deluxe) is no longer part of the package. Nor did Dovetail get the chance to fix absolutely everything that should have been fixed. If you need the SDK for making more planes, airports and scenery, then you’ll need to go looking for a boxed copy of FSX, and that’s getting harder to find, especially an unopened box with unused codes. However, the Dovetail version has some fixes to it that allow it to run better than FSX Gold on modern machines, even if you’re missing the SDK which you honestly don’t need just to fly a plane. Windows 10 notwithstanding, it’s a nice enough program when you have the machine resources to throw at it, but as it’s still a 32-bit program, it still runs into memory allocation limits fairly rapidly. The data files can be huge too. My loaded-up FSX takes up 70Gb on a drive, though this includes a large number of extra AI aircraft that I added for better multi-player model matching, and some commercial offerings of bigger aircraft such as the Airbus A318-A321 family, the Dash-8 Q400 and Boeing's 757/767/777. My favourite so far is the Q400, though it took a while for me to learn how to land properly without busting my landing gear.

32-bit – say what?

Yes, in this age where most software is now 64-bit and safe as houses, FSX is only available in 32-bit. This wouldn’t ordinarily matter, except that FSX isn’t very good at marshalling that 3.5GB of memory. Addons can rapidly use up all of that and want more besides, resulting in the dreaded VAS error. VAS is the short name for the Virtual Address Space that FSX uses. It’s also the only amount of memory that FSX has access to as a whole, as it’s not spread among multiple processes that each have their own address space. Even 3.5Gb would be enough normally, if modern coding methods were used to hopefully reduce the amount of memory required. However, emulating planes well takes a lot of memory, especially when you consider the terrain they’re flying through. And some of that terrain can run into several gigabytes when installed on drive. Depending on how far out you want your viewpoint to reach, will be how much scenery gets loaded in. So if you have a fancy plane, like the Airbus A321, and you have fancy OrbX scenery especially for an airport, you could run out of memory just by sitting at the airport. Needless to say, this isn’t a good thing, as you can’t fly. So people have come up with strategies for managing the amount of space left in the VAS. This includes reducing the draw distance, reducing the complexity of rendered scenery, removing most or all of the buildings, and in some extreme cases, removing AI aircraft.

What about those AI aircraft?

To make sure you’re not flying through empty skies, FSX has the ability to populate the airport and skies around you with other planes. These planes look great from the outside but only if you’re a bit of a distance away from them. The closer you get, the more you realise that actually, the resolution on the skin is not very good. This is done to reduce resources in the already stretched VAS. If you wish to fly most of the purely-AI aircraft, you probably can’t as they’re not fitted with a working cockpit, and there’s only just enough of the aircraft systems running to make sure it’s going in the right direction, the propellers are spinning (or not) and the lights are flashing. Thankfully there are enough real aircraft for you to fly, as FSX Gold was delivered with over 25 unique flyable aircraft that are also AI, with an additional three purely AI aircraft. FSX standard has fewer flyable planes, the rest are AI only until you add the Acceleration pack, making the Gold pack a bit better for user-flyable craft. As I said earlier, other aircraft are well and truly available for those stepping outside the default FSX models.

How’s the Multiplayer?

Yes there is multiplayer support, in multiple forms. FSX Steam Edition uses Steam to connect with other players, a replacement of the older networking code that FSX Gold had. If you connect up with VATSIM or IVAO, you can run their clients alongside your FSX to allow you to connect to worldwide networks of pilots and controllers, though the chances of striking a controller at every airport you want is minimal. If you choose your times carefully, you can get a controller when they have logged on for a set period of time—often after work or during their weekend. If you want a controller at 3am airport time, you’re unlikely to get one. The voice quality on the simulated VHF radio varies from almost unreadable in some cases with VATSIM’s client to a very clear Teamspeak2-based vocal stream if you use the client for IVAO. It’s probably not a good idea to run both clients simultaneously, as you’ll possibly have to talk to two controllers for the same airport at once, which is not a healthy mix. Other clients are available too, but VATSIM and IVAO are the most well-known.

How about controlling?

If you’ve ever felt like directing pilots through airspace just like real-world controllers do, then you’ll need some other software that doesn’t come with FSX. For VATSIM, you’ll need a client called Euroscope, and a lot of training. For IVAO, you’ll also need their controller client and a lot of training before you’re let loose upon the public at large. Don’t expect to pick up FSX one week and be controlling on VATSIM the next week. It won’t happen; even if you have real world experience as a controller, this will only speed up the process somewhat. You have to have a good head for procedures, and a very good spatial awareness of planes in your vicinity. A clear understanding of the issues pilots face is also an added bonus, and most controllers have usually had some flight time under their belts before they take on the controller’s role. If you want to take your chances on the Steam-based multiplayer network, then you can also control or fly using that, but your likelihood of getting high-quality pilots (or controllers) is reduced if some youtube videos are to be believed.

Other flight simulators

If you wish to address some of the shortcomings that FSX has, you can use other flight simulators. The best known alternatives are Prepar3d and X-Plane. Prepar3d offers a high degree of compatibility with FSX, meaning that models usable in FSX are also often usable in P3D as well, with a few exceptions. To the best of my knowledge, it’s also a 32-bit program, but it runs a bit better and uses memory in a different way. If you just have to have a 64-bit flight simulator, then X-Plane bears looking at. It doesn’t offer the same compatibility with FSX that P3D does, but for that 64-bit you gain the ability to do quite a bit more, as the amount of memory is no longer limited by a 32-bit address. Heck, it even supports Linux! It also offers a far different emulation of the flight model for planes, making their behaviour match the real-world characteristics to a far higher fidelity. Additional planes are also available for X-Plane, though costs may differ from FSX equivalents.

And finally, FlightGear is free and also has support for Linux, and also boasts the additional moniker of Open Source. It appears to be nowhere near as mature, especially for the number of planes and airports available, as these are usually community-provided by people who’ve donated some of their time to making these planes work at least somewhat, even if they might not have the same polish as commercial offerings for FSX. One of the nice touches—if you have the drive space for it—is the freely available terrain database that mostly covers the whole world. There aren’t a whole lot of airports that have their buildings, if you’re unlucky, you’ll only get the runways. At this time, only 145 airports are fully developed enough in FlightGear to at least have taxi signs or buildings, the rest are undeveloped until someone gets them created to a high enough standard.

Final conclusions

Flying on a computer has been possible for quite some time. As the years have progressed, flights have become better looking and better feeling, but we’re still stuck with the fact that you have to look through one or more screens to see what you need to. In addition, if you wish to have enough bells and whistles to reflect a higher fidelity of flight experience, it’s going to cost more than your initial FSX purchase, and in some cases, significantly more. In saying that though, it’s a great way to suck up some time, and if you decide you’re going to go the multiplayer route, you’ll meet up with other want-to-be-pilots and controllers. Of course, you’ll run into some pillocks, but that seems to be the case for any online community. So, when’s your next flight?

14 October, 2015

A graphics tablet upgrade

Once upon a time...

A very long time ago, I bought a second-hand Genius tablet, a NewSketch 1212HRIII. It was a fantastic size at 12 inches square. There was plenty of room to write large if I so needed. The resolution wasn't particularly detailed, though it was okay for the time. While it worked fine, it needed a serial connection. Also, there's no pressure sensitivity with a tablet that old. Well, the computer I was using for the tablet died, so I had to either find a replacement powersupply for the computer (assuming the motherboard hasn't died), find another computer that has a serial port, or find a new tablet to replace the 1212HRIII. In addition, there was the added problem of finding a driver that would actually work, as the driver for the 1212 barely worked with XP.

So, I bought a new tablet. I browsed a local online computer supply store, and picked a likely candidate to suit my budget. I also compared some of the reviews I could find, what few there were. In the end, I chose the Genius MousePen i608X. The reviews I saw on the site all said 1,024 levels of pressure sensitivity, 2,560 LPI and some software that was free for a month but would cost you several hundred dollars if you wished to use it after the initial month. Well, I got a little surprise when the tablet arrived.

Huh? It got an upgrade?

This tablet is also called the i608X, but supports 2,048 levels of pressure sensitivity. It has 5,120 LPI and a stated resolution of 0.25 mm. It has no trial software on the CDROM (so, no Corel Paint), though it does come with a freeware paint application in addition to the drivers and manual. I took the suggestion of the various reviewers and headed off to the Geniusnet.com website to download their later drivers, as I wasn't sure what age the drivers on the CDROM were. You may have to google for "geniusnet.com i608X download" like I did. I installed those, rebooted, plugged the tablet in, and watched Vista while it churned a bit discovering new devices. Woo hoo! I now have a new 6" x 8" tablet.

Thankfully, because this tablet is smaller, it fits on my desk much better than the 1212. It's also USB, so it works with anything that's got USB ports and the right drivers. About the only problem I'm likely to strike is battery life in the pen, as it's not batteryless. I think I can live with that, I have plenty of rechargeable batteries. And because of the pressure sensitivity, I've learned a few new tricks with drawing that I didn't know before. Frankly I'm no artist, so learning how to use this properly is going to be quite some process, but I didn't seriously need the extra "features" that most more expensive tablets have, such as tilt, or even Eraser. It'd be nice, but at least for me, tilt would only get in the way. While an erase function would be nice, I can usually select the eraser from the palette in GIMP anyhow.

Ah yes, the pressure support

It's there, somewhat. Some programs support it properly, some others are a bit flakey with it. For example, Krita (a KDE drawing app) supports pressure input fine from the tablet, but the application I use most (GIMP) doesn't always register that I'm inputting from the tablet, and ignores it, at least with the default kernel module. Under Windows, pressure sensitivity at least works in the GIMP, but under Linux I'm not as lucky, even though I'm using the same version of GIMP in each case. I've noticed that Paint.NET doesn't support pressure sensitivity whatsoever, at least in the last version I have. I can't upgrade it any further as the author now wants a minimum of Windows 7 for the application.

So, does this require a DKMS module to support things properly?

In a word, probably. I upgraded to Ubuntu 15.04 just so I could get proper pressure sensitivity in GIMP. I got partial support, but not everything was working right under the normal Linux kernel. So, I headed off to github, and grabbed the digimend tablet support deb. I installed that, removed the original hid-kye module, unplugged and plugged the tablet back in and restarted Xorg. After that, everything appears to work properly, and the best news? I even got the tablets mouse to work. Pressure support now works well with GIMP, at least under Linux.

So will we see any new cool pictures?


Because I'm so new to computer art, and to art in general, I don't know most of the techniques to use. I think I have quite a long process ahead of me. I think I'll like this. Incidentally, this picture was drawn with my original tablet.

Would you recommend this tablet?

Hey, what is this, twenty questions? Um, right. First off, this tablet is most certainly a budget tablet. It's not a tablet for people who have lots of experience with tilt, pressure and different brushes under commercial graphics programs. It's not a tablet I'd recommend to a professional artist, unless you're really needing to pinch your pennies. It's a small tablet (though not absolutely 4"x5" tiny, thankfully) for people who are starting to learn about computer art. It doesn't take a lot of room on the desk. It's under a hundred dollars, at least in our currency. It doesn't have an eraser, but it does come with two spare hard nibs, a nib extractor and a CDROM with some drivers, the manual and Paint.NET. If you buy this tablet, do yourself a favour and grab the drivers from the manufacturer's website (in my case, geniusnet.com) if you're using this tablet under Windows. If you're using this under a Debian-based Linux, head to Digimend's site for some updated drivers until the Linux kernel support catches up with this revision of the tablet.

I think I got lucky, as this particular tablet supports twice the number of pressure levels than its predecessor, and slices, dic... wait, that's the knife set. It also seems to have a higher resolution. It remains to be seen how long the nibs last, or how long each AAA (or LR3) battery lasts in the stylus and the mouse. I'm hoping I can buy more nibs another time.

There's no fancy Wacom-like dials. The stylus needs a battery, so that changes its weight as a result. It's a bit heavier than a good quality Parker pen as a result. The nib doesn't appear to have any "give" or provide any obvious feedback, so learning just how hard to press for a certain effect is an exercise in training and experimentation. Most artists would probably be well aware of this anyhow. The mouse is of dubious value unless your desk really is running out of real estate. I wouldn't try to game with the mouse for example, I already bought a Logitech m950t for gaming. You could possibly save yourself one battery and use your existing mouse on the tablet as a mousepad, but that gets complicated when trying to share space with the stylus.

Hey, you missed out the hotkeys

Ahhhh yes. I did too. Surrounding the working area of the tablet are a number of gray squares, and the ones in the top line are tied to common application functions. The ones down each side are blank and can be assigned to anything supported by the application, at least under Windows. However, you can elect to use the entire tablet area, and forgo the hotkeys.

Wait, what about Linux?

Gee, you really are quick today, aren't you. I haven't figured out how to get the "keyboard" working on the tablet, as the Linux driver simply uses the whole tablet as the working area, which includes the areas set aside from the working area normally under Windows. You can of course reduce the working area in xorg settings, but this doesn't then open the excluded area up for further input as hotkeys. If you're after the normal shortcuts available under Windows, I don't know how to do it under Linux. Those appear to work well enough under Windows, but the various buttons can only be set to whatever the application supports. If you want a custom key or program to trigger, I think you're out of luck. Consider it one of the slight penalties for choosing a budget tablet.

Now I've got the "right" drivers, input from the tablet is smooth, especially in Krita. Krita has an advantage over GIMP in that the size of the brush indicates just how hard you're pressing, a smaller circle for light pressure, and a larger circle for heavier pressure. The GIMP merely shows the selected brush size. As for other programs that support pressure input, I've only tried Pencil2D, which worked quite well.

Naturally, the more work I put into learning the basics of drawing with a tablet, the better I'll get. Anything's got to be better than the cartoon I made.