Tuesday, March 17, 2009

Open GL'n

The "organize" approach is still paying off. Well that and getting a hook up that lets me use my much larger PC monitor with the dinky macbook monitor.

So I've moved onto OpenGL on the iPhone which will end up being the way we render most of the graphics in the game. So far, I've simply just reproduce the demo I created using Core Graphics techniques. Next step is to "kick it up" a notch.

For my next demo, I'd like to master a few different things:

Demo Overview
Create a field of sprites that are running an animation. Allow the user to click on the screen and have the camera ease to that position. Allow the user to also click and drag to slide the camera along that specific path. Allow the user to zoom out and move around then zoom back in.

Demo Goals
  1. Learning how to draw 2d textures
  2. Create a 3dVector and 4x4 matrix class
  3. Creating a "frame" class that allows for easy maintenance of matrix (possible space for nesting frames..but this may not be necessary)
  4. Creating a functional camera class
  5. Detecting and using drag events
I feel this should be plenty to do over the next couple of weeks. I'm not working every single day after work cause I found this burns me out and leaves me an even grumpier mess so I've been moving at a slower pace and finding that I am more productive during that time then just plain hatin' myself (I have some serious issues).

Once I got a basic OpenGL renderer up (a modified EAGLView class created with the GL template from XCode), I started getting this ol' feeling of new Flash Development. While its not a scripting language by any means, the enviroment has so much built in functionality that I'm finding I can move onto fun stuff pretty quickly without worrying about every piece of technology to do every little damn thing. Flash is a lot like that. You get a lot provided for you, its just a matter of using it. Once I get the camera panning around, I'll get that nerd excitment I've wanted for a while.

Tuesday, March 10, 2009

Xml Issues!

I'm still working on the writing aspect of my tech demo and fortunatly I've discovered a handly little set of code called APXML which I hope to use tonight to solve this. It allows XML to become editable and then produces a string you can then use to write it back out. While I'll still be using a binary format for some data down the road, this at least lets me make xml files for debugging purposes.

Saturday, March 7, 2009

Sensible Planning, Better Tommorow

After having some frustrations with my initial outings into iPhone Development, I took a moment to sit back and rethink my approach. Initially I was being a bit brash and trying to do things quickly and in a "hack-code" format. This usually entails trying to get around making properly organized code and doing things the dirtest fashion. What I've noticed so far is that its not that easy in iPhone development to do everything in one class/file.

Anyhoos, I approached it with a better head and took time to organize the code and was able to get most of the demo listed below done. I still haven't figured out how to save data back out so that will be the next thing I attempt.

After this, its time to redo the whole demo using OpenGL ES. Right now I'm using "Core" graphics which is apparently not good for games which have to constantly update the screen.

Monday, March 2, 2009

Note

So found some stuff on how XML parser works in Cocoa. Apparently the parser is only designed to use a delegate for callbacks when it finds elements. This makes things a little interesting when creating stuff but it really should be a problem. Pretty much need to use a NSXMLParser along with NSData objects to parse / read in file. Also found that the developer documentation on the apple (http://developer.apple.com/documentation/Cocoa/index.html) is very good. Gonna start using that more often.

Additional Note: The delegate is just one object that could possibly implement all the callbacks. So you just assign it this object.

Target Demo

I'm pretty insane about keeping solid objectives when I program. Whenever I don't I tend to get unfocused and frustrated. In that interest, I'm going to start doing these "Target Demo" posts that will lay out (in more detail then first post) what I'm trying to achieve with a demo.

Focus:
  • Reading/Writing
  • Touch Events
Objectives:
  1. Create a basic window that allows us to create some text dynamically. There should be some sample code that does this. Draw the text at some random location (could be just <0,0>). Use the whole View model to make a drawing space - this should be done automatically by OpenGL template code.
  2. Allow for touch events to move the text. Click and text will appear at that location.
  3. Create or use some data system to fetch text from file. Also save position every time you click. When application closed and restarts, text should appear it last clicked location.
  4. Add a background to text by drawing a colored rectangle. Have rectangles properties come from file io.
Tech: these are possible techs we may use / create
  • SQL Lite - for data writing/reading. Could be useful to query information with vs xml but doesn't seem like it would be friendly to edit outside program.
  • XML Reader - idea to learn how to get an xml file loaded and read in values as well as write out to it. See if we can get this system up too.
  • vec2 - 2d vector for storing rectangle position/dimensions in our own controllable format.