New guy saying "hello", oh and some questions. :)

Apprentice
Posts: 12
Joined: 2010.04
Post: #1
Hello everyone! Smile

I'm new to these forums and wanted to become active here as I'm a software engineer getting into iPhone/iPod/iPad development. I'm a windows programmer with experience in C++, C#, Visual Studio IDE and Direct3D. Making the big leap to a Mac, XCode IDE, OpenGL, Objective-C, etc. I imagine is gonna be rough road ahead of me lol.

So, I started this adventure after I got some awesome ideas for some games and wanted to try my hand on making them commercial, who knows how far it will go, but it should be a cool experience. I also am an artist (hobbyist) so I have that in my favour too, doing all aspects of this game myself, gulp!

I've been doing some research and have a few questions regarding a game I would like to make. My goal is to make a 2D game with the following properties, without giving too much away of course Rasp...

- Physics based, going to use an Open source C++ library if possible.
- 2-Dimensional.
- Needs collision detection.
- Not much GUI elements, mainly only main menus, very simple.
- Resolution independent (so it will work on iPad, iPod, iPhone)
- Universal binary.
- Raster graphics (art/textures). Not using vector graphics!
- Simple sprite animations required. Probably using a texture atlas (texture sheet) and index into this with UV coords to animate if I use OpenGL ES.
- More than a few objects on screen at once, maybe 50 or more, some animating or moving/rotating (physics).
- Sound, undecided at the moment.
- Networking, undecided at the moment, but probably Facebook, Twitter score posting.

So, I've done some searching and still haven't found or made up my mind about some aspects of the game...

1) For a graphics API, I was considering using OpenGL ES given my requirements and research. Good idea? I've read for a 2D game, using quads and drawing them with a texture is a good path and UV into them to animate using your home-made sprite system will work good. Any suggestions here or resources?

2) Resolution independence (to work on 1024x768 iPad and 480x320 iPod) - wow, didn't realize this was such an issue because I've never done a 2D game before only worked on 3D!!! But yeah, say if I have a raster image (png format or something) for a background that will not scroll/pan or zoom in or out. My game elements I would prefer to do as little scaling as possible. What is the best route to take or pitfalls to avoid? Should I just use ONE art asset per game entity at the largest desired resolution and only downscale (or let OpenGL do it)? Since the two platforms have different ASPECT RATIOS anything I should watch out for? What are some good solutions you guys have found? I found a thread on this but it turned into a flame war on vector graphics (not using these in my game!)

That's it for the time being! I'm going to go off now and research what's involved in signing up for the App Dev program at Apple. Smile

Cheers!

- Bandit
Quote this message in a reply
Member
Posts: 81
Joined: 2007.07
Post: #2
Yes, OpenGL is a must, if your starting out use the http://www.cocos2d-iphone.org/ library.

The new hardware is so powerful I would just create and display all assets in the highest resolution. Then after you are totally done with the game, profile and optimize from there.
Quote this message in a reply
Moderator
Posts: 3,574
Joined: 2003.06
Post: #3
Hi Bandit! Smile

- Physics based, going to use an Open source C++ library if possible.

Since you're going to do 2D, look into Chipmunk physics. It's written by one of the senior members here and it's really well done.

- Universal binary.

If you mean that it will work on iPhone and iPad equally, then you mean Universal Application. The binary itself runs on both platforms, with the only difference being the resolution/aspect.

- Simple sprite animations required. Probably using a texture atlas (texture sheet) and index into this with UV coords to animate if I use OpenGL ES.

Yes, that's a good way to do it.

- More than a few objects on screen at once, maybe 50 or more, some animating or moving/rotating (physics).

That shouldn't be a problem.

- Sound, undecided at the moment.

Use AVAudioPlayer for background music and OpenAL for sound effects.

- Networking, undecided at the moment, but probably Facebook, Twitter score posting.

You can look into using OpenFeint. That's what we're using right now and it's been pretty good, although the documentation is a little thin and the API is a bit buggy around the edges. Very powerful though, and very popular with a large user base.

1) For a graphics API, I was considering using OpenGL ES given my requirements and research. Good idea?

Yes, use OpenGL ES. You'll probably want to use ES 1.1 since ES 2.0 isn't supported on the vast majority of iPhones/iPods yet. Most of us are still using 1.1, I believe (I know I am).

2) Resolution independence (to work on 1024x768 iPad and 480x320 iPod) - wow, didn't realize this was such an issue because I've never done a 2D game before only worked on 3D!!!

Honestly, 3D is much easier to be resolution independent with. If you're good with 3D, you might consider sticking with that Wink

Going back to the 2D subject: You can make assets that are optimized for the iPad's rez and can generally scale them by 0.5f to fit pretty nicely on iPhone from what I've found. The problem with that is that iPhone memory requirements are very tight. You'll probably want to fit everything within about 20 MB or less, so large graphics are going to cost you. So because of that, even though scaling down works, I generally use one size for iPhone and one for iPad.

As a personal piece of advice: Always keep in mind that there are 50 thousand games already out there on iPhone. The chances that you'll make much at all are very very slim, so make sure you're doing it primarily for fun, with the outside chance you might earn a little if it's really good and/or you get really lucky.
Quote this message in a reply
Member
Posts: 227
Joined: 2008.08
Post: #4
I imagine for the scaling that you could scale it in software before loading into OpenGL ES.
Quote this message in a reply
Moderator
Posts: 3,574
Joined: 2003.06
Post: #5
Oddity007 Wrote:I imagine for the scaling that you could scale it in software before loading into OpenGL ES.

Oh yeah, I forgot to mention that. That works too, especially well with the 50% scaling.
Quote this message in a reply
Apprentice
Posts: 12
Joined: 2010.04
Post: #6
Wow guys, thanks for the great responses so far! Very informative and useful resources! And I am definitely doing this for fun, making any money off of it would just be a nice bonus. Grin

After reading, concerning graphics I do like the idea of performing some scaling operation. Mainly because it reduces my efforts by not having to create 2 separate art assets for both platforms and makes the game more portable. I suppose if I did create 2 different textures, I would a) Have a larger project in the iStore with all the resources or b) Have a 2 separate smaller projects in the iStore? Or, would it be one project in the iStore but you automatically get the proper one for the platform the user says "buy/install" on?

Sorry that was slightly off topic. But yeah, I do like the scaling idea especially if it produces decent results from an art standpoint. So, I would have the maximum detailed "native" size texture, at run-time load the texture from a file, scale it to be smaller in system memory, then hand it off to OpenGL ES correct?

Ideally, I was going to build a level editor (not uncommon it seems), and have my game items be positioned based on normalized coordinates (between 0 and 1 on x-y axis). Then, my thoughts ORIGINALLY were that I would do a non-uniform scale to make everything be within the same relative position on any platform. But, with a non-uniform scale you would get a squished circle or ellipse for ex. when you really wanted a perfect circle, not good and I don't think I could accept this personally on game items/characters, it would drive me crazy even if it was just a little distored! Rasp So it seems uniform scaling (by 0.5f or a calculated factor) would have to be done to keep game item proportions correct. So, a fat-wide guy would on iPad would still be a fat-wide guy on iPhone, just uniformly smaller. And as far as backgrounds go (take up entire screen) I suppose they would have to be clipped OR stretched or squished a bit, no way around this as I do not want black bars or anything of the sort. But, I do not plan on scrolling atm, so I would hate to clip out any detail in my background textures, so I suppose non-uniform scaling in this case would be okay.

Also, do all textures have to be powers of 2? If this is the case, no matter what you do there will be some distortion as it stretches/linear interpolates across the quads correct?

Sorry for so many questions, I'm hoping as I learn more and do more practical work I can contribute more on the forums as well. Smile Thanks again!
Quote this message in a reply
Moderator
Posts: 3,574
Joined: 2003.06
Post: #7
Bandit Wrote:I suppose if I did create 2 different textures, I would a) Have a larger project in the iStore with all the resources or b) Have a 2 separate smaller projects in the iStore? Or, would it be one project in the iStore but you automatically get the proper one for the platform the user says "buy/install" on?
It would be case A.

Assuming we're talking about a universal application here: The user downloads the app from the App Store and the app contains all the resources for both iPhone and iPad. They can then install it on any device they have without restriction. Since the binary is the same, you have to detect which platform you're running on to determine which resource to load.

Bandit Wrote:So, I would have the maximum detailed "native" size texture, at run-time load the texture from a file, scale it to be smaller in system memory, then hand it off to OpenGL ES correct?
Correct. Definitely worth a try. If it doesn't give you satisfactory results then you can always just have two separate files -- one for each platform.

Bandit Wrote:Ideally, I was going to build a level editor (not uncommon it seems), and have my game items be positioned based on normalized coordinates (between 0 and 1 on x-y axis). Then, my thoughts ORIGINALLY were that I would do a non-uniform scale to make everything be within the same relative position on any platform. ...
Yeah, this is a tough call and can be hard to work out between the two platforms. For 2D, what I do is use screen coordinates. That is, 320x480 on iPhone and 1024x768 on iPad, not normalized like 1x1 and 1x1. Then what I do is translate the scene to be half way in the middle so that 0, 0 is at 160,240 on iPhone, and 512,384 on iPad. Then what I do is translate all elements relative to zero. This is particularly good for HUD elements, but for positioning game elements you might need to keep your playing field square and then scale the positioning elements for the platform. Bottom line: This isn't real easy to work out in many cases.

Bandit Wrote:Also, do all textures have to be powers of 2?
Yes.
Bandit Wrote:If this is the case, no matter what you do there will be some distortion as it stretches/linear interpolates across the quads correct?
It's not a problem because you can just take a portion of the normalized texture coordinates. You'll understand what I mean by that when you get to fiddling with it.
Quote this message in a reply
Member
Posts: 446
Joined: 2002.09
Post: #8
Bandit Wrote:After reading, concerning graphics I do like the idea of performing some scaling operation. Mainly because it reduces my efforts by not having to create 2 separate art assets for both platforms and makes the game more portable.
Although it may seem like a clean-cut solution, scaling down at runtime can sometimes be problematic, especially if you're using texture atlases. One example is edge pixels getting smeared and bleeding into adjacent textures. I ended up shipping my iPhone-only game Pollywog with pre-scaled atlases for this reason (512px for 1st gen devices, 1024px for the rest).
Quote this message in a reply
Apprentice
Posts: 12
Joined: 2010.04
Post: #9
Wow, well there is certainly a lot to think about. I guess given all this information I will have to start experimenting and working through things to see what works and does not work. I was hoping for a universal "correct" solution, but it seems there are pros and cons to all approaches in some respect or another. Smile Thanks guys for all the help! I will update if I find anything new or interesting.
Quote this message in a reply
Apprentice
Posts: 12
Joined: 2010.04
Post: #10
Just a quick update for anyone interested.

Got my Mac-mini delivered today. Gonna start development work on that soon.

I've been creating a 2D level editor in Windows in Visual Studio using C# and XNA. So far I have this done:

- Simple GUI, windows forms, File menu, toolbar. Main viewport, etc.
- Create objects dynamically from a drop-down menu (using reflection).
- Sprite texture window, UV coordinate editor using marquee box.
- translation, rotation, scaling widgets. Transforming objects.
- Single selection of objects and marquee selection (uses back buffer and color indices as a technical fyi).
- Create sprites by point clicking, or marquee drag-click.
- Object list window.
- Property grid window showing objects properties and is editable.

TO DO:

- Adding physics objects.
- Copying of objects.
- Bunch of other stuff. Smile

The objects will be saved to a XML file probably (Don't want to mess with binary if not needed) and be used and parsed game-side. I know there are other game editors out there, but I thought I'd give a go at making my own as I don't have tons of requirements, and I want to obey the KISS principle. If it turns out good I'll probably release it as a free resource for the community. Smile

- Bandit
Quote this message in a reply
Apprentice
Posts: 12
Joined: 2010.04
Post: #11
I was just wondering what people's thoughts were on hardware generated mipmaps for 2D games. I've been considering using the 2 texture approach, one for iPod and one for iPad. Has anyone used a high-res texture (iPad) and just used mipmaps, say 2 chain (e.g 512x512, 256x256)? I know mipmaps are usually used for 3D games, and filtering occurs depending on distance. But, does OpenGL know how to filter if all sprites are on the same Z value in world space, but are being rendered on different resolutions? So, my sprite might take up 400x400 pixels in screen space on one platform, but 200x200 pixels on a lower res platform. Will it filter properly for this scenario between the 2 mipmaps? My other concern is of course memory limitations in VRAM. I haven't been able to find if the graphics processor for iPad/iPod has it's own VRAM or whether it's shared with RAM or something. Any experience in this area would be great! Thanks!
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #12
Bandit Wrote:But, does OpenGL know how to filter if all sprites are on the same Z value in world space, but are being rendered on different resolutions? So, my sprite might take up 400x400 pixels in screen space on one platform, but 200x200 pixels on a lower res platform. Will it filter properly for this scenario between the 2 mipmaps?

The simple answer is yes. Texture filtering doesn't care about Z position or anything like that; it's based on the final dimensions of the texture as it's being rasterized to the framebuffer.
Quote this message in a reply
Post Reply