Sunday, January 22, 2012

Breakthrough on 3d dice

So Friday and Saturday, I made a breakthrough on my Yahtzee game. I found a tutorial online that went over creating 3-dimensional dice and I combined that with a 3d room I had created earlier when I was learning how to use panda3d. So I ended up with a very cool looking view of a stone room with dice floating around. I put a button at the bottom of the screen that acts as a throw button. The button is also an image of one of the dice being thrown, so when the dice are in the air, you get a very cool rotating 3d model of a die in the corner of the screen. There's a video below of what I've got so far. The next step in this is making the player able to pick dice to keep out and not throw the next time the dice are rolled. For that, I'm going to have to include some code that was written for my Senet game. That code has functions for allowing the mouse to select an object in the 3-dimensional space with the 2-dimensional pointer and screen. Since the only element of the dice game I have at present is the throw button, and it is in the render2d library, the functions already in it for clicking will not work for clicking on the dice in the window. An alternative solution, that I may try, is to keep a display on the side of the screen that shows the current dice values. That way the part that is to be selected with the mouse would remain in the render2d library and new functions could be kept to a minimum. I'll have to decide which of the two options would be preferable based on user interface design and coding feasibility. The code is a bit too long to paste any in here. On Monday, once it has been cleaned up a bit, I'll either post segments of it, or provide a link to download the entire file.

No comments:

Post a Comment