Tuesday, September 21, 2010

Adventurer 0.0.1.1



I've got Adventurer 0.0.1.1 up. It feels a bit overwhelming to try to match what I got done last week, and this week was probably really more of a break. But I did get some important things done. For example, if you've been crashing when attempting to load the Encyclopedia data, I think I fixed your problem. It was a weird thing to do with localization. When I use float.Parse(line), it thinks I mean the string is in the local format when running it, not the local format when compiling it. So 123.456 and 123,456 are the same thing depending on your region, but will cause crashes if yours doesn't match to mine. If you use dot-decimals, then you should already have been good. If you've got comma-decimals, give it a try for me and tell me if it works, or if I should work more on that.

An in terms of new features, you've got pick axes, shovels, and potions of regeneration. And chunks of dirt. All items now have potential "uses". Like a pick can mine out adjacent tiles, and a shovel can dig into the ground. It's in list form, as well, so items can have lists of many, many different ways in the future, which will be awesome. Also, I fixed up the item spawn rates. Components you can craft together will spawn now. I think this will be more and more interesting as crafting gets more developed.

Sorry to 64-bit users, you're out of luck for the moment. And anyone not on Windows. But other than that, this version should work just fine for you. Tell me if it doesn't and I'll see if I can figure out what the problem is. I'll be looking at fixing it up for 64-bit users, and Mono for cross-platform development.

Okay! For next week, I'm going to be taking a look at the aforementioned improved compatibility. Maybe add more items, like always. Also, I'm going to fix a bug that is making creature stats behave weirdly. I thought I nerfed rats, but I still got an arm bitten off. Maybe some more creatures. Maybe creatures with some unique quirks, like slimes that can't see but can smell and hear well, and use that to sense stuff rather than sight.

Tuesday, September 14, 2010

Adventurer 0.0.1 Stable



If you've had the headache of seeing the Windows Standard Useless Error Message when trying to run Adventurer, then I think I just made your world a whole lot better. For the past couple days, Adventurer 0.0.1 has been repeatedly taken down and put up again while I tried to make it work for more people. I found what the problem was.

The Tao.Sdl.Dll file was missing from the archive. I had it on my computer, so it ran for me. And some of the C# writers, too. But not the average user. After finding out what the problem was, I included it, and everything seems to run fine for most people. The only two crash bugs in the current version were from one person on a 64-bit system (apparently 64-bit users will have problems for now), and another with a weird bug loading the Encyclopedia. Both of those put out crash logs, which is a huge step towards making things more compatible. All others that I know of have been able to run it.

So go grab a copy, and give it a try.

Sunday, September 12, 2010

0.0.1 - The Complete SDL Overhaul


For all of you who were waiting for compatibility - here you go. This should now run on about anything. Even before I've looked into cross-platform compatibility, you should be able to run this on other operating systems if you use the right tools. XNA has been completely obliterated from Adventurer. No more heavy requirements. In fact, I don't even know what else you would need. I've got the dlls with it. Hence, why it's half a megabyte now whereas before it was less than 100 kb. It's because the old versions required huge libraries that would be a headache to download. This should include everything.

It was a lot of work (as you may know from my last two posts), but that's done and more. In addition to using a whole new display and input system (which should have no visible change to the end user beyond increased compatibility), more has been added to the game itself. Creatures now generate uniquely, instead of being a copy of a prototype. That means all creatures, with more statistics in there, now start with their own unique statistic levels. Stronger ones hit harder, more dextrous ones are more accurate, higher constitution ones take less damage, etcetera.

All creatures now start with their items in the appropriate slots. Which means you start wearing your clothes rather than carrying them. Creatures should also recognize and manage their weapons and armor now - if they've got a dagger in hand and come across the more powerful hand axe, they should unequip the dagger and then equip the hand axe. Also, item crafting was balanced better and I fixed a bug with multiple of the same components. Which means you need three pieces of cloth to craft pants, but only one for a hat.

And I think that's about it, other than little nick and knacks. Next week's going to see about capitalizing on the improved crafting system and possibly getting an experience system going. And anything else I think up as I go. Also, I'm going to ask around about ways to increase visibility. I've been on it over two months, and I've still had never better than 8 downloads in a week. I mean, I'm going to keep going regardless. Maybe it's normal. I don't know, I've never done this before. Anyway, check it out if you like this sort of thing, and I'll be back no later than next week with more of the fruits of my labor.

Thursday, September 9, 2010

SDL Conversion Complete

Since I have two or three more days before the expected update, I'll spend the extra time adding stuff. On my end, an object to handle the generation of creatures separate from the creatures themselves. This will save processing power and speed by reducing irrelevant data. On the user end, creatures will be individually generated with their own quirks, and a stat system with growth should be coming in.

But yes, the SDL conversion is complete. Everything is done and behaves exactly as it did. The advantage? Come next update, you will be able to run it right out of the box, pretty much regardless of your system layout. Heck, theoretically you can run it in Mono on non-Windows systems. I'll need more people to play test it though. I've only got one download on last week's update. :/

I faced several problems during the conversion. The first of which is that SDL is written in C, and I have to get at it with Tao. Which means lots and lots of pointers. Like I said in the last blog post, I was able to sort that out in safe code with IntPtr and Marshalling the pointer into accessible data. The second was that SDL alone does not come with some of what you think would be pretty critical commands, like drawing text or a rectangle. You have to import SDL_TTF and SDL_Gfx respectively. Which it turns out Tao included, and it took me forever to find.

And the third time-waster was looking up how to change the color of an image. You know, I have a white @ sign, I want to turn it green because it's a goblin. Well, SDL doesn't have a command for that. SDL_Gfx doesn't have a command for that. In fact, there are no commands for it whatsoever. The things I found about color key switching were all theoretical and did not work for me. No one had working code anywhere. That's when I decided to check out if anyone on the roguelike development chatroom #RGRD could give me any ideas. I will say right now that if it weren't for them, Adventurer may very well have taken two weeks to convert and still be in black and white.

#RGRD is your hero, guys. It turns out that there really is no easy way to do it, but someone helped guide me through how to make it happen. So I had the data, and the color I wanted to change it to. I have to be able to get at the data. Not normal C# stuff, I had to get at the ^raw^ data. So I needed a pointer. And not just an IntPtr. I needed an honest C style pointer. So I had to flip it to unsafe mode. Got a pointer to the raw data. Now, how to mess with it?

You can get at pointer data by saying pointerWhatever[somenumber]. That finds a block of data in there. In this case, a pixel stored in RGBA format. Or maybe it was ARGB. I forget. I then had to convert a color into its raw ARGB data. Thankfully, there was a command for that. Then I had to put it in an appropriate pixel. Well, at first I just picked one at random. White dots started appearing in images, which meant that it worked.

Next, I had to get at not just one, but all the pixels. Pixels are not stored as [x,y] coordinates in an image. They're all one dimension. Which meant I had to write a function to make that happen. Which I did with the help of the #RGRD folks. All this with the help of the #RGRD folks. Once I had access to all the pixels, I had to work out criteria for changing the color, or else I'd end up with solid color blocks. Color multiplying was brought up, and I tried to implement that. Basically, R100 * R50 = R75. Well, it didn't work like I wanted. But then I figured something else.

I simply looked for any pixel that was not transparent (Alpha > 0), and changed only those. It suddenly worked. From misshapen color garbles to the old Adventurer. And from there, it was smooth sailing. Well, except for a little kink with the shift key that I just today finished working out. After all that, the final thing was just a logic slip on my part. So it's all working, and expect an update in two or three days. I can't seem to find the chat log, which has a link to a Pastebin post which would have given you all the code. Nor can I properly thank the person who showed me how to do it. So to all my players, all of #RGRD, all of the roguelike community, and in particular that one #RGRD guy, thank you!

Monday, September 6, 2010

XNA to SDL Conversion Progress

I'm in the midst of a massive conversion. XNA is getting the boot. Compatibility will rise significantly. I made a test SDL-using program and even some old junk computers I have around were able to run it, when they couldn't with XNA, even after I thought I'd updated all XNA requirements. That's the easy part for all the players. But for me... well, let's just say that it took me a full day just to figure out how to get a sprite on the screen.

Most SDL tutorials are written for C or C++. Which while on the surface is quite similar, has a big difference. Pointers. Ye gods, the pointers. C# doesn't like having the programmer have to use them. If they are used, they have to be marked as unsafe and you have to do your own garbage handling on that. Eventually, I found a way of wrangling the pointers into something I can use outside of unsafe code with IntPtr and something called Marshal.

But, once I got past that, it got much easier. SDL does plenty of things even better than XNA. That problem with cropping images? SDL can do that. Keyboard input? SDL can tell you if a button's just been pressed. Text drawing? Well, you need another part of the SDL library, but SDL can do that. So it should be better when I get this done.

And as you can see from the above image, I'm not done yet. A lot of things to fix. Right now, it's at a state where I've put all the things that were in XNA Adventurer over to SDL Adventurer. Even organized it better as well. Now I have to translate anything and everything I was doing with XNA into its SDL equivalent. And since I'm learning SDL on the fly, that could take a little while. But not much. I already know the basics of sprite drawing, as well as input. Now I've got to get text drawing and sprite transparency and color.

But overall, it's going well after the initial rough start. Steadily making progress. And again, many more people should be able to play it when I'm done.

Sunday, September 5, 2010

0.0.0.10 Bug Fixes and More Creatures


Psyche - Still not 0.0.1. It's mostly just a bug fix, I'm still not at that "this is at least a good time waster" level on how much of a game I feel it is. Although adding minimum depth creatures certainly added a good deal of that flavor. The major thing I've done in this update is fix a huge deal of bugs of varying importance, from pathfinding accounting for creatures in the way to crashing when a creature died while carrying too many items. There's more to be done, but I caught quite a bit in this update. But I don't feel I did quite enough with this one. Mainly, I'm holding back for the next update, which is probably going to cause more bugs.

Specifically, the next update is all about taking XNA out of the game and switching to OpenGL. OpenGL is used in things like Dwarf Fortress, and it's the leading competitor to DirectX. And more importantly, it is a cross-platform thing that almost no one should have to download anything extra for. I'm getting at it with something called the Tao framework, for C#. Since OpenGL is cross-language, it needs a 'binding'. Which is basically what Tao is. A go-between for C# to OpenGL commands. OpenGL itself being a platform-independent way of getting at various output and input stuff. It should involve no work for the end user. Most should be able to just unzip the archive and play the executable file directly. No more downloading huge frameworks and hoping it works.

With this, the requirements should drop to near nil, and it may in fact fix some crash on startup problems people have been having. So that's what's going on next week. It'll be a big week. In fact, I'm not sure just how big of a thing this is going to be until I get in there and do it. If it's much worse than I'm thinking, it may stretch on for longer than my usual weekly update. Hopefully not. It may even be shorter, letting me play around with more tangible updates in the gameplay. So see you next week.

Wednesday, September 1, 2010

End of Month 2 - August

It's the end of the second month of working on Adventurer, and I think it's going well. It is fast approaching what can be called a game, and it will only get better from there. In the past month... heck, I don't know what all I've done. Armor, weapons, a simple item crafting system, a system that should track crash bugs, a lot. I know all of what I've done so far is probably buggy. I know because that's what I'm fixing right now.

Next update is going to be mainly about smoothing out the mechanics that are already in, as opposed to making yet more new ones. Melee attacks should always target the appropriate foe from now on. Creatures will take advantage of the new items. The size of the Creature files is smaller relatively. More bugs as I spot them will be fixed. As well, I'm also putting in some mechanics that will give a sense of progression. Different and tougher creatures as you go deeper. Maybe I'll get that statistics system going, so that your character can grow in power over the course of your journey. Again, no promises. Next update is mainly a bugfix, stability thing, where I round out the implementation of the systems that are already there.

As for this month's statistics: 195 views of the blog. 2 ad clicks. $0.16 in the ad revenue. 5 downloads of 0.0.0.9, and a grand total of 38 downloads. 21 of which were in August. So it's a slight growth in downloads, and that's a good feeling. I just hope it does catch on. It feels weird being in this limbo where I've done so much, but it hasn't caught on yet. Maybe I need more ways to get it seen. Maybe I just need to wait.

And in any case, I'll keep working on it. I've learned so much already, and it's pretty satisfying.