Skip navigation

Category Archives: Graphics

Just finished my portfolio and my new business card design.  Take a gander:

Business Card Mark II

Portfolio 2009

I decided to go with the maze game for the iPhone/iPod Touch.  It will consist of a target that will either be circular or cuboid that the player must move to the end point using their fingers to guide it.  Touching a wall or object will set the target back to the last checkpoint.  I haven’t decided whether I want to implement lives or a timer.  I will try both and see which one playetesters enjoy more.  I think lives will be best, but that remains to be seen.  Simple game with some decent potential, here’s what I have for the “boring architecture part”:

Graphics

  • Don’t need texture loading (that I can think of)
  • Simple style of colored shapes
  • View scrolling when the target gets to the edge of a defined area.
  • Will have to rebuild Radiance to make sure all of this works well.

User Interface

  • Basic Cocoa UI elements, using Radiance I can overlay what I need.
  • Want to experiment with different kinds of menus and UI displays.
  • Need to make sure view scrolling is adjustable.

Physics

  • Implementing Separating Axis Theorem which requires rebuilding Continuum.
  • Need to detect edge triggers for things like doors and victory conditions.
  • Unit test the crap out of my revamped vector system and rotation implementation.

Game Logic

  • Target resets to last checkpoint after (5) seconds of not being touched.
  • If the target touches an edge or another object, reset.
  • Timer?  Lives?  TBA
  • Later levels will have the target orbit the touch point.
  • Later levels will have multiple targets.
  • Later levels will have multiple targets with independent end points.

Level Builder

  • Grid system to start, build level with “positive” tiles on negative background.
  • Want to implement this in Lua to allow for greatest flexibility.

So, that’s pretty much the gist of it.  I have a lot of work to do.  Already rebuilt the vector class I was using to be a little more friendly.  Looking into SAT implementations.  I understand the concepts, but I’m unsure about implementation.  This is gonna be a lot of work at a difficult time.  Cross your fingers…

A quick update on my game engine (did I forget to mention: I’m building a game engine) and the particle engine in specific:

My particle engine is not cooperating.  I finally have point sprites working, but loading in new textures for the sources corrupts my particle textures AND the source textures, so I’m at a total loss.  All attempts to start the engine over have failed for seemingly no reason, so I’m chopping up my original test to make it work better.  It seems that I will have to step back and redesign the architecture (again).

On a lighter note, I figure the particle engine is mostly fluff at this point, so game prototyping and stress testing will begin shortly.  I have many things I’d like to get in place before I start building real demo games, but simple prototypes will be small enough and simple enough to be able to ignore many of these improvements.

Wow, I’m really in over my head with this one, but the sense of achievement is unparalleled.  Anyway, I hope to have some news on the engine later (for those of you who care…).

Success! I have **FINALLY** gotten point sprites working correctly. After much struggling, frustration, and a slew of websites that offered little to no help whatsoever here is my answer:

To use textures with point sprites you need to do the following:

  1. Find out the limits of your point sprite implementation by using the glGetFloatv( GL_ALIASED_POINT_SIZE_RANGE, <float[2]>) call. This will populate your <float[2]> with the upper and lower limits for your texture sizes (generally, but not always, 1 and 64).
  2. Load in your texture, enable it’s type (I believe that it MUST be GL_TEXTURE_2D), and bind the texture.
  3. Enable GL_POINT_SPRITE_ARB and set attenuation, fade thresholds, and pass in the min and max sizes.
  4. Set texture coordinate replacement parameters using glTexEnvi( GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE).
  5. Specify your point size, using glPointSize(<float>) and (optionally, mostly for particle systems) turn off the depth mask.
  6. Call glBegin( GL_POINTS ), specify 3d vertices, and then glEnd.

Here is the exact code I am using. The loadPoTTextureFromImageNamed: call returns a texture containing GLuint data and a GL_TEXTURE_2D type. Other than that, it’s all pretty self explanatory. Let me know if you find something out of whack. Hope it helps!

 

//Make space for particle limits and fill it from OGL call.

GLfloat sizes[2];

glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, sizes);

//Create the texture we want to use.

BBSTexture* t = [BBSTexture loadPoTTextureFromImageNamed:@”Particle1.png”];

//Enable our texture type (in this case, it must be GL_TEXTURE_2D)

glEnable([t type]);

//Bind the texture data.

glBindTexture([t type], [t data]);

//Enable blending and set for particles

glEnable(GL_BLEND);

glBlendFunc(GL_SRC_ALPHA, GL_ONE);

//Enable point sprites and set params for points.

glEnable(GL_POINT_SPRITE_ARB);

float quadratic[] =  { 1.0f, 0.0f, 0.01f };

glPointParameterfvARB( GL_POINT_DISTANCE_ATTENUATION_ARB, quadratic );

glPointParameterfARB( GL_POINT_FADE_THRESHOLD_SIZE_ARB, 60.0f );

//Tell it the max and min sizes we can use using our pre-filled array.

glPointParameterfARB( GL_POINT_SIZE_MIN_ARB, sizes[0] );

glPointParameterfARB( GL_POINT_SIZE_MAX_ARB, sizes[1] );

//Tell OGL to replace the coordinates upon drawing.

glTexEnvi(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE);

//Set the size of the points.

glPointSize(32.0f);

//Turn off depth masking so particles in front will not occlude particles behind them.

glDepthMask(GL_FALSE);

//Save the current transform.

glPushMatrix();

//Begin drawing points.

glBegin(GL_POINTS);

//Iterate through our particles, setting the color and specifying their position.

for (Particle* p in particles)

{

glColor4f([[p color] magnitudeX], [[p color] magnitudeY] – [p lifespan], [[p color] magnitudeZ] – ([p lifespan] * 2), [[p color] magnitudeW]);

glVertex3f([p x], [p y], [p z]);

}

glEnd(); //Stop drawing points.

//Return to the previous matrix.

glPopMatrix();

 

You are free to use this code in any manner you see fit.  Have fun with it!