4 Hugues Ross - Blog: This will in no way end badly
Hugues Ross
Showing posts with label This will in no way end badly. Show all posts
Showing posts with label This will in no way end badly. Show all posts

6/11/19

Back to the Maze - 1 - TERROR AND MADNESS

I think it's about time for another video game. In the spirit of last year's Cloudy Climb remake, why not take another of my old games out for a spin? Why not, say, AMAZE?

What could go wrong?

And So It Began

It all started innocently enough: A certain art community that I'm in announced an activity about re-drawing an old piece of work. Just for fun, I thought I'd grab a screenshot of AMAZE and make a mockup in my style. However, AMAZE doesn't really work anymore. The Linux build compiles, but the old renderer doesn't, err, render.

The Windows build fared a little better in Wine, but crashes frequently. I can't really blame Wine for this, I'm not entirely convinced that the game is crash-free under normal circumstances...

Foolishly, I began to think: "Man, I wonder what that drawing code looks like? Maybe it's a simple issue, I'll bump up the OpenGL version and we'll be all set."

As it turns out, the game is running OpenGL 2.1's fixed-function pipeline. For the unaware, OpenGL 2.1 is roughly 13 years old at this point, which is very interesting considering that AMAZE is only 5.

Delving Deeper

So, ok, maybe the rendering code is unsalvageable. You win some, you lose some. However, I thought it might be fun to poke around the rest of the codebase and see how I used to write code.

After all, why not take a fine trip down memory lane?
   23 class Game{
   24  public:
   25   Game();
   26   void loadspr(string s){Sprite spr = spriteLoader.load(s); sprites.insert(pair<string, Sprite>(spr.id, spr));}
   27   Sprite* get_sprite(string s){return &(sprites[s]);}
   28   void frameStep();
   29   void gameLoop();
   30   void end();
   31   bool get_keydown(byte key){return keys[key];}
   32   MapLoader* get_map(){return &maploader;}
   33   float camera_x = 0;
   34   bool camera_xlock = false;
   35   float camera_y = 0;
   36   bool camera_ylock = false;
   37   float camera_xscale = 1;
   38   float camera_yscale = 1;
   39   void drawText(float xpos, float ypos, SpriteFont f, string text);
   40   unsigned score = 0, level_score = 0, hub_score = 0;
   41   unsigned equipment = 0;
   42   float equipment_percentage = 0;
   43   unsigned lives = 3;
   44   unsigned max_lives = 3;
   45   unsigned hub_max_lives = 3;
   46   game_states gamestate = SPLASH;
   47   float splash_alpha = -1;
   48   float splash_timer = 30;
   49   string disptext = "";
   50   vector<c_CResponse*> active_scripts;
   51   vector<int> script_positions;
   52   vector<int> script_timers;
   53   vector<pair<int, int>> script_args;
   54   void updateScript(c_CResponse* script, int& position, int& timer, pair<int, int> arg);
   55   ScriptLoader scripts;
   56   unsigned disptxttimer = 0;
   57   bool keys[5] = {false, false, false, false, false};
   58   int menu_select = 0;
   59   string hub_level = "Z1-Beginning.rma";
   60   string hub_tileset = "Tutorial_tiles.tla";
   61   string hub_song = "/TitleMusic.ogg";
   62   string current_song = "/TitleMusic.ogg";
   63   int hub_progress = 0;
   64   map<string, ALLEGRO_SAMPLE*> sounds;
   65   bool scripts_run = true;
   66   bool game_running = false;
   67   MapLoader maploader;
   68   int triggers[10] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
   69   string var(string input);
   70   void alter(string key, string val);
   71   bool compare(string key, string val, char op);
   72   float sound_volume = 1.0f;
   73   bool godmode = false;
   74   void writeSave();
   75   bool dead = false;
   76   bool shield = true;
   77   int dcooldown = 60;
   78   int difficulty = 0; //0: easy, 1: med, 2: hard
   79  private:
   80   Sprite* s;
  ... 
  105 };
  106 #endif
oh no.

Some of you may be wondering to yourselves: "Strange, what's that 'Sprite* s' for?"
ABSOLUTELY NOTHING


Next Time: Busting out the hacksaw

9/24/17

Update: Thinking About the Future, and Looking to the Past

Thanks to my shoulder, I've had a lot of time to think lately. I'm not very happy with the work that I've produced over the years, and I think that something fundamental needs to change. If you don't care too much about the specifics, you can scroll to the last heading for a quick summary of what I plan to do.

...Still here? Alright. Let's look back over the past 5 years.


In the beginning...

In late 2012, I was an eager and bright-eyed lad who was ready to try out this whole blogging thing. I was primarily inspired by the work of Shamus Young, whose blog I'd been following for a few years. To some degree, I think it shows:

"Shamus wrote some really great D&D stories, I should document the D&D campaign that I'm playing now!"
"Shamus wrote about some cool programming projects. I should do cool programming projects and write about them!"
"Shamus has a webcomic. I should do art stuff!"

He wasn't the only influence, but certainly the strongest. I also remember seeing video creators on Youtube and webcomic artists putting out work several times a week. For that reason, I created this ridiculous daily posting schedule. One thing that I failed to consider was that these individuals did nothing but make what they were posting. Indeed, for many of them this was their job, and I've heard that many such creators work well over 40 hours a week to keep such schedules. This plan of mine was doomed from the start, because I chose to try and mimic people who were quite different from me.

Alas, looking at work made by someone else and thinking that it's cool doesn't always help your own work. I couldn't simply copy Shamus's work, so the blog spent a long time being updated intermittently, with occasional apologies and failed promises.


Good projects, and AMAZE-ingly bad decisions

Around early to mid 2013, I started one of the projects that would last throughout this blog's life: Singularity. I started it with no plan, merely creating it out of necessity. Despite that, I could argue that it's also my most successful project: I created something just for myself, with no expectations, and ended up with something nice. Keep these italicized sentences in mind, they'll be important later.

Singularity is not all that I started then, either. During the summer, I also started AMAZE and the "Games I Play" series. The latter was about as doomed as my first schedule, and here's why:

I still remember how the concept of "Games I Play" was conceived. I had the problem of having too many untouched games in my Steam library, and no time to actually play them. Why was there no time? Well, I had to work on projects and post about them online! In other words...
  1. The Problem: No time to play games, because I had to work and blog.
  2. The Solution: Make games part of the work and blogging.
Seems pretty damn stupid in hindsight, huh? But hey, "Shamus Young writes about the games he plays, I should do that!" Here we have a time commitment issue, and a response that worsens the true problem in an effort to be someone else.

Now, let's talk about my darling AMAZE. Despite how much I hate the final product, AMAZE was ok as a subject. I posted screenshots, and wrote regularly about the things I was interested in! However, there's an interesting trend hidden in the AMAZE posts. As I became less interested and more "serious" to hit deadlines that I'd set, my blog posts went from this to this. Excitement and screenshots gave way to changelogs and walls of text. Once again, these two projects demonstrate a simple fact: I produce the best content when I'm excited and engaged with it, not when I feel obliged to make it. Obvious, I know. But let's move on, there's more to cover.


Total overkill

I'm skipping Space Douchebag because the same conclusions can be drawn from it as from AMAZE. Instead, we now fast-forward to 2014, DFEngine, and Akradion. Technically, DFEngine began with AMAZE, but this point is when I really got serious about it. As I've elaborated before, the concept of DFEngine was flawed. Trying to make a full-blown game engine because I'm too slow to iterate is like trying to build the LHC because there's a mosquito in your room: Not only is it a glorious waste of time, it also makes absolutely no sense. I still believe that DFGame will be a better bet in the long run, as it's mostly just a way to skip writing boilerplate code.

So, what about Akradion and Cloudy Climb? Besides being the first projects made after a DFGame version, they have one other thing in common. Rather than being games that I dreamed of and was excited for, they were instead an attempt to prove something. Ultimately, both games suffered dearly because of that. My line of reasoning when making these games went a little like this:
  1. If I'm making a game engine, it obviously needs a physics engine. That's a thing that game engines have.
  2. I need to make a game to prove that this game engine idea works
  3. My game engine has physics, so I need to make a game with physics to prove that the physics engine works.
 That set of thoughts above has many problems. Let's dissect them a little:
  1. My games have always been simple and 2D. Obviously I didn't need a physics engine, I had never used one before!
  2. As it turns out, making a full-length game just to be sure that some tech works is a huge waste of time. I keep doing it too, it's a bad habit. This is why I forced myself to keep the demos I'm making for dfgame as small and simple as possible.
  3. Neither Akradion nor Cloudy Climb are actually good choices for testing a physics engine! Seriously! Akradion is a game that relies on an object that retains constant velocity at all times, a worst-case scenario for physics! Cloudy Climb only really makes use of gravity, so a big physics engine is totally unnecessary.
In other words, a project that started as a supposed time-saving measure wandered off course in an attempt to make a fancy game engine. It then split into more projects, which were doomed from the start because I'm a bad planner. Ultimately, DFEngine was about a one and a half year-long diversion from what I cared about. I'm actually ok with most of that, since trying out things that interest me is fun. However, looking at the posts you can see the usual changelog post structure from AMAZE take over after a while.


Why teach?

Next, let's discuss tutorials. The roguelike tutorial series that has been in progress for years has never really reached a point where I was happy with it. So why did I start it? For that matter, why am I still writing it? Let's discuss.

I spent many years learning to program and make games. I actually started all of this back in middle school with Game Maker, only transitioning to more "professional" tools once I started college. Throughout my life (even now, in fact), I've regularly referred to guides and tutorials in order to learn various tricks and techniques. For much of that time, I felt a desire to give back with tutorials of my own once I got good at my craft.

Unlike the many of the blog-related decisions I've made, the decision to write tutorials in general had decent reasoning behind it. Furthermore, I think it'll work out eventually. So, why was the roguelike tutorial a failure for me?

At the time, I wanted to make an ASCII strategy game of sorts. When I returned to the project, I had a cool roguelike idea that I wanted to make. I don't think that's a coincidence. Rather than simply make the games that I wanted to, I found an excuse to try and work on something similar, via tutorials. Rather than just doing what I wanted, I invented a new series of posts to 'legitimize' my desire as an extension of my blog. It's no wonder then that the tutorial was never well thought-out or exciting to me. I wanted to do something else the whole time! Compare the forced and lackluster entries that I've been putting out lately to something like this post, and you'll see a world of differences.


Unfortunate truths

Ok, I think that's enough tiptoeing around the subject. What do all of these events point to? What's my point writing this? Well, it's really quite simple:

By forcing myself to only do "blog-worthy" things, and acting beholden to a theoretical reading audience, I'm harming both my blog's quality and my own life.
That's a conclusion that's taken about 2 months to reach. The one thread that ties many of my threads together is an attempt to emulate the content creators that I like. I envision myself as them, and imagine that I have an audience the same size that they do. Often, I make decisions based off of this. It's why I feel an urge to apologize at every delay and schedule change. It's the true reason why I just can't leave a series that I don't enjoy alone. To some degree, it also stops me from making progress. Every month, I spend:
  • ~1 week preparing, recording, and editing an update video
  • ~1-2 weeks writing a new segment of the roguelike tutorial
  • 2-4 days writing some other post
That leaves me with only a week or two to actually work on DFGame. It also keeps me from trying out new ideas and iterating. I've had a lot of really cool project ideas since I started work, and I've had no choice but to put them off until "after DFGame".

Except, that's not true at all. I have a choice to stop and do what I want, whenever I want. The only thing that stops me is my schedule. The only reason I have a schedule is to guarantee regular content on my blog. And why do I need to guarantee that? See Above.


The almighty power of boredom

Let me tell you a little story:

About a year ago, I had a cool game idea. The game in question would involve some fairly heavy adult content, so it wasn't "blog-worthy" at all. At the time, I was still adjusting to life in Montreal and figuring out post-immigration stuff. I also had a few issues in my life that put me in a bad position for a while, and I wasn't sure if I could keep writing the blog due to my job.

Since I didn't want to work on my blog, I worked on the game. In just a few scant months, I wrote an entire engine from scratch, complete with a data-driven dynamic UI system. I started writing down ideas, building roadmaps for development, drawing first-draft animated sprites for characters, etc. Then, I got the greenlight to blog again and I haven't touched the project since!

Flowcharts tracking development progress.
The bottom red circle was a public demo release.
So close, yet so far...


You see, I've written in the past about how blogging with a schedule keeps me productive and how vital it is, but at the end of the day you can lock me in a room for 3 months with no blog and I'll still write yet another game engine. Development is what I do. It comes naturally, and trying to keep to a rigid schedule or only focus on one thing for a long time doesn't help.


If you're scrolling past the wall of text, you can stop now

Ok! That's it! No more long-winded storytelling! It's time to talk about how I'm going to fix this problem. I'm going to keep this short and sweet, you just read the whole story so you don't need much more:

  • Effective immediately, I am cancelling the roguelike series. No hiatus. It's over, it was a bad idea, and I can always revisit the subject when I'm older and wiser. I'll leave the text around for now.
  • Starting next year, no more schedules and no more promises. I'll write when I feel the urge, and I'll develop whatever I damn well please. There will be fewer posts. I guarantee it. But every single one of them will be carefully written and edited for maximum quality.
  • When that happens, I'll finally redirect the huguesross.net domain to my site's landing page. That page and the about me page have been redesigned, and I'm working on the tutorials section. That section will hold both longer tutorial series and any informative posts that I think are useful and good enough to share.
If I change my mind about all of this, I may still keep the schedule. It's possible that I'm just in a rut, or mildly burnt-out. I'm giving myself 3 months to reconsider this decision, to ensure that it's really the right way to go. At the end of the day, I don't want to drop the blog. I think keeping a blog that shows your process of working and shares your knowledge is awesome, but I need to remember that blog posts should not be my biggest source of work.

This is a blog about programming, not time management. (except here, I guess)

7/13/16

Listening to Your Javascript

It's been a while, but I haven't been idle. I've made a great amount of progress on Singularity, and I've finally discovered a secret that has eluded me for years!

The Problem

These stories always have to start with a problem. In this case, the problem was a seemingly simple one:

"When the user interacts with Singularity's WebKitGTK viewport, how do I make the app react to it?"

This used to be really easy, back in the days of Webkit 1. However, when Webkit2 changed the API and moved some functionality to it's web extension API, Javascript support followed suit. For a long time, the only solution was to simply create an 'extension' that used some form of IPC to communicate with the main app, but I didn't want to do that in Singularity. Instead, I used a crude hack by encoding messages in URL requests.

A Tentative Solution

Needless to say, this solution is slow and terrible, but I've found a better answer. At some point since my work on Singularity started, WebKit introduced the UserContentManager, which can apply custom CSS and Javascript to web pages. This is a really awesome feature that I plan on using in future projects, but it also provides me with a new tool, a signal for handling certain Javascript calls. According to valadoc.org:

public signal void script_message_received (JavascriptResult js_result)
"This signal is emitted when JavaScript in a web view calls
window.webkit.messageHandlers.name.postMessage()
after registering name using register_script_message_handler"

In other words, it lets you set up a callback that is called whenever a script calls a certain function, sending arbitrary data from the web page to the application displaying it. This is a really powerful feature.

So powerful, in fact, that you can't actually use it in Vala.

What Gives?

As it turns out, Vala's JavascriptResult class has no useful functions or properties. I'm not entirely certain why, given the solution that I'm about to provide.

While WebKitGTK's JavascriptResult does contain the necessary functions, no Vala bindings exist for them. Instead, you need to access them from C and return whatever result your app is expecting. This seems really odd, and I hope I don't have to find out the hard way later on, but for now I'm feeling pretty good about this.

I'll be posting an update with a more thorough rundown of my work on Singularity soon.

7/22/15

A Look Back

With my recent string of posts nearing its end, I think it's time for the big one.
Over the past 3 years, I've managed to accumulate almost 200 posts, and almost 10,000 views. That's just a drop in the bucket, but it still makes me happy. When I first started this blog, I expected just about 0 visitors, maybe just one or two per month who randomly stumbled in. Even if I still don't have much of a well-established audience, and most of my readers are likely just web spiders and bots, it still feels good to know that someone out there is reading this.

Following that, I should probably reiterate that comments are very welcome! I always love to read feedback, positive or negative. Indeed, it's especially important to comment if you run into any issues with my work. I can't fix problems if I don't know they exist, after all. In addition, if you see anything that you don't understand, or you just want me to write about a specific topic, I'd be happy to oblige.

Now then, I think it's time for the main event, the real reason I'm writing this post. Over the lifetime of this blog, I've started many game projects, and finished exactly one of them (not counting game jams and schoolwork). I think that number needs to  change. I've long had a habit of not finishing what I start, and while I haven't forgotten these projects I also haven't worked on any of them in a long time. Thus, I'm saying it now: My goal for this next year is to revisit and finish as many old projects as I can, and use them to spruce up my little portfolio.

2/23/15

The Definition of Insanity

According to most people, the definition of insanity is doing the same thing over and over, expecting different results. As you may may know from visiting this blog, that is also my general strategy in many cases. Rather than linger on what that means for my mental health, let's talk about the 1 game a month challenge.

I first tried it out last August, but ran out of ideas and stopped. Singularity probably also had something to do with that. Since then, I had forgotten all about it entirely. I think it's high time to revisit it, but this time with a plan.

9/7/13

No Post

So I didn't post yesterday, breaking my schedule for the first time since it began. I have a pretty good reason, though. After a Windows update, the wifi card stopped working on my Linux install for some reason. I then tried booting into Windows, which immediately bluescreened. Running startup repair seems to have fixed most of my problems, but my wifi still occasionally dies for some reason. Also, some of my icons changed somewhere along the line.


Needless to say, I was busy last night. I've also been mostly working on school stuff this week, so I may post about that later to compensate.

EDIT: As of yesterday, I think I've sorted everything out. Regular posting will return on Friday.

8/15/13

A wild schedule appeared!

Remember last time I made a schedule? Here, have a refresher, with commentary:

"I've recently been posting to this blog almost every day, and I think now would be a good time to make a proper schedule for posting. Right now, my objective is to post daily when possible, although I might not have time to do that this weekend. I'm moving into my dorm at Champlain today, and I have to attend the various orientation activities on Saturday and Sunday. That said, you can find my plan for posting after the jump:"
No, Really
Oh god, if only he knew... Typical freshman. Not that I'm much better now. For the record, Orientation sucked. I cannot understand how such a sweet college could fuck this up so badly by just throwing assemblies everywhere. What is this, grade school? Anyway, at the time I had 1 (comparatively simple) game project, no classes or obligations, and nothing to do. Now, I have so many game projects I don't even count 'em anymore. AMAZE has received so many rewrites that the old code folder contains an older code folder. That's a sure sign that you've been busy. Also, I'm still not sure whether I should use jump breaks. I'm leaning towards no, but I feels like I have to for some odd reason. Ok, from now on I'll follow this rule: No jump breaks. Sound good? Good.

"1. Sketchbooks - I'll be putting a new sketchbook post up every Wednesday, preferably during the morning. They're just going to be quick sketches based on a theme. I put the first one up yesterday, but I drew it the Wednesday before. I'd love to see comments on these posts, especially constructive ones. They exist so that I can practice drawing regularly."
I think I made.....1 sketchbook post before saying fuck this and stopping forever. I might draw some more once in a while, but nothing like this. As for comments, I got a comment. A single one. Once. If you're out there, fabled readers, do comment! Yes, even if you're a web spider. I have high standards for automated processes, you know.

"2. Programming - Despite working on a couple little games, I haven't posted about any of my programming/game making projects yet. I'll post about any progress on those every Saturday."
Wait, a couple? What? As in, more than 1? Weird, I need to reread my old posts now... 


...No, no talk of that fabled 2nd project. In fact, I posted about the 1st after this went up, as I'd mentioned. Yeah, I have no idea what old me was talking about. That 'pics or it didn't happen' thing seems pretty cool though. I still need to give it a go sometime.

"3. D&D Recaps - I'm part of a small Dungeons and Dragons group that meets every other week. I'd like to post short recaps of what happened on Sundays, but I'll have to talk to my DM first."
Alas, that fabled conversation never occurred. Either I'd forget, or I wouldn't get a chance to ask. At this point, I don't always make it to games anyway. If someone else were to write some recaps, though, I'd put them up. I may ask about something like that.

"4. 3D Stuff - Last year I did quite a few basic 3d renders/animation with Blender. I haven't done any of that all summer, but I'd love to start anew. Every Monday, I'll try to put up some sort of progress on a Blender project. In the future, numbers 2 and 4 may coincide. Now wouldn't that be nice?"
That would be nice, and it'll happen eventually. I was using Blender all the time before college, but I've replaced that completely with programming. Still, I do want to try making some 3d games sometime.

"5. On Tuesdays, Thursdays, Fridays, and some Sundays, I'll put up whatever I feel like posting. This could be one of the things I've listed above, or it could be something totally different. We'll see."
HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA
No. 
Was I some sort of masochist back then, or was I really that naive? "So I'll post all of this stuff on these 4 days, and-Oh yeah let's just post on all of the others too. No problem." I can't post twice a week on vacations, much less every single day! 

"I'll put up a page with my schedule later. I've been considering Let's Play-ing some indie games at some point. If so, I'll probably put those videos up here along with some post editing commentary."
Wait..... Did I really consider becoming a LPer for even one second? I've got a terrible voice, not too much to say, and a laptop that can't even record my own games properly(Which is why no other gameplay videos are up yet. They don't seem to record well. I'll pester a friend to borrow their computer sometime, or something.)  As for the schedule page, I eventually deleted it in disgust.


So. As you can undoubtedly see, that went rather well. Let's do it again, shall we?
I'll even use the same format! After the not-jump, of course:
  1. Programming - Fridays. I have Friday off for this semester, and Friday is D&D night so I plan to keep them light. This'll give me all day to procrastinate, and 1 hour to desperately throw something together. 
  2. Games I Play - Mondays. This way, I'll have the entire weekend to check out the game in question, as well as write my impressions. This does mean that I'm missing it again this week, which sucks. I will post another AMAZE update tomorrow though, and it will have pictures, even if they have to be unrelated ones(they won't.)
  3. Sprites - Apparently, I haven't been posting sprites often enough. I believe I said it was going to be once a month, but that doesn't seem to have worked out. I'm not going to make an effort to do more spriting, but on the off chance that I make/edit some sprites they'll appear on Sundays.
  4. Everything Else - I wouldn't mind posting about my daily life here. In fact, there are a few other things that I'd like to post about. They will be sporadic, If I even choose to post about them. I will be sure to only ever post them on Whenevertheheckiwantday.
So, here's to hopefully not failing! This was super fun, so I might start tearing apart old posts here and there. I won't post the schedule for at least a month, so that I know for sure that I'm following it.