Grid Puzzle Game
Posted: Fri Aug 15, 2014 11:06 am
Hello! New to Lua and new to game development, but having a blast so far! Pardon a newbie's questions.
Long story short, I'm trying to implement my own version of this: https://www.youtube.com/watch?v=X9UAIaZ30wg&t=30s
It's a straightforward puzzle game, so I figured I could get by just looking up how to do things as I go, but for the Love of me I can't find answers to some basic questions.
I'm wondering what some accepted approaches are to the following dilemmas:
1) The game has some frame-precise maneuvers to execute that I'd like to preserve. So far, I've created a framerate controller by incrementing a global variable "gametime" with dt every update call, and calling "advanceframe" everytime "gametime/fps" is a new number. If a button is pressed and "input" is nil, then "input = key", and "input" is reset every frame. So basically I ignore all but the first input per frame. Is this okay? Would this cause any noticeable lag with the keyboard inputs at 30fps? Are there better framerate models I could learn from?
2) I need to check for rows/columns of matching color, and find clusters. Not all clusters are equal though, due to chains. As I have the program set up right now, there is a grid with rows (to make it easier to add and remove rows, as the height of the grid is not fixed), and each row has a tile, which can either have its content be nothing, a block, or garbage. What's the best way to look for matches? Just brute-force for loops? As it stands, I don't know a good way to check columns.
3) I need things to happen at a certain time. For instance, .5 seconds after a match is found, the blocks must disappear in sequence. What's the best way to accomplish this? Would some sort of callback timer based on elapsed frames be a good approach?
Thanks for any advice at all!
Long story short, I'm trying to implement my own version of this: https://www.youtube.com/watch?v=X9UAIaZ30wg&t=30s
It's a straightforward puzzle game, so I figured I could get by just looking up how to do things as I go, but for the Love of me I can't find answers to some basic questions.
I'm wondering what some accepted approaches are to the following dilemmas:
1) The game has some frame-precise maneuvers to execute that I'd like to preserve. So far, I've created a framerate controller by incrementing a global variable "gametime" with dt every update call, and calling "advanceframe" everytime "gametime/fps" is a new number. If a button is pressed and "input" is nil, then "input = key", and "input" is reset every frame. So basically I ignore all but the first input per frame. Is this okay? Would this cause any noticeable lag with the keyboard inputs at 30fps? Are there better framerate models I could learn from?
2) I need to check for rows/columns of matching color, and find clusters. Not all clusters are equal though, due to chains. As I have the program set up right now, there is a grid with rows (to make it easier to add and remove rows, as the height of the grid is not fixed), and each row has a tile, which can either have its content be nothing, a block, or garbage. What's the best way to look for matches? Just brute-force for loops? As it stands, I don't know a good way to check columns.
3) I need things to happen at a certain time. For instance, .5 seconds after a match is found, the blocks must disappear in sequence. What's the best way to accomplish this? Would some sort of callback timer based on elapsed frames be a good approach?
Thanks for any advice at all!