Here’s my entry for RubyWeekend #2: Opposites. You can read my progress logs in the rubyweekend section if you’re interested in reading about how I got the idea and the process involved in making the game.
In Solunaria, you control a giant, glowing, magical moth. It’s your job to round up the smaller moths, but there’s a problem: the smaller moths come in two varieties: solar moths (orange) and lunar moths (blue), and they’ll only follow something of the same color as them!
Fortunately, since you’re a magical moth, you can change color (left click) to attract each color of moth. The catch is that there are also colored glowbugs flying around, and the small moths have a tendency to follow the glowbugs if they get too close. Silly moths!
Download the game! (Requires Rubygame 2.3.)
I didn’t completely finish the game (there’s no winning or losing conditions), but it’s still kinda fun to fly around and guide the moths. And it was a lot of fun to make the game in the first place!
Be sure to check out the other entries to the RubyWeekend #2 contest. There will be voting starting tomorrow, so check the contest forum then.
Also tomorrow, I’ll write up a post-mortem about making the game, just like I did for the previous contest.
LilMoths attracted to glowbugs:
LilMoths displaying color preference:
Here’s a crappy JPEG screenshot of the current progress of my game.
As you can see, I’ve added smaller moths of different colors. The small moths follow the big moth, although if there was anything else around they’d follow it if they got too close. Next I’m going to make them act differently based on their color compared to your color.
I’ve also added a starfield background image which I threw together in 5 minutes in the GIMP.
(2:30 hours left!)
Getting started for the day. Had a little bit of work stuff to take care of, but it’s all done for now. Next up is to work on the LilMoth class and make it respond to the BigMoth. Then I’ll generalize that to make it respond to any “light sources”. Then I’ll add some static lights around the level and a goal light that registers how many moths are following it. And then, my victory will be complete!
My worries of not finishing were exaggerated, it seems. Barring disasters tomorrow, I think I should be able to have a playable and possibly even fun game at the end of the contest.
I’ve made a solid BigMoth class, which implements the behavior for moving towards a target and changing color. One thing I’m really happy with is the way the moth flutters around. I used the trigonometric cos and sin functions to add some nice variation in position, which makes it take a more meandering path towards its target instead of going straight for it.
Then I refactored out a lot of that behavior into a new Moth parent class, which BigMoth inherits from. Next I’ll be adding a LilMoth class, which defines the behavior for the smaller moths that are attracted or repelled by the light. Naturally, it also inherits from the Moth class. Horray for keeping DRY!
I also had an idea for making the gameplay more interesting. Instead of having one color of little moths that fly around and follow you, I’m going to have two – the orange and blue ones, using the same artwork (but made smaller) as the big moth. The orange moths will follow you while you’re orange, and ignore you while you’re blue (not bright enough!); the blue moths will follow you while you’re blue, but fly away when you’re orange (too bright!).
I’m also going to have the concept of light sources other than your character that attract the moths. These will be “focal points” around which nearby moths will fly. If they’re following you but get too close to the other light sources, they’ll stop following you and you’ll have to go back and get them later. Probably there will be 2 or 3 other light sources around as obstacles, plus the goal light which you have to make all the moths fly to.
Maybe if I have time (translation: “I won’t have time to do this, but…”) I’ll add fireflies that float around and change between orange and blue lights, to add another obstacle to the game. They’d float by and attract the moths of that color, making your job a bit trickier. But, yeah, I won’t have time for that this contest.
Okay, it’s a lame screenshot, but here it is.
The progress so far:
- Game runs and has a loop
- Moth sprite appears and follows around your cursor
- Moth sprite changes color when you click.
Not much, but more than I had before…
I’m pretty sure I won’t finish my game this weekend. There’s a ton of work stuff I have to finish before the end of the month, and new stuff keeps popping up that I have to take care of. I really need to establish a schedule, and say that I won’t answer any emails on the weekend or after-hours, but since our clients are located all over the world, it’s hard to say what “after-hours” is.
Blah. Anyway, I’m going to dabble in my game, but probably it won’t be done in time for the voting. Oh well.
The sun and moon Solunar Moth graphics, at double the size it’ll appear in the game.
Here’s an expanded/refined concept for my RubyWeekend #2 game. Like last time, I’m not going to put all the posts about it on the home page, so it won’t spam your RSS readers. I’ll put up the announcements and big stuff, but if you want to follow everything, you should check the rubyweekend section.
The game is called Solunaria (solar / lunar + ia for fanciness). You control a large, magical, glowing moth. On one side of the moth’s wings is the sun, and on the other side is the moon. For some reason (maybe bats are coming?), you have to guide your smaller, non-magical moth friends into a box.
When your wings are showing the sun side, it glows very brightly, and the moths fly away from it to hide. When you’re showing the moon side, it glows softly, and the moths are attracted to it. Using your two opposite abilities, you have to push and pull the moths to get them into the box!
I think the solunar moth will be moved with the mouse. Left clicking will switch to the sun side, and right clicking will switch to the moon side. I’m not sure yet how I’ll avoid the obvious strategy of sitting in the box and using the moon side to pull all the moths in; that would be a pretty easy game! Maybe you can’t get within a certain distance of the box, or it’s too small of a box to fit you?
Probably there will be a timer; either you’re being timed to see how long it takes you to get all the moths into the box, or you have a certain amount of time before the end games (bats come and eat everything?).
That’s the idea! A little crazy, a little arty, small enough scale that it might be achievable (even given the slow start). Off I go!
A quick blog post with my crazy game idea for the RubyWeekend #2 contest.
The idea is a half-sun half-moon guy (kinda like this). You move him around with the mouse, and switch between sun and moon to make moths go into a box. (The moths don’t like the light, so if you are sun they will fly away from you.)
Okay, it’s a silly and daft idea, but it’s the best I’ve got, 7 hours into the contest!