game newb

drunknbass
Unregistered
 
Post: #1
hi, im kinda new to the game programming thinking.. i dont understand how to program logic for like puzzle games.. say stuff where you slide bricks around and have to match 3 in a row or whatever..

maybe there is something somewhere that summarizes this along with gravity so i can wrap my head around it and understand.. or maybe even cheap open source game t look at..
Quote this message in a reply
Moderator
Posts: 613
Joined: 2004.09
Post: #2
It will vary greatly depending on what you are doing. While there is no easy way to explain it once you get a pretty good hold on programming it starts to come together.

A game is not the first thing you are going to want to program if you have never coded anything before. Start with what is referred to as the "hello world" program. The biggest challenge is getting text to appear on the screen.

You are most likely going to want to learn C to start, there are some great web tutorials floating around but picking up a book at the local bookstore might do you well also. Once you understand Switch statements, if statements and loops you will see that logic is rather easy.
Quote this message in a reply
drunknbass
Unregistered
 
Post: #3
i have programmed before (c, obj-c, c++), but i program apps.. games seems like a whole new way of thinking.

im also getting into opengl but am not at the point id like to tackle a game yet.. i was thinking a puzzle type game done in cocoa and core animation.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #4
I don't see how games are any different from applications. Often more complex, perhaps, but fundamentally, you've got some data, some business logic that defines how it can be manipulated, and some UI for manipulating it.
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #5
drunknbass Wrote:i have programmed before (c, obj-c, c++), but i program apps.. games seems like a whole new way of thinking.

im also getting into opengl but am not at the point id like to tackle a game yet.. i was thinking a puzzle type game done in cocoa and core animation.

If you already have some experience with Cocoa, then I think Core Animation would be an absolute snap to pick up instead of OpenGL for 2D (at least for modestly non-complex stuff). I haven't tried CA on the Mac so I don't know how it is, but on the iPhone I find it to be very nice to work with. I think an experienced Cocoa dev could be rolling with it in an afternoon (well, that's about how long it took me anyway... YMMV I guess).
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #6
I wrote Pong with it in an afternoon, but 90% of that time was trying to make CA behave in ways it wasn't intended to Rasp

OpenGL suffers from texture loading being tricky, but at least drawing a quad where you want it is straightforward Wink
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #7
True, CA makes image loading a no-brainer in comparison to OGL, but it also makes battery efficiency simple too since it automatically handles rendering timers (i.e. turning them off when not animating). You can do that yourself with OGL as well, but it's just another little hassle to add to the list of todo's.

If I were doing a turn-based strategy game or puzzle game where you spend lots of time looking at it without anything moving in the scene, CA is a bonus there. Otherwise, for shoot em up arcade stuff (the scene needs constant animation), OGL is prolly the more sensible route.
Quote this message in a reply
Moderator
Posts: 682
Joined: 2002.11
Post: #8
You need to have been through high school physics or the self-taught equivalent to program most action games. Velocity, accel, etc.

My web site - Games, music, Python stuff
Quote this message in a reply
drunknbass
Unregistered
 
Post: #9
yea i know the gist of opengl, im currently getting my feet wet with glut then ill move onto opengles and get some sample stuff made.

i also know a decent amount of core animation , it just seems say a simple uzzle game where you match bricks in a row. and then they break and the rest fall down. like do you have some kind of cell matrix you use.

if i had a general understanding of how youd detect cells with a red value being in a "line"
Quote this message in a reply
Moderator
Posts: 613
Joined: 2004.09
Post: #10
drunknbass Wrote:i also know a decent amount of core animation , it just seems say a simple uzzle game where you match bricks in a row. and then they break and the rest fall down. like do you have some kind of cell matrix you use.

if i had a general understanding of how youd detect cells with a red value being in a "line"

This sounds like it might be just a tad too advanced of a project for the stage you are in right now, but it is a achievable goal within a couple weeks of learning some more background.

As far as the "matrix" what I would personally do is setup an array for all possible places a "block" can be. When a block occupies one of those spots I set a value in the area for the color of that block. At the end of each turn I test the array to see if there are objects that match in a row either up/down or across.
Quote this message in a reply
drunknbass
Unregistered
 
Post: #11
i think i have an idea.. each bloc can have values and track its current collisions. if a block has 2 or more collisions (of the same color) they would be removed. that seems like an easy logic to handle a simple puzzle game..
Quote this message in a reply
Member
Posts: 26
Joined: 2008.08
Post: #12
Provided that there's only one ball (or with more, even) you could really just find out where the ball is going to intersect ahead of time (ray -- line-segment collision detection) and wait until the ball "hits" to remove the blocks.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  SDL Loading bitmap (Newb) Bonked 4 2,787 Jan 13, 2007 10:55 AM
Last Post: unknown