Skip to content

Instantly share code, notes, and snippets.

View ajweeks's full-sized avatar

AJ Weeks ajweeks

View GitHub Profile
@ajweeks
ajweeks / dvmbr_20.md
Last active January 31, 2016 15:54
Twentieth of Devember

Devember Day 20

Another good day of work on TM495, there is now (at least the ability for) animation, and sounds!

Here's how I implemented sound:

@ajweeks
ajweeks / dvmbr_19.md
Last active January 31, 2016 15:54
Nineteenth of Devember

Devember Day 19

I got a bit more work done on TM495 today, including adding a ground plane texture, bounds checking at the edges of the level, and extremely basic collision detection with trees. The latter needs a lot of work before I'd say I'm happy with it. It's currently just about the simplest thing you can do, where if the player attempts to walk into a tree, their position gets set to its previous value. This results in a very rough movement system, causing the player to stop when strafing near trees, and feel like they're getting stuck in trees. But for now, it'll do. I all too often fall into the trap of trying to polish a specific feature and inevitably end up losing motivation to finish the project.

I then added the ability to cut trees down, by pressing the 'c' key when inside a certain radius around a tree. Chopping down a tree is currently instant, and the trunk doesn't render correctly. Plus it does care what direction you're facing. However, all of those issues will be fixed soon enough.

!

@ajweeks
ajweeks / dvmbr_18.md
Last active January 31, 2016 15:54
Devember Eighteenth

Devember Day 18

I finished off my programming assignment today, after which I spent some time getting TM495 back up and running.

Here is the result of the last part of the programming assignment I had to do this week.

You can move the conductor around the screen using the arrow keys and the spotlights follow him, if they're turned on. It's a pretty simple program; each spotlight stores its position, a target position (the conductor's position), and a boolean storing if the light is on. Plus a few helper functions, that's the majority of the project.

@ajweeks
ajweeks / dvmbr_17.md
Last active January 31, 2016 15:54
Seventeenth of Devember

Devember Day 17

Today I spent some time looking into WebGL again, this time using three.js. Using that greatly simplifies the amount of code required to get something up on the screen, and I think I will be using it for the foreseeable future for TM495.

So far I haven't gotten any real game objects rendering, I'm still thinking about out how I'll go about implementing that. I'm thinking it would be easiest to give each object a member variable that refers to its respective THREE.Mesh object and uses that mesh to store its position. There are other methods, but I think that is what I will go with, at least on the first attempt.

So far I have one plane and one sphere object being rendered, and basic camera control using keyboard inputs. In the actual game, the keyboard will influence the player's position (the position of its mesh), which the camera will somehow follow.

Top view:

@ajweeks
ajweeks / dvmbr_16.md
Last active January 31, 2016 15:54
Devember Sixteenth

Devember Day 16

We're officially past the half way mark of Devember! I spent around 2 hours today working on my programming assignments in class. This week we are covering "classes" once again. The first assignment is a simple bouncing ball demo type thing, like the one I showed on day 7, but this time using sprites. A ball is happy if it is the highest ball on the screen, it is scared if it is close to the edge of the screen, and if it is clicked on then it falls asleep - or wakes up. Otherwise, it has a neutral face. You can control how quickly they move around using the arrow keys.

The second assignment I worked on was a sort of color picker type thing. You can set the RGB values using three instances of a Slider class, and the size of a rectangle using a fourth instance. There is a tooltip shown when you hover over any slider that tells you some info. It uses a quite strange system, where the left mouse button selects the minim

@ajweeks
ajweeks / dvmbr_15.md
Last active January 31, 2016 15:54
Fifteenth of Devember

Devember Day 15

Today was one of the least interesting days of Devember I've had so far. I spent a long time reading more of that WebGL tutorial I mentioned in yesterday's post, with not much luck and lots of frustration. I think part of this frustration was simply because WebGL is complicated as hell and it's very easy to mistype a variable name (especially when you're using javascript). I started off using typescript, but it seemed like it would be a bit easier to just follow the tutorial exactly for now, and figure out how to get it all working in TS later. Another part of my frustration came as a fault of the author, who - more than once - didn't mention a helper method that he wrote in between steps that was absolutely necessary to compile without errors. The only way I could figure out why his code worked and mine didn't, was to read over his entire source file. So if you saw that tutorial I linked in yesterday's log and bookmarked it to read later, I'd strongly recommend deleting it now.

I did sp

@ajweeks
ajweeks / dvmbr_14.md
Last active January 31, 2016 15:54
Fourteenth of Devember

Devember Day 14

It's weird to think that I've put in over 14 hours of programming in over the last 14 days. I think if it weren't for Devember, I would probably have done only half of that. Today I spent about 35 min making a Sprite class in programming class.

The code is pretty basic, it just loads a sprite into a Bitmap member variable, and has a one line paint method which just calls the game engine's bitmap paint method.

I also spent another ~30 min learning about WebGL. Mozilla has a really good article about the topic, you can find here. EDIT: I'd strongly recommend against using this tutorial as I later have learned that it ends up being quite confusing and poorly written. Find a different tutorial. I haven't learned enough about it yet to even start to think about how to implement it in TM495, but I will try to spend some time looking at it so

@ajweeks
ajweeks / dvmbr_13.md
Last active January 31, 2016 15:54
Devember Thirteenth

Devember Day 13

Got some more work done on TM495 today, nothing too substantial. You can see the commit here. I added a tree sprite, and started to think about how I want collision detection to work. Also I am wondering how I should go about rendering now that certain things need to render above other things. I've wanted to learn WebGL/OpenGL for a long time and I'm strongly considering using it for this. I'm not sure if it's better to get a working version done first, then port to WebGL, or if I should switch now, while the codebase is small-ish (who am I kidding, it's miniscule - 616 lines of typescript & 121 lines in html).

I'll probably end up switching now, just because I have the motivation for it, and the excuse for it as well (with devember and all).

Here's how TM495 is looking so far. The art is pretty basic of course, and animations haven't been added yet. That will be interesting for me since I have never actuall

@ajweeks
ajweeks / dvmbr_12.md
Last active January 31, 2016 15:54
Twelfth of Devember

Devember Day 12

Finally finished off my programming assignment for the week. We had to create a little winter scene, with Koch snowflakes gently falling down (using a sine wave). That only took me half an hour though, so after that I put some time into TM495. And guess what! I actually figured out the camera offset. I think I was kind of stuck in the wrong mindset earlier and taking a break from it for a few days helped me find the solution. As promised, I will put the camera offset code up with this log entry, although it is quite simple.

Ludum Dare 34 is currently underway. I'd really like to participate, and it's one of the first LDs where I've felt like my gamedev skills are actually good enough to make something noteworthy, but I have too much homework to justify spending all weekend programming. The themes "Growing" and "Two button controls" are pretty good, I can think of a few things which I'd probably be able to make that might be k

@ajweeks
ajweeks / dvmbr_11.md
Last active January 31, 2016 15:54
Eleventh of Devember

Devember Day 11

I spent about an hour today watching some more Handmade Hero. It was a Friday livestream, during which Casey mostly just reviews the code that was written that week, which I honestly find very useful. There isn't much I can show for that here though. Casey spent a while describing how pointer aliasing works in C++, and answered various other questions over the ~1 hour Q&A section of the video.

I kind of felt like I was cheating Devember a bit by only watching a video, so I also spent some time working on my programming school assignment. More uses of classes, this time a MovingCircle class, a Pentagram class, and a Sprite class (finally something I can see myself actually using in the future). Screenshot of the final result shown below. I didn't create either of the animations by the way.

So anyways, that's all for today, I ended up actually getting a good two hours or so of programming done today, which I feel good about. See you tomorrow!