Thursday, September 24, 2015

Roguelikes

I keep threatening to post about the additional research I've been doing, but I'm so wrapped up in reading about it that I have yet to actually write a post.

That, and work has been a little harrowing. Everyone has wanted their projects completed by Friday this week, which crunches our schedule into a "drop-everything-else-that-was-not-immediate-and-do-this" nightmare. When it's one out of every ten jobs, this isn't an issue; but when it's six out of ten orders, it gets hairy.

Enough about boring work.

The title of this post may have gotten some attention already. Either you are wondering why I would stick those two words together in such a bizarre way, or you are wondering what it was that I found pertaining to this particular style of game (default: neither of these things, just get on with your point).

Roguelikes are a type of game that is based on the 1980's text-game Rogue. They encompass game features such as procedural map generation, turn-based gameplay, and sometimes permanent character death. More information can be found here (Wikipedia) and a basic chronology of roguelikes can be found here (also Wikipedia).

Anyone who has been around this blog for a while knows that I'm enamored with the design of MUDs. Roguelikes began in 1978 with the release of Beneath Apple Manor, the same year that MUD1 was released in England. Both styles of game have their own appeal, though MUDs are by far more intensive as far as content generation goes. I assume that part of what makes roguelikes so popular is the lack of a need for so much manual content generation. The maps of the earliest roguelikes were made up of text characters, as shown below.

Source: http://www.kathekonta.com/rlguide/index.html, which will be mentioned shortly in detail

The classification of roguelikes gets a little bit convoluted, considering there are a large amount of games out there that share some of the same qualities, but not quite all of them. Some argue that Blizzard's Diablo is a roguelike, and others say otherwise, and there are many other cases like this. But these games led to a genre of dungeon-crawling games, of which the goal is simply to traverse the generated maps, find all the goodies, and kill all the bad guys.

I was having a lot of fun doing my research about roguelikes. Somewhere in the midst of it, and I don't know what inspired me to do it, but I typed "how to program a roguelike" into Google.

I have been thrilled with the results.

First, I have to shout super kudos to my first resource. This guy took personal time to write, very candidly, a step-by-step process of programming a roguelike. And the advice he offers in this guide is not specific to roguelikes; it is advice from a professional in the field who is imparting some hard-learned lessons from his experience in software development. I think I find that equally as impressive as the time he has spent writing the guide.


The guide is not complete, partially because of some issues in his platform (look on his blog for more information). Regardless, the 9 articles he has completed are packed with great information about developing a roguelike (or any program) with good structure and clarity.


I also found this article on RogueBasin, a wiki page dedicated to the roguelike genre. It does not go into anywhere near as much detail as the Beginner's Guide does, but it covers some really great points and gives something akin to a checklist for anyone planning to develop a roguelike. I enjoyed some of the considerations mentioned.


Of course, I have to post Archive.org's MS-DOS library. I think it is so neat that they have so many old games available to stream on their browser emulator. Here is a link to a playable version of Beneath Apple Manor, if anyone is interested in traveling back in time.


That about does it for me for today. I want to dive back into my programming exercises in the next couple of days, so hopefully I will have some progress to write about thereafter.

Wednesday, September 23, 2015

Jams, Episode 1

Just because I like sharing the music I like, I'm going to use it as an excuse to post up great songs that come up on my radio station today.

I pay for Google Play Music premium simply for the ability to set up a playlist and make a radio station from it. I've found such great trance/dubstep/techno/electronica this way, as well as many other genres like radio rock, atmospheric metal, new age/easy listening and cinematic/trailer music.

A LOT of this is going to be from the MonsterCat label. They just happen put out a lot of music that I like very much.














I haven't forgotten about the other research post I'm supposed to make. That tangent is still fresh in my mind, but alas. I have to actually do work today. I'll edit this as more music pops up and as I'm able to pause from invoicing.

Tuesday, September 22, 2015

Research = Progress

Or, at least, that's what I am going to advocate to make up for the fact that I have, again, spent too much time gaming and not enough time programming.

Damn you, World of Warcraft. Why must you have addicted me to your schemes again?

When I'm not reading about WoW or scrolling endlessly down my Facebook news feed, I do actively try to find more things about programming to investigate. Yesterday, my search was somewhat accidentally rewarded, simply by visiting Humble Bundle.

For anyone not familiar with Humble Bundle (seeing as I had no idea it existed just a few months ago), this is a company who gathers together collections of games, software, or books and provides them in this "pay what you want" scheme. Some of the money you pay goes to the providers of these materials (publishers, developers, etc.), some goes to Humble Bundle in the form of a "tip", and some goes to charity. Because you can choose how much you want to pay, you can also choose who gets each piece of your proverbial pie of money.
It's a pretty neat platform. Most of the games are only redeemable through Steam, and the books are often Hi-Res PDFs that you must download, but there have been some fantastic bundles lately.

The one that caught my attention this week was actually a bundle of rarities from Neil Gaiman, one of my favorite authors of all time. After snatching that bundle up, I was nosing around and noticed the weekly bundle included a piece of software called GameMaker.

Let me distract myself for a moment by saying that the way I've been training myself to code is pretty down and dirty. I use Sublime Text to write and GCC/Clang to compile. Sometimes I make a Makefile for the little programs I come up with, but most of the time, it is good ole' gcc name.c -o name.
I have never worked with an engine before, and even if GameMaker isn't the greatest engine out there, the price was certainly right for me to get started with it (the bundle came with assets already, in addition to source code from projects made in GameMaker that are already on the market).

Researching GameMaker brought me to a developer called MoaCube who wrote up this review on GameMaker prior to the release of GameMaker Studio, which is the software included in the Humble Bundle. It was nice to see a developer who had projects out there in the nebulous space of the internet marketplace give a candid look at the engine and relate their experiences.
MoaCube has some really gorgeous-looking games that I look forward to investigating more closely. The review article goes into some detail about the games they built with GameMaker.

So I went ahead and picked up the bundle with GameMaker in it. The way I figure, if nothing else, I can root through some code and have real, working games to compare with any tweaks I might make.

Of course, because there have been 60,000+ bundles sold, the company website, YoYoGames.com, is experiencing huge latency issues and ultimately needed to go offline for maintenance, so I can't actually comment on GameMaker because I have yet to get my hands on it.

Since this is the case, I'm going to truncate this post for now and come back to the subject of GameMaker later. It is not the only research I've done, and this particular research led me on another tangent of research, but I think that may be best tackled in a completely separate blog post. Plus, I have work to do and this post ended up long enough as it is.

Thursday, September 17, 2015

Interesting Articles, Episode 1

I think I could churn out more blog posts if I could figure out how to come up with decent titles for them.

So, I created a LinkedIn for shits and giggles. I'm not really sure I want to connect this blog with it just yet (for various reasons, including my frequent vulgarity and the fact that my username on Google+ is Silvaria), but it's there. And so far, the biggest benefit I have seen from it is the trending news articles that are sorted based on interest.

Maybe I haven't been looking in the right places, but this is the first time I've found a collection of articles detailing the current state of the Software Development industry in one place. It is really easy to access and I've already found a couple of articles that I've enjoyed reading.

Here's one from Wired that I thought was interesting, and had a few really nice expressions that I hope to remember as I learn more.

This paragraph was one of my favorites:

Mahdavi joined WhatsApp about two years ago, after the startup was up and running, and its approach to engineering was unlike any he had seen—in part because it used Erlang and a computer operating system called FreeBSD, but also because it strove to keep its operation so simple. “It was a completely different way of building a high-scale infrastructure,” he said on Monday. “It was an eye-opener to see the minimalistic approach to solving … just the problems that needed to be solved.”

I don't know much about Erlang or Haskell except for the very basic descriptions of the languages, and I liked that the article mentioned that simplicity has its own drawbacks. But, as with anything, becoming proficient with a tool means learning its strengths and weaknesses, learning what it can do well and what it can't do at all, and learning exactly how to take advantage of that knowledge to achieve your goals.

Tuesday, September 15, 2015

Questions I ask Google, Episode 2

Are error codes the same as exception handling?


Oh boy, I did not expect the can of worms I opened with this question.

First, no, they aren't the same thing. And apparently, the differences between them is a subject of heated debate.

I was directed to a somewhat illuminating StackOverflow question that shed some light on where a large amount of people stand on the issue. It didn't quite answer my question, but I was able to garner some information from the responses.

An Error Code is a failsafe that is written into a program to report when something has gone wrong. An action to solve the issue must then be taken.

An Exception contains far more information than an Error Code, storing the state of the program as it was when the exception was triggered, and continuing (if possible) via an exception handler.

The debate is far more favored towards using Exceptions over Error Codes, and whenever I saw people who used error codes or "used to use" error codes, they typically were coding in C. Go figure.

I think the most interesting thing I found while looking for more information was this, though. What is that? That is the Wikipedia article describing the maiden flight of the Ariane 5, a rocket that was airborne for 37 seconds before an exception caused a vital part of the flight system to shut off. There are more details in the article, and this link will take you to the Wikipedia page describing, in further detail, what exceptions are and how the IEEE 754 Floating Point hardware standard played such a major part of that crash.

EXCITE

I got it to work!!!!!!

All I had to do was change the variable being tested for zero value, and the location of the test!!! I had designed it one way at first, and then changed a few variables around and forgotten to change that one very important detail.

The more I think about it, the more this program is probably extremely hackish. The whole point of the project was to create a program that would take a whole, non-negative, non-zero number and repeat it back in reverse order.

In the book, my hint was to use a do loop to continuously divide the input by 10 until it reached 0. That was fine and all, but every time it divided by 10, it would give me answers like 9876, 987, 98, 9. If I only used modulo to get the remainder, I would consistently get the last digit.

So I started thinking: if I needed the last digit of each result of dividing the entry, why not use mod?

From this frame of thinking, I realize that I probably went the extra mile and made this more complex than it should be. Here is my first working program, though:

#include <stdio.h>

int main(int argc, char* argv[]) {

int entry, right_digit, left_digits, MOD, DIVISOR;
// these are named to reflect the position of the digit in the input

printf("Enter a whole, non-negative number with any amount of digits: ");
scanf("%d", &entry);

MOD = 10;
DIVISOR = 10;

// This takes care of the right-most digit, and prints it on the left

right_digit = entry % MOD;
printf("%d", right_digit);

// my hint is to use a do loop for the left digits

do {
MOD *= 10;
left_digits = entry;
left_digits %= MOD;
left_digits /= DIVISOR;
if (left_digits <= 0) {
break;
}
printf("%d", left_digits);
DIVISOR *= 10;
} while (left_digits > 0);

printf("\n");

return 0;

}

Skip past all of the printf/scanf nonsense that comes before the actual maths.

The right-most digit of the entry is taken care of first, because it needs to be printed on the far left if the number is to be reversed. Assume we use the number 5932 as our entry. The remainder of 5932 % 10 is 2. 2 is printed first.

Once that's done, we move into the do loop.

MOD starts out at 10 for the first calculation. The first part of the do loop multiplies MOD by 10.

left_digits is then assigned the value of entry. I worked with the original value through this because I couldn't figure out how else to do it (granted, I also couldn't figure out what was decrementing to 0 to give me a floating point exception).

left_digits is then divided by 100 and the remainder is stored back into left_digits. Assuming the original entry is 5932, for example, the remainder is 32.

left_digits is then divided by DIVISOR, which also begins at 10. Because it is an integer, and assuming we continue using the example above, left_digits is assigned the value of 3.

There is a conditional here to end the loop prematurely if left_digits is less than or equal to 0.

left_digits is printed. Continuing with the example entry above, the value printed here is 3. So far, our reversed number is: 23

DIVISOR is then multiplied by 10, making it 100.

Since left_digits is not 0, we loop again!

MOD is multiplied by 10 again and is now 1000.

left_digits is assigned the value of entry again because of the way this works. You'll see the pattern, just hang on.

left_digits is divided by MOD, which is 1000, and the remainder is assigned back into left_digits. Using the example above, the remainder would be 932.

left_digits is divided by DIVISOR, which is 100, and assigns the value to left_digits. Using our example, the value is now 9.

left_digits is printed, as long as it is not 0. So far in this loop, our reversed number is: 239

DIVISOR is multiplied by 10 again, making it 1000.

So, you see??? I got it to work!! Is there a better way to do it??? Probably!! But it does work, hahahaha.

I wonder when it will be that I look back at this little fragment and say, "What was I thinking??"

Oh, and I wonder if it's worth noting that I also hand-calculated the entire loop path to see exactly what it was doing, and that's exactly how I found out why I was getting a floating point exception error.

[untitled]

My code is either so incredibly clever that I can't figure out how to get it to work, or so incredibly hackish that I should start over from scratch.

Is this normal? Hahahaha.

Tuesday, September 8, 2015

OrlandoiX

Also, has anyone been to the OrlandoiX convention? Tickets are $35 for a weekend pass for October 3rd and 4th and I'm thinking of going. It seems like a really cool thing and something right up my alley for the goals I want to meet!

Here is the link to more info!

It's Almost 5 o'Clock...

....Which means I'm fiending for my commute home so I can work on other things.

Things that I need to do:


  1. I need to kick myself in the ass and stop using my shitty modem as an excuse to not work on my project. I have an Amazon Web Services server running a guild website for my GW2 guild (which has been painfully inactive lately). I should just load it up there and use that instance as a host.
  2. Once I'm done kicking myself in the ass, I need to break the damn code I've been pouring over so I can see what errors I can cause and, consequently, fix.
  3. I also need to continue working through the programming projects in the textbook I have (yes, that one written by K.N. King that I was working out of ages and ages ago). I post my progress on these on GitHub. I think I mentioned that last week sometime.

I was working on one project that had a do loop in it, but my logic was obviously flawed, as the loop fired infinitely. My biggest question about loops has to do with the variables... And I may post up a thought process about them so I can work out the details of how they work. I'm thinking once I have that down, loops will come much easier to me.

Also on my list: working out some actual form of balance and continuity for the project I'm working on. I have a lot of features that I want to add to the base code I have and not much in the way of structure for adding them. There are huge-scope projects, like a different login system, and not-so-huge-scope projects, like adding in a racial selection menu to character creation. Content is taking a seat on the back burner until I can get some other details in place, but I've already printed up some material that should help me with that once I can spare the time to work on it.


Now, if WoW would stop sucking up all my time, I'll be in good shape.... *starts chanting "I'm not addicted" softly, feverishly*

Thursday, September 3, 2015

Questions I ask Google, Episode 1

What is "foo"?


"The terms foobar (/ˈfuːbɑr/), fubar, or foo, bar, baz and qux (alternatively, quux) and sometimes norf and many others are sometimes used as placeholder names (also referred to as metasyntactic variables) in computer programming or computer-related documentation. They have been used to name entities such as variables, functions, and commands whose exact identity is unimportant and serve only to demonstrate a concept. The words themselves have no meaning in this usage. Foobar is sometimes used alone; foo, bar, and baz are sometimes used, when multiple entities are needed."

Wikipedia page source

Also, in the list of U.S. Government Military Acronyms:

FUBAR – Fucked Up Beyond All Recognition (or Repair)

How amusing!

Tuesday, September 1, 2015

This shirt though

NO, I DID NOT UPDATE MY BLOG JUST SO I COULD SHARE THIS SHIRT.

I don't know where you would get any such idea like that! ;)

Seriously though, it's amazing and I want it. Teespring will end the sale in 7 days though and it's the first of the month. :(

Click!


[untitled]


I think about this blog frequently. I think about the different directions I've pulled it in; about all the directions I've been pulled in, myself! I ought to be more regular here.

I ought to be more regular in studying the things I want to pursue, too. Here's the hard truth though... When you're not in high school or college, but in the school of the self, there is no grading scale to push you forward. There are only two states you can be: Are you where you want to be? Or aren't you?

For me, I laugh at programmer jokes because I understand them. But can I sit down and write a program? Well, maybe a really short one. It might be good for a couple of computations, but you'll have to use the console to run it. I have a hard time calling myself a "programmer" at this point.

If I had spent the last year or so working nonstop on programming languages, namely C, I'd be able to say a lot more for myself than that, I think. But this isn't a pity party. This is recognition of the truth. If I had worked harder, I would have made more progress.

I took a few detours here and there, and dabbled some in HTML/CSS. It was a good feeling to be able to build my company a website, and, in turn, host my own website for a guild I own in Guild Wars 2. I've been commissioned for a third website by my father's band. I won't say that my time learning HTML and CSS has been wasted. Even so, I'm not very good at it, and other web developers will make me feel stunted because I don't know Javascript or PHP. I started learning PHP too, but got overwhelmed with keeping these languages straight.

Now, after all this time, I'm back in the C seat. There are several reasons for this decision: I have an applicable chunk of code that is open for manipulation. Every time I make headway in a chapter of a book, I go look at this code to see how much more of it I understand. This is my way of quantifying my progress. Can I write a program? Not yet. But I can start making a little more sense of how this program is written and that is loads more than I could do before I worked through that chapter.

I keep my Github updated with recent programs I've written with the goal of working through each programming project at the end of a chapter. Some chapters have 8 projects, but lately they have had upwards of 12 - 15. It's slow going, especially when I have a wedding to plan, a full-time job to work, and all I want to do when I get home is mindless stuff. But when I write a program, it goes there. Find my Github at this link, or in my bookmarks page.

I also want to expand on that bookmarks page a bit more. As I learn things and teach myself how to do more things, I want this to turn into a resource for other people in the same boat I'm in. Those who want to learn how to do this stuff because of a calling or an interest, but don't know where to start. I was inclined to delete the posts I made that were off-topic from C, but I will leave them. It just goes to show how sometimes, distractions happen. And even if you look back at them with some regrets, you still have the experience to show for it.

I hope to be able to post things that are less dreary and more fun in the near future. Fingers crossed!!

Thursday, February 19, 2015

Update of sorts

I'm terrible at this regular blogging thing.

Then again, I have usually made a point to blog about progress or interesting things I find pertaining to coding or scripting, and not much of either of those things have been happening lately (much to my chagrin).

I did take a huge step forward this week when I finally tackled an AWS EC2 Instance. EC2 is Amazon Web Services' virtual server service that allows 750 hours of micro instance runtime per month for a year, and you can host on Linux or Windows. There are lots of other services that fall under the "free tier" of Amazon Web Services, so go check them out if you feel it may help you out.

Right now, I have a private server running a game called Starbound. I wasn't able to get it set up without lots of help, namely a step-by-step guide from a kind fellow on Youtube who made a 15min video about a year ago. Starbound has been updated since, so it wasn't a perfect guide, but I was able to get it figured out. It is now plugging along quite happily on my Ubuntu instance.

Possibly the most difficult part of working on this project has been getting used to the lack of a GUI. I'm not good at that yet. I need to practice more and get better, and that was part of the reason I shied away from exploring AWS as a viable hosting option for a private server. Something clicked the other day, though, and I realized that I was never going to get better at it if I didn't give it a shot. So I went for it.

Now, I'll be looking into getting a Ventrilo or Mumble server set up for using in Starbound or any of the MMOs I play (GW2, FFXIV, WoW, SWToR) in either the same instance or a separate one. It is so empowering that it costs nothing and I have 100% uptime. I no longer need to worry if my internet goes out at my apartment, or if my computer auto-updates and terminates my server in the process. My next project will be to figure out how to work FTP on the virtual machine, so I can backup the universe files on my Starbound server.

As far as programming things, I have still been all over the place. I had a disenheartening chat with someone recently who managed to stick that small doubt back into my head that wonders if I'm ever going to feel like programming comes naturally, or if I will always fight with the logic. One of my biggest fears is that I will come to find out that I have spent so much time learning all of these things, only to be a mediocre programmer at best. I can handle being mediocre while I'm still learning; but to think that I'd be terrible at it no matter what I do is a hard feeling to beat.

Regardless, I'm plugging along with a Python class that is followed immediately by a C class. These are internet classes that are hosted by a kind person who believes in making programming easier for people to understand. His site, Learn Python the Hard Way, has helped me immensely. He encourages good study and research habits, points out tips and tricks along the way, and if you give him a little money, he offers personal 1-on-1 assistance via e-mail. I'm a big fan. ;)

Outside of that, I have been busy writing down ideas and plotlines for a major project. That keeps me busy when I'm not playing games or working. Maybe sometime soon, I'll be able to sit and hammer out more programming stuff. I also want to get a personal website up and running for myself, but that is pretty far down on the list of priorities. We'll see if it happens.