Phil Hassey - game dev blog
Phil Hassey as Syndrome
"Look, stores don't sell
costumes like this to just anyone."

SDL2 Tips, Tricks, and Workarounds

November 5th, 2013

It only took me about 3 days to get my framework working with all my targets: Windows, Mac, Linux, iOS and Android. I took an extra day to write my own simple mixer for WAV and OGG audio. And there might have been another day in there for other cleanup / fixes. So maybe 1 week total.

You can get SDL2 here. If you’ve used SDL before, you’ll find that it’s pretty similar, only it seems to work better, and now it’s got slick iOS and Android support.

You will want to follow the SDL 1.2 to 2.0 Migration Guide. And then for Android and iOS, read the README-android.txt and README-ios.txt as included in the source zip. I’m just writing up some tips here to help you along the way. I’m writing this with OpenGLES 1.1 in mind.

SDL2 for Windows, Mac, Linux

– Initializing your Window must be done in the right order. Basically, I call SDL_CreateWindow first, then SDL_GL_CreateContext. If SDL_CreateWindow fails with my preferred settings, I chose more fail-safe settings. After setting the mode I use SDL_GetWindowSize and SDL_GetWindowFlags to see if I got what I wanted. If things aren’t quite right, I use SDL_SetWindowFullscreen and SDL_SetWindowSize to try and request them again. (I always go out of fullscreen, set size, (maybe go into fullscreen), then set size again.

– As of SDL 2.0.1, Mac Retina displays do not work consistently. There is a flag for this “SDL_WINDOW_ALLOW_HIGHDPI” but I’ve found that if you ever change mode, or do anything, things seem to fall apart. If you aren’t messing around much, it might just work well enough for you.

– glu doesn’t seem to work anymore. So I had to switch over to using glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP,GL_TRUE); to generate my mipmaps. I examine the glGetString(GL_VERSION)) to make sure it’s >= 1.4 before doing that. And if I’m not on a new enough GL, I just don’t use mipmaps at all.

– Use stb_image to load your images. (I didn’t do that just for SDL2, but it’s a great tip!)

SDL2 for Android

I can’t believe how smoothly this went. (Recall, 2 months for NDK, 1 week for Marmalade .. this port took 1 DAY!!!)

– Follow README.android for the details.

– in AndroidManfiest.xml in the “activity” tag add android:configChanges=”orientation” , keeps your app from crashing. You may use other orientation tags to keep it in a single orientation, or whatever.

– If you use sockets, be sure to add these permissions “android.permission.INTERNET”

– Use SDL_rwops to read your own data files (which you have placed in the “assets” folder of your Android project.)

– If you want to use SDL2_mixer, you may need to edit SDL2_mixer/Android.mk and disable a few things.

– If you are using single touch, your mouse SDL code might work already, otherwise add support for SDL_FINGER* events (and filter out the touch events from your mouse code if (e.motion.which == SDL_TOUCH_MOUSEID) { break; }

– Be sure to call SDL_SetTextInputRect before SDL_StartTextInput if you are using key input. SDL_SetTextInputRect let’s you specify where on the screen the text is appearing so that SDL2 can shift the screen to keep the virtual keyboard from overlapping it.

– On suspend / resume I had to pause my audio.

SDL2 for iOS

– Follow README.ios for the details.

– SDL_SetTextInputRect doesn’t work. So you’ll need to capture UIKeyboardWillShowNotification and shift your screen to keep the virtual keyboard from overlapping it on your own.

– Unlike in Android, the orientation won’t change between portrait and landscape UNLESS you add SDL_WINDOW_RESIZABLE to your SDL_CreateWindow flags.

– Even though I added in SDL_iPhoneSetAnimationCallback, I got crashes when suspending my app. I also had to use SDL_SetEventFilter to capture SDL_APP_WILLENTERBACKGROUND and SDL_APP_DIDENTERFOREGROUND to set a flag to tell my callback to start / stop doing its thing.

Custom Mixer?

You might be able to use SDL2_mixer on all platforms. I did try it out for Android, and got it working pretty easily. However, I decided to write up my own mixer using SDL2 to stream the output. (This ended up only taking a few hours, and it keeps me from having to have SDL2_mixer as an additional dependency on all platforms.)

I used SDL_LoadWAV to load wav files and stb_vorbis to load and stream ogg files.

Good luck!
-Phil

Wits & Wagers Halloween expansion

November 2nd, 2013

Hey,

For Halloween Nan and I (well, mostly Nan, but I did come up with at least a few of the questions) came up with an expansion for the game Wits & Wagers!

You can download the pdf WitsAndWagers-Halloween. Print out page one, flip to back, print out page two. (Double check alignment, the pumpkin question should have the long answer on the back.)

-Phil

Galcon 2 – beta21 – Bug fixing, cleanup, colorblind support added

October 26th, 2013

Ahoy there, beta20 has arrived! Backers can check it out for Windows, Mac, Linux, or Android. (Testflight on the way…)

This update just fixed a bunch of bugs, and adds colorblind support. It also removed Galcon Legends from Galcon 2. (I hope to get a release candidate build of Galcon Legends out for you to test on Steam very soon!)

To modders, I’ve changed most 0/1 style bools over to true/false style bools to make things work better with Lua.

Also, check out a video of what happened when I first enabled colorblind mode in Galcon 2.

Please post your feedback on the forums!

Thanks!
-Phil

P.S. I’ll be online for a while to play the game, talk about Galcon 2, etc!

Goats in Utah!

October 24th, 2013

A couple weeks ago Nan and I went on a goat vacation to Utah. It’s a super cool place to go hiking! Here’s three of my favorite pics from the trip:

Goblin Valley is totally amazing!

Spookey Canyon is super weird!

Cuzco says, “I’m the best!” while hiking on Escalante.

Petunia and Nubbin just hanging out on slot-canyon walls in Willis Creek.

Headin’ back.

Anyway it was a great time, we had a ton of fun. And the other day we bought a new goat hutch, it looked like a UFO in the back of our truck and a ton of people were staring while we spent the day in Pueblo driving around with it.

Goat hiking is fun!
-Phil

Galcon 2 – beta20 – SDL2, UI, Legends, Modding, Galaxy Map, Rewards …

October 19th, 2013

Ahoy there! beta20 is ready for backers to check out for Windows, Mac, Linux and Android. (TestFlight / iOS coming shortly.) I’ll be online for the next hour or so, so stop in and say hi!

The game itself got an internal upgrade as I migrated from SDL to SDL2, the main value of that is making full-screen work on retina display Macs. Everything else should be pretty much the same. I’ve also done a bunch of bug fixes and tweaks on the UI, so playing should work even better than before. These changes will improve play on touch and mouse control.

Galcon Legends got a bit of an overhaul with some new music, graphic improvements, and bot AI improvements! I’m hoping to release Galcon Legends to the public pretty soon, so do check it out and give feedback on the forums.

Modders rejoice! I’ve *finally* gotten around to fixing up mod_client and mod_server. You can customize those mods to make your own Galcon modes to test them out. Keep in mind we also have documentation on much of the Galcon 2 API for your reference here!

The Galaxy Map has gotten a nice new feature – stars with active players are highlighted so it’s even easier to find people online.

Also, I’ve gotten a few inquiries about the rewards. So let me fill you in:

– Post-Kickstarter PayPal backers will be getting their rewards last. KS people get ‘em first. (So if you backed late, you have to wait … it’s just kinda fair and it makes logistics easier for us.)

– $100+ tiers are on hold while we get the box set sorted out. We’ve had some trouble with the box, currently the wraps for the box are at the box company, who seems to not be willing to do the project, so we’re trying to get those returned so we can get the boxes produced by another company and then wrapped by someone else. A bit of crazy :( We’re really hoping we’ll get it sorted out soon.

– I’d love to send out stuff earlier (like the poster / magnet set) but unfortunately shipping costs are crazy, so it would cut into the money which is saved for the in-game art. Also, the way KS works, we can only request your address once, and mark things as shipped once, so that would make a bit of logistical mess too.

Once we have the box in hand, it’ll all be getting shipped out pretty quickly. But, yeah, it’s being delayed. Sorry about that! Thanks for your patience and all that.

-Phil

Galcon 2 – beta19 – Try Galcon Legends NOW!

October 1st, 2013

Ahoy there! A new update is ready for Windows, Mac, Linux, Android, and TestFlight.

The main feature of this is a new beta of Galcon Legends is included right with Galcon 2. (This will not be part of the final Galcon 2 release, but it’s the easiest way for me to get it out to you for testing!) Just sign in and click on the LEGENDS tab at the bottom of the screen.

I really want feedback on this game, as I’m going to try and release Galcon Legends during October, so please tell me what you think on the forums! This update of Legends also includes the excellent new soundtrack created by Joshua Laya. (Note: music not available on iOS or Android builds yet.)

Lastly, I’ve done a bunch of the bug fixes found in beta18. For the sake of making this post look longer, here’s the complete list:

= 10/1/2013 =
– ios: on portrait modes (ipod touch), the zoom mode goes on even when it shouldn’t (problem does not exist in landscape)
– ios: can’t slide percentages.
– mods: include Galcon Legends OR remove the Legends button from the mods screen.

= 9/30/2013 =
– legends: add music
– mods: upgrade frustration mod
– api: winning a bet loses your coins. (so a bet of 50 against 1 person loses you 150 instead of gaining you 50)
– galaxy: not always tracking rank / location of players properly.
– lobby: when joining a server, you aren’t always changed to the correct class.
– galaxy: joining a server doesn’t always get you into the correct server. (probably due to running out of servers? so maybe fixed?)
– galaxy: have button to dismiss user list
– galaxy: have user list say what server they are on right now.
– lobby: if in settings, anytime anyone types anything in chat, it drops you back to the lobby out of settings.
– galcon_util: game will end even if it’s a single player game (to avoid hanging servers.)
– lobby.lua: now you can’t start a game if there are 0 /play people
– clients.lua: added /debug command to inspect server variables.

= 9/26/2013 = (fixing on server)
– bets: betting winning crashes server.
– server: music not resetting for client when i rejoin a server.
– galaxy: user totals not correct on map
– galaxy: map should indicate where users are playing.
– galaxy: going to a server doesn’t always put you in the proper server

Have fun!
-Phil

P.S. I’ll be online for about an hour, so sign onto the Galaxy Map and say hi!

Galcon 2 – beta18 – Overhaul edition: Galaxy Map, Rankings, and Zooming

September 26th, 2013

Ahoy there! It’s been a while, thanks for waiting around! The summer has been very busy with Nan and I participating in our first goat shows, as well as hosting an indie game developer mini-conference on Lake Powell.

But between all that, I’ve managed to get a ton of stuff overhauled for beta18! You can download it for Windows, Mac, Linux, and Android. (TestFlight for iOS will be mailed out shortly.)

So here’s the breakdown of what we’ve got! The most “in your face” change is the overhaul of the Galaxy Map. It now has a few constellations and each star has a slightly different game type with it. In theory, you can now play some 2v2 and donut shaped games!

Next up, the rankings got a major overhaul. I’ve only tested them a little bit, but now you should be able to rank up your flag, gain extra stars (by earning points on various stars), and get wings by winning in tournaments (right now: betting.) I reduced the number of ranking flags down to one flag for the whole game, as I think that makes things easier to understand, and it makes it so unlike previous Galcons where some flags were impossible to rank up, this one should be.

Next, I did some major work on the user interface stuff. For a long time I’ve disliked the pan + zoom features in Galcon 2, so Nan suggested I change it to a mini-map type thing. Which really changes how it works, but I think it works much better. Be sure to give Esparano’s Frustration mod a play with it and tell me what you think.

Lastly, I did even MORE work on the user interface. iOS players should be able to use multi-touch finally! I also got sick of the ludicrous number of options in the settings page. I wasn’t able to even be sure what some of the options meant after a while and it was beginning to break the UI code by having too many options. (It was possible to set up the game so it just plain didn’t work.) Anyway, I reset everyone’s settings and have a new set of them to mess with.

Thanks everyone for your feedback! Be sure to stop by the forums and tell me what you think of all the new stuff, I need your feedback to make this game the best it can be!

-Phil

P.S. Pop onto the servers right now, I’ll be playing for the next hourish and getting bug reports / feedback there too!

My first goat show!

September 3rd, 2013

On Friday Nan and I loaded up our 4 does into our horse trailer and hauled them up to Pueblo for the Colorado State Fair dairy goat show. After paperwork got done at the fair we checked them into their pens and Nan went off and parked the trailer.

While she was gone, I got the exciting job of cleaning out several pens, which were filled with the previous occupants defilements. This was a pretty unpleasant experience, and fell into the category of things that if I told my 15 year old self I would end up doing, he would have informed me that I may have made some poor life-choices.

Once that was completed we had some ludicrously priced, but delicious fair food and headed home where we stayed up until 2am getting our costumes prepared for the goat fun costume event on Saturday. The morning came too soon and I spent most of Saturday in a bit of a stupor due to lack of sleep.

Even so, I had a good time showing our goat Lilly, and received a blue ribbon for being the only goat in her class.

Later in the day I showed Nubbin who went on to receive a Reserve Champion in the Jr Recorded Grade show! This is a pretty significant honor, Nan and I were quite surprised!

I took a few naps in the afternoon and felt much better in the evening, where we competed in the goat fun costume show! When I signed in, the girl asked me what age group, and I indicated adult. She said, “14-18?” and I said, no, 34. So she added an extra category to her page that said, “34” on top. I guess they don’t get too many geezers in their goat fun show.

The youth classes were full of great costumes. One of the best ones included a goat converted into a camel. Nan and I were proud of ours too, Nan dressed as “Victorista Cruz: World Traveller” and I dressed as “Eugene and my robot the P9000”

As the only entries in the “34” class we both received ribbons and a prize.

On Sunday the second part of the goat show ensued, we were much better rested, so it was about 10 tons more fun to be awake. There was no costume show, but we won the “Primier Exhibitor” award for having the most Registered Grade (experimental) goats in the show! This was pretty exciting to us, as we’re really trying to create some new goat mixes with particularly good dairy and pack goat attributes.

And, that was the state fair! We had fun! We might even be doing another goat show this coming weekend, but it’s right up next to the 360iDev conference I’m going to, and I’m not sure if I’d survive two huge events right after one-another. We’ll see!

-Phil

Indie Boat 2013

August 28th, 2013

I got back from Indie Boat 2013 a few days ago!

If you want to see pics and videos, check out Dave and Andy’s blogs. If you want to read my account of what went down, read the other two blogs first, and I’ll just fill in my own details.

The trip was an amazing experience. I’ve been to Lake Powell before, so I knew that. Our lake time was great, I had a blast water skiing and sleeping on top of the house boat every night. We saw some cool storms and stars. The food was most excellent. I’ve gotta give a shout out to Colin Northway for his 5 minute GDC talk this past year where he encouraged us to get out and travel a bit more.

This was the first conference I’ve ever organized, and well, it came out way better than I expected. We had about 3 hours of official content per day, and spent the rest of the time talking games too. I led 3 discussions.

Secret Sauce – Where we discussed some of the things we each did to differentiate ourselves. Everyone shared the unique aspects of their business. The trip had a very diverse mix of people from mobile, desktop, web based platforms, so everyone’s approach was a bit different.

Galcon 2 Design – Where I got feedback from everyone on my launch strategy and marketing strategy. I’m still not quite sure how I’m going to do these things, but the crew did encourage me to take the launch of Galcon Legends more seriously than I was taking it.

Indie Survival – Where we discussed surviving the indie life – tips dealing with depression, fitness, workaholism, time management. Working alone and being your own boss is tough, but it is undoubtedly the most awesome job in the world. Key point is to be thankful for what we’ve got.

A few takeaways for me were from these talks:

Personal Story (Andy) – People want to hear more about goats and stuff. I’ll try and do that. I mean, hey, I’ve even got a degree in writing this sort of stuff, maybe it’s time I put it to good use.

Reframing AI (Kim) – Kim got me all fired up about AI. I’ve spent the last 3 days messing with Galcon 2 AI code. It needs some real work to be solid yet, but I’m having fun, although I’m pretty sure I’m using it as a avoidance tactic to put off doing the work I need to do.

Music as more than background (Dave) – It would be fun to make a game where I make / choose the music FIRST and THEN I make the game. (Instead of the other way around!)

Culture (Tim) – Tim defined for us the concept of neotribalism. Which led to some interesting discussion of the various “tribes” in indie culture. All of whom seem to be in a state of constant tribal warfare. Yum? It also got me thinking about my recent departure from some tribes and the significance of that.

Indie Survival (Phil) – Dave suggested doing 45 minute time boxes and then tacking on 10 minutes of banjo practice after each time box. He explained how this helped him clear his mind and get good ideas. I play the fiddle, so I’ve been doing this all week so far. I really like it.

All-in-all, the conference went really well. The small group was the perfect size for doing these small group discussions and we really had fun. I got to know some folks better and meet some new people too! I’m so glad this trip came together!

The evening when I got home, a bunch of cows wandered up our driveway from the ranch next door. This is usually something Nan takes care of, cause she’s in charge of everything animal around here, but she was busy. So I got the lunge whip out and began to march the dozen or so cows and bull down the driveway.

Cows are kind of huge, so the whole way down our 1/8th mile driveway I kept a close eye on them. Last thing I wanted was to be stampeded by a herd of disgruntled bovines. I also had to avoid the real-time cow-pie production remains as I walked behind them.

At the bottom there where a few ranchers who escorted them up the road back to their pasture. On my way back home I fixed part of our electric fence where one of the cows had bumped through.

I clearly need a cowboy hat, and maybe a cattle prod, to really live the rural indie lifestyle.

-Phil

BIG NEWS (again!) – Galcon 2 – Galcon Legends and Party Report

August 14th, 2013

I’m thrilled to announce the return of the Instant Action Galcon campaign as Galcon Legends!

This is going to be sold as a paid game separate from Galcon 2. It will be sold on iPad, Windows/Mac/Linux, probably Android too. But backers of Galcon 2 will get it as a bonus game because it was built as a direct result of the Kickstarter and your pledges. So yes, that means TWO Galcon games are coming now! The “Galcon 2″ F2P MMO and “Galcon Legends”!!

How it all happened: I never planned on having modding in Galcon 2, but the backers asked for it. As a result, a few modders began working on Galcon 2 mods. I got in touch with Evan “esparano” Sparano, to ask if he wanted to work with me on more Galcon 2 modding projects. So Evan spent the summer using the original artwork and watching YouTube videos of the campaign to re-create it using the Galcon 2 engine!

Backers can try out the Galcon Legends beta, by following these steps:

1. Download the latest Galcon 2 for Windows/Mac/Linux from here.
2. Download the Galcon Legends beta from here.
3. Unzip GalconLegends.zip to your computer
4. In Galcon 2, under Mods, enter “path/to/folder/GalconLegends/GalconLegends.lua”
5. Press Play and have fun!!
6. Go to the Galcon 2 forums and leave some feedback!


And now in other news …

The Galcon 2 Party was incredibly fun! Nan and I were there as well as Tim (composer for the previous Galcon games.) Two other brave players made the trek out to Colorado to join in the festivities! Here’s some of the highlights of the day:

Tim and I set up the breakfast table, complete with the day’s program and name plates. It was most elegant.

After breakfast it was time to meet the Galcon Goats! Everyone pet Cuzco and got to meet Lilly and Nibbles (who were in some of our Kickstarter videos.) Lilly and Nibbles also had kids who were quite friendly with crowd.

After that we hit up the natural water slides near San Isabel. The hike was great and the water was perfect!

Following lunch we took some time to tour Bishop’s Castle. It is incredible.

When we got back to the Galcon HQ, we took a break for a while. But before dinner we still packed in a couple intense games of croquet. It’s a lot like Galcon. There is only one winner.

Nan made an awesome Galcon cake for the party. It was delicious chocolate!

To wrap up the evening, I launched beta17 and we played until we dropped! It was a great party!

One player stayed over night and got in a personal ride on the Galconicorn the next morning. Good times!

Thanks again to everyone who backed Galcon 2!

-Phil