New game

I am in the process of implementing a new game in panda. I got the concept for this game from http://www.squidi.net/three/entry.php?id=106. I thought I’d share the progress here.

So far I have the base data structure to store the game state, as well as the base classes for the field, formation, and unit. Most of the work so far has been on logic and data structure and methods to manipulate the formations on the field, but I did write a simple 3d view to help visualize the grid. This game will not be open source so I won’t be releasing any code. Here is a screen shot of the board after dropping 3 pieces onto the field and advancing them towards the ‘line of scrimmage’.

Here is some output from the game in ascii:
myField.grid
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0]

myField.formations: [<main.Formation instance at 0x042013A0>, <main.Form
ation instance at 0x04201558>, <main.Formation instance at 0x04201670>]

formation shapes:

16 , 10
[1, 0, 0, 1]
[0, 1, 1, 0]
[0, 1, 1, 0]
[1, 0, 0, 1]

13 , 9
[0, 0, 2, 0]
[0, 2, 2, 2]
[0, 0, 2, 0]
[0, 0, 0, 0]

10 , 9
[0, 0, 0, 3]
[0, 0, 0, 3]
[0, 0, 0, 3]
[0, 0, 0, 3]

Battle line: 10

And for fun, here is a 3d representation:

I added coloring of the tiles based on the formation they belong to.

-=Zanz=-

looks promising!

I’ve gotten the logic worked out for the pieces to fall visually and have captured a short animation of it. I’ve setup a queue to store the formations and the formations are added 1 at time then moved towards the LOS.

i love the concept and i cant wait to test it!

I have created a method to populate the queue with random formations generated from a list of valid shapes. The formations are then colored randomly(eventually this will not be random) and dropped at random starting columns. The next step will be to get some user interaction to steer the formations as they fall.

Here is one with a 40x40 playing field with 75 formations added. I also adjusted the lighting in this one so it looks more 2d.

You can see this is already starting to look a lot like regular tetris.

I replaced my tile model with the panda smiley and had to share.

And here is an army of pandas.

An epic panda battle:

I have gotten the user interaction added in. The formations can now be steered and rotated by using the arrow keys on the keyboard. Getting rotation to work right was tricky! :slight_smile:

I’ll try to capture an animation of it at some point. This is almost a fully playable tetris game now except that full lines don’t disappear, different camera angle (pieces appear to be falling sideways), and there is no scoring mechanics. I will most likely branch this into a regular 3d tetris game just for fun.

Here is what the field looks like after adding 50 formations and steering/rotating them into place. Been experimenting with different tile models.

Anyone have any suggestions/comments on this project so far?

I like it better with the pandas :smiley:

hi,

this is a very nice project :slight_smile:

I have one suggestion:
I think a frame around the gamearea would be good. Else you might have problems seeing the edges of the field.

blenderkid

I have worked out all the minor details in the steering/collision system as well as added a grid to show the playing field and a red line to show where the LOS is. Eventually the playing field will also have a texture on it. I added in my own soldier model that I made for testing purposes (though the poly count is a bit high for this). Eventually the models will not be colored like this, but will have colored bases indicating their formation, while the models themselves will be textured.

I have turned this into a 3d falling blocks game. I figured since it was so close to one already that I’d branch a version into this. I’ll be continuing with the battle game shortly as an extension to this. The game is totally playable now. Here is a screen shot. I’ll be adding some more eye candy soon so stay tuned.

-=Z=-

This looks great, keep up the good work! Do you plan on having the soldiers face different directions, or how is that going to work?

I’m planning on having the 2 units who are attacking each other, turn and face each other on the line of scrimmage. I added some more functionality to the game. I added a way to see the next piece that will be played.

In that case, it might be cool to always have all the soldiers facing outward, like they’re always ready to fight. You could maybe even add entrenchments or bunkers to show the no man’s land.

Here is a shot of the Game Over screen. The camera flys down to the board level.

I have decided to release the code for this game once I make a few more modifications under GPL license. Where is the best place to post the code? I have used google code and sourceforge in the past. Is there somewhere on the panda site to host such code?

Note that only the falling block game will be released. I will not be releasing the battle game that will be based on this.

That is appreciated. There is a p3dp.com/doku.php?id=:start that is used for panda3d projects. Have a look.

I have posted the code for this on the panda3d projects site. The code is released under GPL 3.0. Enjoy this code and let me know what you think.

The project website is: http://zanz.p3dp.com

-=Zanz=-

Good stuff.
Needs a restart game at the end, a high score feature, a full 3d version and you have a blockbuster :slight_smile:

You can start over by pressing F1. I didn’t add any text saying that. I will still be adding more to this. What do you mean by full 3d version?

I uploaded a new version that fixes a bug with the timer not getting reset.

I also added a high score!