Tag Info

New answers tagged

0

The diamond problem shouldn't ever happen as a result because you would never have two classes that inherit from the same class up the tree both applied to the same entity. Never say never. I bet you within all those 90 behaviors, you will have a diamond problem. Even worse if you don't notice it. From the small example, it seems you actually want ...


1

Multiple inheritance is sometimes the right thing to do. You probably shouldn't inherit both from Car and OilRig, but inheriting from both Walker and Talker can make a lot of sense, particularly if using delegation would introduce a lot of trivial delegating methods that are a pain to maintain. It is particularly benign if it verges on emulating traits or ...


6

Just extending Karl Bielefeldt idea for a 2 walls reflections: A and B are given (the tanks). You first must list all walls that A can see and a list of all walls B can see. Then you make pairs where the first wall is in the fist list and the second wall is different from the first wall and is in the second list. You need to make this test for all possible ...


6

Given a direct line of sight, the problem is obviously trivial. However, we are dealing with reflection. Properly finding out which parts of the scene can be seen is challenging when implementing reflection as part of a ray tracer, since this might miss some openings. A “binary search” between two promising angles is also not viable: due to the reflections, ...


3

Because key polling usually happens at the very top of the game loop, the specific question you're asking is hard to separate completely from all the other extremely important issues one needs to be aware of when designing a game loop (Gilbert's comment appears to be referring to some of them). To get those out of the way, I'll simply suggest you read this: ...


1

You have neat diagrams showing how to direct rays, so I'll leave the details on how to determine a pair of reflecting surfaces. Let's call the surface that must be hit first surface A, and the second, B. Try to hit the (visible) edges of B by shooting at A. In other words, determine the points where one would see reflections of the ends of B if looking at ...


3

You can take advantage of the fact that the angle leaving the ricochet must be the same as the angle entering it. For a given horizontal wall with y-coordinate c and two fixed tanks with coordinates (a,b) and (d,e), there is only one angle which satisfies the equation below. Just solve for x to get the distance along the wall at which you must aim. Two ...


-2

First off, remember in physics class when you talked about refraction of light? Well your problem can be solved using those principles. The angle of incidence is equal to the angle of reflection. so the enemy tank needs to run through every possible angle for the first bounce so that the second bounce may hit the player. Keep going with the ray tracing idea ...


0

I am working on my own Java 3D engine with LWJGL which leads me to my answer below. I don't know much about JOGL. Both LWJGL and JOGL are just Java bindings to accomplish the same thing, which is to call native code that changes the OpenGL state of the current context. For example, in the current thread, a call in LWJGL to glCreateProgram() will call the ...


-2

Opengl has been designed as a C library, and it has the characteristics of procedural software. One of the opengl rules coming from being a C library looks like this: "When complexity of your scene increases, you'll have more handles that need to be passed around the code" This is feature of the opengl api. Basically it assumes that your whole code is ...



Top 50 recent answers are included