Tuesday, 23 August 2016

Alas, the end

And so it has come to this, all things must end. But it is nothing to be sad about for me, this has been a great addition to my experiences and I welcome the change for it has been something short of 3 and a half months that I've been working on DM. Not that I won't be working on it from now on, but I'm definitely taking a few days off, lest I come to dislike it for looking at the codebase for too long.

The pull request to merge the engine is due next week as it still doesn't compile with GCC (strangerke has been working on it relentlessly (think 127kbs of error log reduced to 9)). Relatedly, the code is not particularly compliant with the coding conventions at ScummVM (strangerke is working on it, I'll soon start feeling ashamed and will have no choice but to help him).

As for the future of this blog, it is possible that I will post updates for when something major gets incorporated into the engine (think support for other versions).

Almost forgot about the new stuff, if I remember correctly it's convenient loading/saving from the launcher and from the inventory. And also there are debugger commands like godmode, noclip, set pos/map and the aptly named, gimme, which spawns items. Entering the commands without arguments will output their usage, call 'help' for a list of them.

Gimme can be used like this: call 'listItems', if you are looking for something enter any part of it in caps like this 'listItems OF FEAR'. Once you found what you are looking for, call gimme with its name: 'gimme HORN OF FEAR'.

Setting the map is slightly broken. For best results, teleport to an adjacent map, then use pos to set your position next to some stairs and off you go. Avoid using noclip.

PS.: So long, and thanks for all the fish

Friday, 12 August 2016

Finest colours mankind has to offer

Yay! The color palette is FIXED once and for all! No more radioactive green snot on every object and champion and door and what not! The GUI looks fabulous with it's newfound colours, it's just so much more pleasant to click on it now.
Now, the original game uses copper to stretch those few colours the Amiga platform could offer at any given moment and given that ScummVM has no support for something like that (and why would it?) I shied away from even coming close to trying to fix it. Now as the end is nigh, it had to be fixed, and so it was! Phase one, double the palette and offset the pixel colours. Phase two ???. Phase three, profit!
Relatedly the engine is almost complete. What's missing is correcting some display functions, hunting down a few annoying bugs and making sure the game can be finished and then all will be well. The later, so I gather, is not yet achievable. The fluxcages spawned to trap Mr Chaos cannot be seen, because the function drawing them is missing, and that particular function happens to be in assembly (... ehh) and so I can't really test if anything is happening at all, gonna have to make it draw some dummy image.
As always, here's a nice GIF, basking in it glory:

Wednesday, 10 August 2016

Nice cursor, nice spells

Cursor got fixed, seems like googling Amiga hardware sprites is all it needed. Also found the bug with the spell symbols, a petty toUpper call in the text drawing method, dunno what is was doing there in the first place. Long story short, dungeon looks a lot nicer now, palette needs a fix and then it will truly look splendid (sans some scrabbled textures). Here, have nice GIFshot:

Friday, 5 August 2016

Sounds and slightly better blitShrink

The title says it all. There are now sounds in the game, it is the first thing that worked on the first try, or so I hope. One can now indulge in the angry grunts the champions make when you bump them into the walls. Makes one wonder if they want to be there in the first place. Why would they follow an order to go headfirst into the wall?
Also, blitShrink function has been dusted and adjusted and thus the dungeon looks a lot nicer. It seems that after hours of searching for broken code, I realized that nothing is broken, but the original blitShrink method works a bit differently than what I tried to simulate it with. So it seems I can't avoid the assembly after all.

Friday, 29 July 2016

Post title

I'm really tired as I'm writing this, but I don't want to leave it for tomorrow. I wish I could tell you of all the new features, but there aren't really any. Most of my week was spent fixing bugs which made the game crash and burn. The engine is in a playable state, taken that the player can ignore the broken display, the missing sounds and no ending. Speaking of which, I really should take a look at the numerous display functions now, fixing them would make the game look a lot more alive.
Sorry for no screenshots this time, this blog post is turning out to be very short.

(PS.: Method f115_cthulhu didn't do anything, I'm just bad at interpreting errors)

Friday, 22 July 2016

Much combat, very bash

Another week has gone by. The end of the summer is inching closer and closer with every passing day. The engine hasn't grown nearly as much as last week. I managed to fix the bug with the groups, it turned out to be very simple, I was just searching for it in the wrong places. The result is that the player can progress to the next level and fight 'em wicked monsters (nice gif included), put some keys in keyholes and what not. One just has to be careful not to spin around too much or else the display code crashes in some bizarre way. The worst about it is that the call stack is messed up, it seems to be something inside the aptly named function f115_cthulhu. Code for saving and loading has found itself inside the engine as well, although trying to load a save crashes the game (couldn't muster up enough motivation to fix it yet). That's the end of the post, have nice gif: (just as always, ignore the broken cursor)

Saturday, 16 July 2016

Stuff and things

The engine is coming along well. Great many lines of code and even greater many bugs have been incorporated into it this week. It seems that for every bug I fix, that makes the engine crash and burn, there are three more waiting right around the corner. Right now the most inconvenient one is that group management has not yet been tested as there have been zero enemies on the 0th level and as I've spent most of my time fixing bugs there (for example making the damned door open when the player steps on the pressure plate in front of it). So when the player takes the stairs, the game goes down with a segfault.
Items can now be put into the inventory, they can be placed and be thrown around. Interaction with the dungeon is more or less in place, the player can press buttons, step on plates and uhhh that's all there is in the hall of champion people. The champions can now attack and take damage (don't walk into walls). The former has not much use, since  we can't even get near enemies yet.
I planned on having some screenshots of combat, but since I can't get me some real enemies right now, you'll have to watch me fight this wicked door instead.

Friday, 8 July 2016

Such moving much items

As I mentioned in my last blogpost, I was planing on fixing stuff I blew at the beginning, that has been done, thus I can add code much more rapidly now and with less mistakes. If I put my back into it, the bulk of the code should be done by next weekend (no promises). Of course, that would not be the end the work. Code has to be cleaned up, global arrays moved, some refactoring is due. Some display functions are missing entirely or are broken, and I've been putting off fixing them for a while now (color palettes for example), I plan on dealing with them when the rest of the code is in place. There is also other stuff, like making the code compile under something than msvc14, testing if it even works on other platforms than windows, although chances are, I won't be the one fixing those issues.

What I've got for you this week is moving them items:

If you just ignore for a second that the cursor display is completely messed up and that the GUI is kind of broken, the pictures might actually look appealing.
Next up should come stuff like dungeon interaction, combat, inventory etc. All the good stuff.

Friday, 1 July 2016

Items in thy inventory

Progress has been slow lately, what I've managed to get into a working state is those icons in the inventory for display and to be able to actually choose one's champions. Of course, all the methods that the display function calls are done, so that should save me some time in the near future. As according to my plan inventory management is up next, thus picking up objects, thus display objects in the dungeon. The later brings us to my favorite function which I named cthulhu. It's 800 lines long and has about 70 locals with a bunch of them shared, good thing it's already up and running, took me like 7 clean hours of work with all the preparation and the function itself. As I mentioned progress has been slow, thus it is likely that my proposed plan will have to shift, alas we'll see what the future will bring.
Related to progress are my early commits, where I foolishly diverged from the original source a lot,  they have been a source of errors and headaches for a while now. That should change soon, as I plan on reversing those relative changes to match the original one by one in the coming days.

Tuesday, 21 June 2016

Reptilekind's greatest achievement so far

Indeed, their greatest achievement so far is that angry looking lizard person dude in the top-left corner. Great many lines of code had to be written (copied really) to make this scene. The keen-eyed between you might notice the obvious, that there are a couple of things missing. Slot icons are not drawn yet and all of the text (that is not part of a picture) is missing as well. Reason is, that the function which draws letters on the screen is lots of assembly and well who wants to do that. We figured that it probably just treats the font table as a 2D array, plus some word wrap etc.
So champion selection is still not done yet, duct tape code gets us here into the inventory screen right now, no way to leave it yet. Next up should be swapping the dummy code for the real stuff, the try some text display and that might actually make my second milestone complete :)
PS.: Technically speaking, I should have made this blog post yesterday, but I had not much to show for, good thing I gave meself 90 days tops:)
PS.: Color palettes will probably be fixed somewhere near the end, so we'll have to tolerate it until then.

Friday, 17 June 2016

The most exciting thing you'll ever see

Movement arrows!

I managed to display a static image, that's gotta be progress, right? So mouse input is in place (sort of), hitboxes on the screen are getting registered correctly, keyboard input is hacked in for testing and I have this cool picture of arrows in the right corner with miss-matched color palettes and an out of place green cursor, nice! Don't worry, more is coming (in like 3-90 days). And by more I mean champion selection and inventory stuffz, oh boy won't that be fun! Well it would be, if not for the monstrously long functions. The worst about them is that they are heavy on compiler variable sharing because they were meant to produce the exact same executable as the original source code would (sound very much insane, right?) when compiled with the same compiler. And that's it for this blog post.

As a finishing side note, there shouldn't be any hiccups since I'm finished with all the exams, thus my studies won't be weighting me down and I don't have much to do right now aside from coding up this super cool game.

Friday, 10 June 2016

Still alive

I hope that the next blog post coming up will be of actual progress we've made.
As I said in the previous blogpost, progress has been hindered. That statement wasn't too accurate... a more precise description would have been, progress has come to grinding halt.
With the progress I've made before the coding period, after discussing it with my mentors, I focused entirely on studying for my exams and after the last one, I should resume work, which should happen on Monday, hopefully.
Screenshots would be due for a proper blogpost, but I have none which I've not showed you already.

Thursday, 2 June 2016

Walls, yet again

It's been a while since my last post... yet again, although this time at least, it's not entirely my fault. Relatedly, progress has been hindered.  I was foolish enough to let my guard down and 'em exams crept up on me. Hopefully they'll soon get off my plate and I'll be able to resume work. Until then, here is a tiny screenshot just to keep you happy, it'll probably be very familiar ^^

The first chunk of graphics code is somewhat ready, sans some "minor" bug fixes in the current codebase, like the piece of code that tells other pieces of code where things are and which way they want to look gets it wrong about half the time. Also if on the off chance you happen to check out the engine in it's current state, you'll notice that the portraits and the ornaments are not shrunk but rather clipped and they are drawn with mismatched colours. After correcting the faulty logic, next up I think will be to add some GUI display. After the GUI is ready enough, character selection should be next up. It'll require further code to handle interacting with the dungeon, with portraits to be specific and also this is where mouse support comes in (which I should have implemented already). After that it's inventory management. This more or less follows my original plan.

Saturday, 21 May 2016

Very dungeon walls, much wow

It's been a while since my last post... I could say, that I didn't have the time, but honestly, I had plenty, I'm just damn lazy. Also, I had a little hiccup, when I tried to implement a part of a display function. Started typing it up, realized that it has dependencies, so I went to check out those parts but then those parts had dependencies and so it went and I went with it down the rabbit hole. By the time a I realized that I wrote/imported about a thousand lines of code since the last commit and the last time I compiled it was about three days ago it was too late to go back (actually I could have with some additional work, I just thought it was no big deal). This will forever bare it's mark in dm's commit history. Long story short, I left out some details in some functions and did away with loose ends (otherwise I'd still be typing up code for that monsterous commit), and ran it. Little wonder, that it crashed with some bizarre results after a few init functions. Then I spent about two days fixing code, slowly stepping through it line by line, the result was that now file parsing, aside from some minor details is very much complete, there is still some untested code, but that music belongs to the future.

Still, it was a fun experience (who wouldn't want to have a date with the debugger at three o'clock in the morning), I also learned from my mistake and the next time I am to write some functionality into the engine, I'll list the dependencies first and start from the bottom up. That should help prevent accidents like this in the future.

Finally, here is a gif from the zeroth level of the dungeon:

PS: sev was kind enough to lend his time and wisdom in git wizardry, so the repo (sans scummvm code) with the commits has been moved here.

Tuesday, 3 May 2016

File parsers

The engine stub has been created and minimal file parsing has been added, more specifically: the engine can now load and parse the graphics.dat file and decompress the images contained into bitmaps on demand, other than that not much more, but at least it's something visual. Also related to files, uncompressing the Dungeon.dat is now possible, but it's contents have not been used up yet. You can check the commits on github if you like, feel free to comment, give feedback ^^. The author (as mentioned in the comments, not the original author), who graciously gave his sources to be worked from, has a handy blog in which describes the file structures and algorithms used on them in detail. That and my mentors' help has been the source of progress.

Link to the github repo:

On a personal note however, regarding development speed, I've spent too much time debugging errors in 30 lines of code today and boy was it frustrating. In my personal opinion I'm making progress very slowly, I would rather it went a lot faster, I'll have to work on being more efficient with my time in the future or I'll finish nothing be the end of the summer.

Regarding other stuff, git has repeatedly got out of my control and me being me, I've gone the easy way and used force push. I'm really glad nobody is working on the same branch, because otherwise I'd have been burned at the stake by now, but hey, at least my history is clean. :D

Edit: As per request, some image to go with the post, (the palette is miss matched, but it's still something).

Monday, 25 April 2016

GSoC Acceptance

I've have been more than delighted that I have been accepted to GSoC! My excitement knew no bounds when I got the email.

This is my very first post and my very first blog actually. Cranking out even short texts out of my fingers has always been a challenge for me, but I'll try nonetheless, hopefully on a weekly basis.

My task will be to build the engine for Dungeon Master so that players can... well play with it again. I'm really glad that ScummVM now includes rpgs, as otherwise I could now have found a project with ScummVM to my liking. According to my schedule I'm am to start working on the project this week already, we'll see how that unfolds. Hopefully my studies won't interfere much and my next blog post here will be of the progress I've made with the engine.

That concludes my very first blog post.