Sunday, February 26, 2017

Landing on the Moon

Hello again, this week I bring you, jLander! A game where you must successfully land a lunar module on the moon. Careful, you have limited fuel and every input needs it! You get points by landing on a zone (smaller = more) and having extra fuel remaining. Landing zones are highlighted green. Landing empty means you won't be able to return to orbit.

I am going to stop bundling a runtime environment to keep download size smaller. If you are having trouble getting the app to work, be sure and download the latest version of Java here.

As usual I made jLander with the help of JMonkeyEngine LemurGui, Zay-Es, and this week I used dyn4j for the physics.

The hardest thing about jLander was setting the proper win or lose states. Turns out theres alot of different ways to win or lose, and I most likely missed a couple! For those who are curious, you are considered landed when: The lander is in contact with the terrain, the lander is pointed +-3 degrees from straight up, the lander is not applying thrust, the lander is not out of fuel and finally, when the lander has not moved more than 0.4 world units for a total of one second.

A short review for dyn4j. It took me the better part of 2 days to be fully comfortable with how dyn4j operates. Now that I am familiar I believe it will be easier for me to implement the engine and its features in the future. That said, the documentation is rather lacking. I gather that for the most part dyn4j is intended to be freely integrated how the user sees fit. This has positives and negatives but I believe I will attempt to use the library in future projects where it makes sense.

There is a known glitch where if you crash while applying thrust the particle effect continues to play. I could probably iron this bug out, but particles were one of the last things I implemented and I'm honestly feeling done with the game as it is now. Sorry :p

Download link:
https://drive.google.com/open?id=0Bz4nByoX2Ks7S2ZKRlRaNUJBLWM

Monday, February 20, 2017

jSnake!

This weekend I finished another game, this time a Snake game. As far as gameplay goes it's a very basic snake game, there's only 1 objective and that's to eat as many coins as you can without eating yourself or a wall. Arrow keys or WASD for controls, M toggles the music on and off and Enter will reset you when you die. There is a secret way to make the game go faster, which also awards you more points every time you eat a coin ;)

As far as the technical side of things the game itself was actually super simple. I made it in jMonkey again, with zay-es and lemur gui like last time. The game itself is actually just a grid of numbers with each number representing either empty space, a wall, a coin or a part of the dragon. Every time the game world updates it advances the head of the dragon by the currently chosen direction (just hold the direction you wanna go) and it will remove the tail, all the other numbers stay the same. If a coin is eaten it doesn't remove the tail this round, so it will grow.

The hardest part was getting the game to be visualized in 3d. I accomplished this by breaking my map down into several parts.

First, the Dragon (or snake as it's usually referred to internally) is a list of coordinates which are written to the map every time it updates. This list is ordered so I always know where the head and tail are, and I can keep tabs on each part of the body. The head and tail always exist and they just update their positions, a new body needs to be created every time the coin is eaten though. At first I thought the entity component system would make this hard, but in practice it made it super easy to update the body without much work.

The coin is rather simple. The 3d model is actually always present, it just gets hidden when the coin is eaten. Then the game will attempt to place the coin somewhere on the map, once a frame until it's successful. The larger your snake the more attempts this will take. I suppose theoretically you might get to a point where it takes several of the games turns before a new coin actually appears, but in practice you're more likely to get bored and bite your own tail before then. (editors note: 1 game turn = alot of frames)

The maps 3d model is updated on a reset. This is to allow the possibility of a map re-size, but for the purposes of this demo I just left the size fixed.

Once again you can download the finished game by using the url below. I posted a win32 build and the JAR so if you have Java installed it should run on most operating systems.

https://drive.google.com/drive/folders/0Bz4nByoX2Ks7NGd5X0QzWjVFSjg?usp=sharing

Friday, February 17, 2017

Intro and jAsteroids!

Hello and welcome to my gaming blog! This blog is a place for me to post about what I'm working on as well as links to things I've finished.

My goal is to make a game a week for at least the next year. These games will likely all be small, and most of them clones. I'll detail out the creative process for each game and be sure to highlight areas where I had trouble so hopefully you can learn to make games as well.

Last weekend I finished my first game, jAsteroids! This is a simple asteroids clone coded in Java using jMonkeyEngine and zay-es. I followed zay-es tutorial rather closely to implement the spatial rendering, but most other code I had to create myself. I implemented a super basic collision detection for every collide able object in the scene. The asteroids are defined by an integer, 1-5 which corresponds to their size. Every time an asteroid collides with something non-asteroid they are destroyed and spawn 2-4 asteroids of the next size down, until size 0 where no more will spawn. The game ends when you clear the screen. Write down that score and re-start to see how high you can get! (sorry, no persistence between levels, I only had 3 days)

Your ship has 3 health before it explodes. So fly safe and clean up those asteroids ;)

You can download by clicking the jAsteroids above, or by using this url below.
(sorry, win32 only for now, if you would like to see other OS's let me know!)
https://drive.google.com/open?id=0Bz4nByoX2Ks7QV82UUViekxjWUU

I will be taking suggestions for what games people would like to see made over 1 weekend.
This weekend will be a Snake game ;)