Friday, March 23, 2012

Learning, Coding, and Bugs (wash & repeat)

Alright, so a couple of new things.

Since I am learning Lua and LOVE at the same time, progress on the game itself has been very slow. Before I can make things like the physics, terrain generation, collision, weapons, players, etc. I need to know how to actual program them without the code blowing up my computer, so I am starting small with my test programs. So far, I have managed to get a simple pong physics program working. There are two balls that have different velocities. For one, if it collides with the edges of the screen it bounces. For the other, when it reaches the edge of the screen it is teleported on the opposite side of the axis it is on. In other words if it travels off screen from the right side, it will teleport to the left side and continue it's trajectory. It sounds simple, but for the first attempt at writing a physics program they both were challenging for me.

While running it, I came across my first bug! I did not think to set the equal sign (=) when I was checking for collision with the ball and the edge of the screen. I only used the greater than or less (< and >) than symbols. This resulted in the balls bouncing correctly up until around 30 seconds into runtime when one of the balls was equal to the exact location at the edge of the screen. The collision check I wrote was bypassed, and the ball continued traveling beyond the screen boundary into the void of nothingness.

So now I'm past that and moved on to playing with collision boxes (or collision squares/rectangles) for two separate objects with widths and heights. Luckily, it took less time to figure out. The next thing I will have to do is adjust the collision check to use angles for the tiles of ships and players. (which looks confusing...*gulp*)

The pong program was the main thing I've devoted my time to, but I have been working on other stuff too. Drawing a few graphics for the game, made a basic chat program that displays text typed by the player, and playing around with some trig functions (that I barely understand) to fire projectiles.

While at my jobs, I continue to brainstorm ideas for how Void Nexus will work. I feel like I have how 40%-60% of the main mechanics will function for the game and the rest are beyond my prediction capability. It's like pondering a chess move and where it will lead to. You can predict the first few moves with ease but as you try to go beyond that, it becomes harder to see where the other moves will lead to because of the vast possibilities. That is where some of the other mechanics for the game are at, I can't envision until the other stuff plays out. Although, what I have decided on and thought of currently has HUGE potential, and I'm confident that it can all be done. (it's just going to take time)

I'm going to post the pong and chat program I wrote below for anyone interested.

Pong Program -
Chat Program -

(To Noob Programmers - I'm sorry I didn't write comments explaining stuff)

Time Invested on Void Nexus Past Week = ~15 Hours
(it feels like 70% of it is devoted to learning Lua though)
Total Time Invested = ~55 Hours

No comments:

Post a Comment