A few (likely noobish) questions

Background (you can skip this)

Well, before posting my questions, I realized it’s probably better to say some words about my background. I am a Computer Science student, I have started panda3d/python a few days ago, but I have programed things for ROM translations/work for several years, mainly in raw C. I have already coded two “games” (a 3D Pacman and a 3D Enduro), both with C++/OpenGL.
Now I am taking a Computer Graphics Project discipline and the final project is a game, my group and I choose to code a RPG/strategy battle simulator and we picked panda3d as our chosen engine. The game is mainly a 2d-logic grid, where players move, attack and use spells/skills.

Real Questions:

  1. I programed the logical grid (by loading a model, getting its size and defining the number of rows and columns and creating a class for this matrix) but still I need to draw the grid, is there any function to draw squares or I do need to use some sort of image or model? Can I make them transparent in any way?
    I wanted to make it like this (but in 3d):

  1. Can I program multiple camera tasks and switch then over time?

  2. I need to map the squares that must not be drawn because the place is not reachable (such as tall rocks and trees). Have anyone seen a similar problem and can suggest some approach? I thought of using some dummy ball and go around the model with it and check collision, but I’m not sure if I would be able to detect very big objects like this.

Thanks in advance and sorry if those are too basic questions.

let’s see if I can help you: =)

  1. I guess panda does not have a function for drawing a basic plane, you might have to load your own model and apply textures. Yes, you can apply transparency, look at:

panda3d.org/manual/index.php/C … te_Changes
panda3d.org/manual/index.php/T … d_Blending

  1. you can add and remove tasks, for instance, you can use boolean variables if you want to skip them for a moment instead of removing and/or stoping em completely… do method later might be useful, look:


  1. I think you don’t need to use collision detection for this genre of game, probably a tactical role-playing game, since you can use your ‘matrices’ to know where you are able to move. For your big objects, if you want to use collision, you can model a low poly wall around them and use it for collision tests.

in your .egg file you have to add this tag:
{ Polyset keep descend } after the tag line

it makes solid the geometry of your model for collision tests.


  1. for drawing simple grids, there is a module in direct.directtools.DirectGrid, but if you need to draw very specific squares (color, place etc), you’d probably be better off with CardMaker (it creates rectangular geoms, see manual) and simple textures.

  2. what do you mean with ‘camera tasks’? in panda a camera can be active (means, its field of view is rendered) or inactive. independently of cameras you have display regions, which are buffers marked as ‘show this on the screen’. if this doesn’t answer your question yet: yes, you can have as many cameras as you wish and you can switch between them ehenever you want.

  3. see the roaming ralph example. IIRC it uses a ray to detect ground + a sphere to detect obstacles. in your case a simple collision-ray under the characters is enough as your ground (combined squares) is nicely separatable.

Thanks for the answers guys,

  1. I will try this tonight and give some backup tomorow.

  2. I solved this by creating an world class, that manages events and has a state, according to the state the camera function works differently. No need to more than one camera task.

  3. What I am trying to do is a method that loads any model and creates the grid table for that model. What I want to do is flag in the table that the cell is unreachable if there is something that normally would not allow a monster/player get there (such as a rock), so I wouldn’t need to check collision during the play. I’m still looking for a way to do this.

Not sure if this works for what you want, but have you considered having the player click where they want to go, then using A* to find the path instead of moving/checking if each move from square to square is legal?

  1. checking if each movement is legal until you find the shortest way to the square you are trying to move is the best way, if you detect collision only for the cell you selected to move probably the player will ‘pass through’ the rocks, trees and holes in the way, notice that I assume you are doing a turn based game in which you choose ‘move’ and select the square you want to move then the player walks to that spot;

you will have to work hard to do what you want since you have to know in which square/cell both rock and tree are. My suggestion is to check the positions of your rocks/trees to find out that square is unreachable;

if your squares are 24x24 and your rock is at (36,12,0), we suppose it is at the coords (2,1) so that you can flag your grid table coords (2,1) to “NOTALLOWED”, during the play when you check the coords (2,1) you will see that the player/monster is not allowed to get there.

how I know that:
tableCoordX = round(myTree.getX() / squareSize + 0.499) # round up
tableCoordY = round(myTree.getY() / squareSize + 0.499) # round up

modelGridTable[tableCoordX, tableCoordY] = “NOTALLOWED”

this is merely an example, you have to watch out for coords system of panda and your modelling software. you might have to do conversions and create some formulas.

self.objects = self.myModel.findAllMatches("**/tree**")
for tree in self.objects:
   flags the grid table according to the object position...

name your trees to something like that, ‘tree’, ‘tree001’, ‘tree002’, etc, so that the code above can find them.