Open GL ES: Part 1.5

June 24th, 2011

There’s good news and bad news. I’ve made a lot of progress in getting a simple engine running is the good news. And even better news is that now that the 2011 WWDC videos are online there’s some awesome new videos about GLKit. I’d recommend checking them out if you’re a developer because some of the features seem very nice, I’ll definitely be upgrading to OpenGLES 2.0 when iOS 5.0 comes out.

The bad news is that I had an eye appointment earlier today where my eyes were dilated so I can’t really see. I was starting to think I wouldn’t be able to finish my post for today but it’s starting to come back so I can make a short post. I’m getting LASIK done next month because I’m nearsighted enough that I can’t even use a computer without my glasses/contacts. I’ve always hated feeling so dependent on them. Getting my eyes dilated has effectively made me farsighted for the past 7 hours and it’s pretty much just as bad. The real annoying part is that I have to wear my glasses or I can’t see anywhere! It’s a really interesting juxtaposition.

So for today’s post I’m going to talk about the files that are in the template I posted last week. If you haven’t seen it, get it at the bottom of the page here: OpenGL ES: Part 1

Read the rest of this entry »

OpenGL ES: Part 1

June 9th, 2011

Well it’s certainly been an interesting Week! WWDC was this week and Apple has released the preliminary documentation for iOS 5.0.  Because of that what I was going to write about this week actually changed. I was going to talk about setting up an OpenGL project and getting an image on the screen. Well, I am still going to talk about that but less in depth than I was going to. You see, iOS 5 has some new classes in it that are going to make using OpenGL even easier! GLKit is a new framework that will make it much easier to set up views with OpenGL. It also looks like it will provide a texture loader which is nice.

However that’s not out yet and covered under NDA so that’s not what I’ll be talking about! Though it is really nice that it’s coming because one of the biggest barriers to entry is how much initial setup you have to do before you can start tinkering. I definitely learn from seeing and doing so getting something up and running is pretty important to me. Because of this I created an Xcode template which I think will speed the process along. It’s really simple, it consists of an EAGLView and a Texture2D class that can be used to load images into OpenGL to be used as textures.

Read the rest of this entry »

Getting started in OpenGL ES

May 26th, 2011

Lately I’ve been really diving into OpenGL ES and it actually has been much easier than I was expecting. OpenGL is always referred to with the feeling that it’s some kind of complicated voodoo. Now, it might just be because of all the great resources I’ve found from people who are much more pioneering than me but so far it’s been quite reasonable. Now I’m sure some of you are reading this saying “But a few weeks ago you were raving about how CoreAnimation is plenty powerful enough to make a 2D game” and the answer is “It is”. However quickly into prototyping my mole game I was realizing that I am probably going to want more power for cool effects to make it really look awesome. CoreAnimation is still a very reasonable approach, and it was great for prototyping the game up fairly quickly. If you’re the kind of person that thinks they would drown in a highly technical subject like OpenGL then CoreAnimation is a very valid option. I, on the other hand, am the kind of person to keep clawing my way up if there are better techniques out there. (And even here “better” isn’t necessarily the right word, it’s “more powerful” in this context.)

The Plan

The plan over the next couple weeks of blog posts is to talk about using OpenGL ES for creating a 2D game. There are a lot of OpenGL resources out there, but most of them are about OpenGL and cover topics that OpenGL ES doesn’t support. Of the remaining ones that do talk about OpenGL ES they tend to be about 3D. So I hope to address some of the topics more relevant to making a 2D game in OpenGL ES on the iPhone.

Resources

So, as I was saying over this past weekend I went through a multitude of OpenGL ES tutorials, guides, and videos. When learning something as complicated as OpenGL I really feel like reading through multiple sources is beneficial. It’s such a complex subject it’s unlikely that one source will talk hit every topic, or explain everything in a way that clicks for you. When you read several descriptions of something each one can fill in the blanks for the other.

Without further ado I present my recommended sources for someone trying to learn OpenGL ES for the iPhone:

71 Squared’s iOS Tutorials
These tutorials from 71 squared’s Mike Daley are excellent. There’s 14 videos of Mike basically starting from scratch with OpenGL so it’s absolutely packed with information! A couple notes though: They are a little dated so there are better ways of doing some things (CADisplayLink for one). Also he is learning as he goes, so you really need to watch the whole process because he address as lot of potential problems later in the series.

Learning iOS Game Programming
Also by Mike is a book he wrote after the video series. This book addresses both of the problems I listed up above. It goes through the process of making a game with OpenGL as a whole. I really can’t say enough good things about this book, if there’s one resource you should get it’s this! I hear a second one is in the works with follow up concepts, can’t wait!

Jeff Lamarche’s OpenGL Book Chapters
Jeff Lamarche was in the process of writing an OpenGL book when it got canceled. He generously posted the first four chapters he had already written on his blog. Though they mostly deal with OpenGL ES 2.0 I would say it’s one of the best resources for explaining shaders and the features from ES 2.0. It’s actually a shame this book never got finished.

All About OpenGL ES 2.x
Another OpenGL ES 2.0 tutorial, this time by Diney Bomfim. I actually didn’t find this one as helpful as the others, but I expect everyone learns differently so your mileage my vary. It’s definitely worth looking at.

Apple’s WWDC videos from 2010.
You need to log into the developer portal to access them but if you haven’t seen these yet let me tell you: They are a goldmine. There’s so much information here about all things iPhone. I hope you have many free hours to watch videos because you won’t want to stop.

Apple’s OpenGL ES Programming Guildline
This is definitely worth looking through as it has a lot to do with the specifics of the platform. Especially helpful are the tips about optimizing.

Ray Wenderlich’s Blog (New!)
Ray’s site is full of great tutorials so if you haven’t seen it yet be sure to check it out. This one is actually hot off the presses, posted just this week. Again it’s dealing with mostly ES 2.0 and 3D but covers many topics you’ll need to learn.

Phew, if those can keep you busy for a while then you have way too much time on your hands!

OpenGL ES 1.1 vs 2.0

One topic that’s going to come up a lot is the difference between OpenGL ES 1.1 and 2.0. First off the actual difference between the two is that 2.0 has a programable pipeline while 1.1 is a fixed pipeline. If you’ve read anything about OpenGL already you’ve probably heard these terms before. The short answer is that in 2.0 you have to write your own shaders while 1.1 uses pre-programmed shaders. Shaders are functions written in GLSL (GL Shader Language, similar to C) and basically control how things are rendered. If you want a better explanation about what shaders are read Jeff Lamarche’s blog linked above.

OpenGL 2.0 isn’t available on the iPhone 3G, only the 3GS and 4. This is a relevant factor though it’s becoming less relevant every day. I’m going to be starting out dealing only with ES 1.1. For 2D games the fixed pipeline will be all you need for 90% of what you do (warning: made up statistic).

Here’s a few examples of the kinds of 2D effects you could do with custom shaders in 2.0:
Depth of field – Blurring objects in the background
Bloom – When an intense light source bleeds around edges
Distortion effects – Ripples, bending
Motion Blur – Blur from high speed movement
Filters – Crosshatching, other visual styles
Various lighting and shadow effects

There are definitely some cool things you could do with 2.0 and I suspect I’ll be upgrading to 2.0 at some point, but again I want to start small and iterate upwards.

Shades of Gray

For this project I’m going to be working on a top down spaceship shooter game. It will be like a bullet hell except the fights will be mostly, if not completely, duels between you and an enemy. The concept of the game is that you live in a colorful world where things that are gray simply disappear. By shooting colored paint at your enemy you can change it’s color, you need to balance shooting RGB colors to make them Gray and thus disappear! I’ll be playing around with the actual gameplay during the process.

Hopefully next blog entry I’ll talk about getting some basic sprites set up and drawn with OpenGL ES 1.1!

Qualitative Game Design

May 12th, 2011

Lately I’ve been thinking about game design a lot and what makes good games. Now, as if you couldn’t tell from the title, this post is going to be pretty subjective so feel free to take anything I say with a grain of salt. As programmers + designer hybrids I think it can be really easy to get too caught up in the implementation of a game rather than the design of it.  Implementation tends to be mostly qantitative in nature, things have health, scores get added, you earn coins, or add time. These all are very important to a game and can take a lot of careful balancing and tuning but rarely do I feel like they are exciting. Having numbers to tweak is great for balancing but one way or another they tend to boil down to formulas and not strategy. In order to obscure these forumlas they are generally made more complex. Complexity is not inherently equal to interesting or fun, there is a difference between an elegantly complex system with meaningful interactions and something that’s simply complex to for the sake of making it harder to model.

Read the rest of this entry »

Adventures in Bitmasking

April 28th, 2011

I decided to go with a bit of a different format today. I’m not sure what gave me the idea to make an infographic but I was making a lot of images for the post anyway and I thought “Hey, why not?”  Hopefully that image mostly speaks for itself but in case it doesn’t here’s a quick rundown of the process:

Read the rest of this entry »

Tile Map Using CoreAnimation

April 15th, 2011

This week I’m going to talk about how I implemented a tilemap in Objective-C using CoreAnimation. I’d like to take the time to once again say that this code is definitely not optimized so your milage may vary. It’s funny because a tile map in some ways feels like a very dated beast. I suppose in a lot of ways it is, but it definitely has a unique feel that can give a very nostalgic vibe. Much in the same way a physical oil painting can compare to digital paintings.  But enough about why you might want to use a tile map, I’m sure you already have strong feelings for them one way or another.

Read the rest of this entry »

Sprites using only CoreAnimation

April 1st, 2011

Today I’m going to talk about the development of my likely to be next released game codenamed Mitch Digger. First I want to talk about something I think can be one of the biggest problems for an independent developer: Too many technologies! While it’s a great thing in general I think it can both be overwhelming and potentially waste a lot of time just learning new technologies. Look at developing for iOS alone. In the process of deciding to work on a platformer I looked into cocos2d, openGL ES, corona, unity and more. Deciding on any one resulted in trade offs; Time to learn, capabilities, ease of use. In every case I felt like I was making the wrong choice. In the end I decided for now I’m going to stick with what I know already and see if it was really possible to make a game in just CoreAnimation.

Read the rest of this entry »

Thoughts from PAX East.

March 17th, 2011

This past weekend was PAX East in Boston and at the last minute I decided to go. I think it was jealousy from hearing about everyone on twitter talking about GDC but I figured I should take advantage of the fact that I live about a half hour from Boston.  PAX was, in one word, excellent. The one downside it had was that it was packed. I think I read somewhere that over 3 days there were around 70,000 people there. Thats a lot of gamers! The venue was nice and big so it didn’t really feel that packed inside the expo floor but the lines, oh the lines.  At any given time there were talks going on about all kinds of topics: Games, dev, writing, media, communities, etc, and each one would have a line form up before it.  Most of the talks reached capacity in the line well before the start of the talk, I didn’t even try to make it to most of the main events. What I did want to go there for were several talks being held by the IGDA in a room called the IGDA Dev Center.  One thing, this room held 80 people. Thats right, 80. Eighty people in an event where there’s several thousand at any given time is leaning towards the ridiculous side of things but luckily for me I caught on to this and got there plenty early making it to most of the talks I wanted to go to.
Read the rest of this entry »

A Buffet of Thoughts

March 3rd, 2011

I know I’m probably unknown to most of you so I wanted to do an intro post but with the two week rotation of iDevBlogADay I feel like it would be a bit unfulfilling. So what I’ve decided to do is well… both. The first half of this entry is going to be about me and Angry Fish Studios. The second half is going to be about using Illustrator’s Recolor Artwork feature. Let’s dive right in.

Angry Fish & Me

Who am I?

Well, my name is Alex and along with my long time friend Joe I started Angry Fish Studios. Our goal is quite simply to make games we want to play. We both work other full-time jobs so development can take a backseat sometimes. It’s pretty easy for it to grind to a halt when life gets busy especially if you’re like me and like to have a nice big chunk of time to really get into stuff. We try to maximize our time when we do devote time to it there are a few ways you can help doing that. Make lists of concrete tasks, by keeping a list of very specific tasks it makes it easier to focus on what you need to do and knock stuff out. When we were nearing the first release of Tripolar we had a one column list on a whiteboard. By the time we crossed out 90% of that column we had a second, and by the time we crossed out 90% of that one we had a third. It really gave a sense of progress and helped us keep focused with what needed to be done for release. It’s easy to say “I need to do the settings screen” but what does that really entail? It’s much more useful to write down specific tasks like “Add settings button to the main menu”, “Make spring/summer/fall/winter theme icons” and etc. It certainly gives you a much better approximation of how long it’s actually going to take to finish.

What do I do?

I do all the art and graphics for Angry Fish Studios, including this website. I also work primarily on the game design and do some programming. On my new solo project I’ll be doing everything! I’m a true jack of all trades in that I’m also a master of none, I do my best but I’m constantly learning and by no means should you take anything I say as gospel. Be sure to check out our 100% factual bios on the About page.

Tripolar

We released our first game Tripolar back in October of ’10, so somewhat recently. You probably haven’t heard of it and well the truth is we didn’t do too much of a push on it. You shoot gems at the board hitting a 3×3 area which clears any gems of the same color as the shooter and swaps the other gems. It’s a somewhat simple mechanic thats easy to learn but hard to master. By the time we released it we already had some pretty major plans for an update for it including: new mechanics, a new play mode, game center, achievements, a whole ton of puzzle levels, an iPad version and a free version. Part of the reason we didn’t push on it is we realized pretty quickly that we wanted to get a free version out there. There wasn’t a great way to divide the current release into a free version while really showing it off so we decided to wait for the update. That being said I’m still really happy with the first release of Tripolar. I’ve always admired things that look really polished and professional and I feel we accomplished that. For the first game I’ve ever really made it’s something I can say I’m proud of.

So lets talk about this update. I can’t give any definite timelines because, as I said, work on it is sporadic but Joe and I are working on it as often as we can. I’m really excited about it because while I think Tripolar’s first release was a solid foundation this update will really expand upon that. There’s going to be several new gem types and shooters which is going to be a blast for puzzle mode. I think puzzle mode is really one of its strengths and something we didn’t devote enough to the first time around so this time there’s going to be a plethora of new levels. Below are a few screenshots showing some of the new features from the update. For now you’ll just have to guess how they work though :)

Mitch Digger

First thing’s first, don’t get too attached to the name because it’s just a codename until I think of a real name. (Fun fact: Mitch Digger comes from the game Dokapon Kingdom, an obscure but great wii/ps2 game, check it out if you’ve never heard of it.)

Mitch digger is a side scrolling platformer,

Picture Dig-Dug.

Got it?

Ok now forget about Dig-Dug because other than the view it’s nothing like that. There’s a couple ideas I want to explore through this game, mainly the idea that not every platformer needs to be about combat. The main goal is to explore levels by drilling through the earth and finding valuables. Sure there will be enemies but Mitch isn’t a fighter, they can be dealt with in other ways like making a little ditch for them to fall into. There will be lots of things to buy and upgrade with all the money you get from the ore you find, in fact you’ll have to. As you dig further down the earth gets tougher, you use more oxygen, and it gets darker.

The other interesting aspect of the game is that inspired by our beloved @MysteryCoconut I’m planning on making the game using only UIKit and CoreAnimation. I might break down halfway through and use openGL but so far it’s looking possible. There really will only be a few animated sprites on the screen at any given time and by using good MVC practices it should be pretty doable. Below is the first “screenshot” from the game with some placeholder graphics. I’m guessing a lot of my blogging will be related to the development of this game.

Ok so now that we’re best friends lets get to the meat of this post.

Read the rest of this entry »

Plans for the New Year!

January 25th, 2011

It’s been a while since this blog has been updated! It seems I start most blog entries with that… but this time there’s an excuse. I’ve been trying to save any ideas for blog updates for when my turn on iDevBlogADay comes around. If you have any interest in iPhone development be sure to check it out!

Joe and I are both very busy right now but we’re working on a major update for Tripolar. Nothing is final but the update will contain: New blocks, new shooters, a new game mode, achievements, online leaderboards and best of all a whole slew of new puzzle levels!

In the meantime here’s a sneak peak:

-Alex