Tolkien Collector's Guide

Winner of the 2019 Tolkien Society award for Best Website

I just wrote "The Hobbit" in C#
By Stu
Shirrif (Moderator)

I just wrote "The Hobbit" in C#

Jun 5, 2014 (edited)

Took me three weeks (and seemed like a good idea at the time as I didn't know C# and I didn't know XAML).

It is built as two Assemblies, one containing the core engine and game world definition (which can be run standalone as a pure text console application) and a second assembly that contains a windows GUI.

It essentially does all the same stuff as the ZX Spectrum original, with some very minor differences. Yes, you can type "TAKE EVERYTHING EXCEPT THE SWORD THEN VICIOUSLY ATTACK THE GOBLIN AND RUN NORTH" and it will know what you are talking about.

It is roughly 9000 lines of C#, but that's a bit misleading as it includes comments and blank lines. I'd say about a third of the total is "world building" (locations, items, behaviours, timers, etc) and the rest is parser/engine and GUI.

Yes, I do have too much time on my hands. S'pose I should make a web-enabled version of it, just so I learn how to do that with Microsoft rubbish as well...

228_53903dd469fe4.jpg 2496X1672 px

228_53903df82625c.jpg 1488X1206 px
Jun 5, 2014
Sweet! Plus the artwork looks classier than the stuff I draw when forced to.
Jun 5, 2014

Urulöké wrote:
Sweet! Plus the artwork looks classier than the stuff I draw when forced to.


Ahh, I can't take credit for the lovely 8-bit graphics - I have just used the original 1982 ZX Spectrum stuff (albeit pre-rendered) and the font is a simple truetype representation of the 8x8 standard Spectrum font.

The only concession I am making on the graphics is that I am removing the attribute clash (the spectrum could only support two distinct colours in any 8 by 8 grid of pixels, so you would get the effects you can see on the screenshots I posted up, where some of the pixels are not the ideal colours). I've only removed it on about half of the images thus far as it is tedious "do whilst watching TV" work.

My plan is to make it a bit of a "digital historical artifact" and embed a lot of extra information about the history of the original game (and also how it relates to the book, that can be "popped up"). I may also allow the player to look at alternate graphics from other versions, such as the C64 (tape) and C64 (disk) versions.

It was fairly revolutionary in its time due to the (relatively) advanced parser and the fact that the NPCs in the game all do their own thing whilst you are doing yours (which does sometimes mean that key characters necessary to finish the game will kill each other or get locked up in dungeons!).

At the end of the day, I read "The Hobbit" because the paperback book came supplied with the game - for me, this is what started my Tolkien collecting 34 years ago...

(I also wrote the '82 classic "Jetpac" last year in HTML5/JavaScript with a mixture of modern and original graphics, so this may just be the start of trying to regain my lost youth)
Jun 7, 2014
I know this is a bit off-topic for this forum, but the 1982 game - with all its strangeness - is the definitive "Hobbit" in my book, so y'all might have to indulge me another post or two.

Uruloke commented on the high quality () ZX Spectrum graphics, so I felt compelled to create a single new graphic for my version. There is a famous location in the original game called simply "Empty Place" which tells you "The empty place is too full to enter" if you try and enter it. It was seemingly a test location that the original programmers (Veronika Megler and Philip Mitchell) forgot to take out before the game was released.

I had originally left the "Empty Place" in my version identical to the original as an inaccessible location which would spit out an error message, but I decided to allow access to it and use it as a place to put something entirely non-authentic (the only thing that isn't true to the proper game). I just knocked up a picture of my house with "olde-wurlde" graphics to match the original. In the background are the misty mountains (actually the Remarkables mountain range that PJ used as the misty mountains in the LoTR movies).

I'd forgotten how much fun there is in creating completely pointless stuff for no other reason than you can.

228_5392a1f19ae73.jpg 1492X1198 px

228_5392a27268e3c.jpg 1028X564 px
Jun 9, 2014
Cool! Sounds like that NPC algorithm was (a) advanced and (b) broken.
Jun 10, 2014

Urulöké wrote:
Cool! Sounds like that NPC algorithm was (a) advanced and (b) broken.



Yeah, I think they wanted to leave things quite "open" so that the game would be a little different every time and have repeat playability once finished -- which was different from text adventure games of the period. There are several different ways of solving the game, which is also unusual. Unfortunately, some permutations of the "random" behaviour can result in situations where the game can't be finished. For example, if the wood elf captures a warg and throws it into into the Elven king's dungeon and the butler unlocks the door between the dungeon and the wine cellar, the warg is likely to kill the butler -- and then you have no one to throw the barrel through the trapdoor (which you need to be in -- or jump on top of as it goes through, in order to get to the second half of the game).

One fun bug is that you can pick up Elrond (because his weight is obviously not defined correctly) and if you throw Elrond at a Goblin it will permanently kill the Goblin without it respawning (otherwise you see a little debug message about the respawn :))

To be fair to Megler and Mitchell (at Beam Software), they had only 48K to play with and it was 100% written in Z80 Assembler. Having only done simple stuff in Z80A when I was a kid, I can't imagine how much of a pain that would have been. They had to write their own text compression scheme to fit the game in (which is probably why some of the grammar in the textual descriptions is a bit "off"). The simple graphics are a restriction of size as there was only space to store the points for simple vector graphics (and then flood fill).

But like I say, they created something very strange and special back in '82.
Jun 7, 2015
(edited)
(deleted - see sourceforge project)
Jul 18, 2015
(edited)
There is a sourceforge project for the Swift/Mac version (that I wrote after doing the initial C# one). I didn't implement load/save on the C# version and there were some other limitations that were too much effort to work on, given no one else would ever look at it.

The OSX version ended up being much better (and took much longer):

https://sourceforge.net/projects/spectrumhobbitforosx/
Load more
Jump to Last