Recommended Posts

I'm currently developing a Tetris-style game. This isn't my first project, as I've completed several other games (including another Tetris clone) before but the project is more focused on understanding the structure of a more developed game.
I'm currently struggling with resource management. I've divide all the game logic into a LogicServer class, but I need to access the "shapes" of the falling tetriminos, presumably from some form of global resource pool. Could someone please give me an overview of how this is implemented?
Adam.

0

Share this post

Link to post

Share on other sites

Personally I would just use some sort of global to begin with. Then I'd migrate it into a class later. There's not really any right or wrong, just ways that make it easier for you and ways that make it harder, and they in turn really depend on what exactly you need to achieve.

What're you concerned with representing; the types of tetramino, or the instances? Personally I would probably discard individual tetraminoes as soon as they settle, so really you only need to store 1 at any one time, plus maybe 1 more if you have a preview or something.

I tend to have a Game class; anything specific to the game can usually be a member of that class. I don't go in for any complex resource management until I know I need it. I don't think I would need it for Tetris.

0

Share this post

Link to post

Share on other sites

I'm actually concerned with storing the types of tetrimino more than particular instances.

Within my logic server I hold a copy of the currently active tetrimino and the next to spawn, when a block settles it's amalgamated with the game matrix and the next block is copied to the current tetrimino. I then need to spawn a randomly chosen block from the resource cache into the "next" holder.

I'll give your ideas about a global resource pool a shot, and use what I learn from that to turn it into a server!