Some Newbie Questions

Hello,

I once again played a bit around using panda3d, which leads to questions :slight_smile:

To begin with something, I downloaded a water model and two ship models, trying to put someting “on sea”.

Question 1:
Whats the best way of creating a (static) water terrain? Using a Model? Or the terrain generator (if so, is there a good tutorial for this?)?

Question 2:

In a typical strategy game, you select your units by clicking on them. How does this actually work? Do I get the absolute coordinates the mouse clicks on, and then look if there is a model on this line of sight?

Question 3:

How do I put some 2D interfaces? If I managed to choose a model by clicking, how do I show statistics on it? For example, the name of it on a 2D interface. Of course this interface should also be interactive, so that I can change something in there which affects the model.

Hope thats not too newbie-like :slight_smile:
Thx.

  1. I suppose that this depends on what you want your water to do. Do you intend a water simulation (you mention that the model is static, so I imagine not)? Do you want any animation, and if so, do you want the geometry itself to animate, and if so, how? Do you want anything other than a flat surface (waterfalls, for example)?

  2. Once again this is likely to depend to some degree on your project, and in particular whether your selection is entirely 2D, or more 3-dimensional. If you can do with selecting from a plane, try the answer in this thread. If you want to pick 3D objects, then try this manual page. (In both cases you might want to look into Panda’s collision system, since both use it, I believe.

  3. Panda’s DirectGUI might serve your purposes, but I believe that there are a few other GUI systems available - try a forum search and you may find some. (I’m afraid that I don’t think that I’ve investigated any of them in any real depth myself.)

Thanks,

as for the water, for now its nothing more than a flat surface to put some ship models on it. When my project is a bit more evolved, I might want some animations it, showing some waves. But for now, maybe just a flat surface with some kind of ocean texture on it and the ability to show a shadow.

I will have a look into your answers for 2 and 3.

As to the water, in that case, why not simply use a single card (read: quad). Panda has a class called CardMaker that should allow you to create such a quad rather easily and which seems as though it should serve your purposes.

Hi,
for water a simple plane will do it for first. It’s up to you if you create that in a modelling suite (Blender, Maya, Max etc.) or if you use the CardMaker to generate a simple quad.

The selecting can be solved as you said: shooting a ray from the screen and looking at what it intersected. There’s a sample for exactly that in the chess demo. If that works too slow (you’ll have to try out), you might also consider having invisible primitives like spheres or planes that are attached to the models. Telling the ray only test collisions with these primitives should be much faster. For the quick beginning, however, picking the 3d models should be okay.

The GUI can be drawn either placing 3d models into the scene and letting them face the camera the whole time. You can also attach models to the nodes render2d, aspect2d or pixel2d, which are in turn all attached to the camera, so that if you put a model there it will stay in one place at the screen no matter how you move your camera. You can read more about that on the manual. The DirectGui Library works like this and ships some typical widgets, like buttons, sliders, panels and so on. Alternatively you can put a whole new layer on top of the rendered image (what you see) and put some third party GUI on top. LibRocket and CeGui are some examples of such GUI engines. Expect these to be more powerful and more flexible than DirectGui, but probably also a little bit harder to get into. For example, to use LibRocket you’ll need good understanding of HTML, XML and CSS.

However, when starting with 3d game development, I wouldn’t start with something as complex as an RTS. This game type involves a lot of Optimization, AI and other difficult topics. How about trying to make an extremely simple game like a pong clone or tetris just to get warm? You’ll notice that even in the most simple possible game you can reeeaaally put lots of work into it to actually make it a real game. Take a look at “Bit.Trip Runner” or “Shatter”. Both have such simple mechanics and yet they’re great, just because somebody put his heartblood into it. Even on such simple, little games you’ll learn a whole lot about game development, trust me.

Best luck and have fun.