Jump to content
  • Advertisement

doctorsixstring

Member
  • Content Count

    992
  • Joined

  • Last visited

Community Reputation

388 Neutral

About doctorsixstring

  • Rank
    Advanced Member
  1. doctorsixstring

    Color Interpolation

    The article looks to be about three years old, based on the first comment in the associated thread. I just did some research on rendering heightmaps with multitexturing and shaders, and it seems promising. However, wouldn't multitexturing limit me to a small (4-8) number of terrain types? I suppose that many terrain types would be pushing it for a heightmap, anyways. For curiosity's sake, is there any solution to the original question?
  2. doctorsixstring

    Color Interpolation

    This image is of three separate, overlapping triangles where each triangle has a single vertex with alpha 1.0 (the other two verts are alpha 0.0). When rendered together, the accumulated alpha at the center of the final triangle is less than 1.0 (it seems to be closer to 0.7). I expected the triangle to be 100% white (i.e. the sum of the alpha for each pixel from the three triangles is 1.0). What can I do to achieve this effect? Is it possible to adjust the color interpolation equation? FYI, I'm trying to develop an alternative solution to the "dark center of triangles" problem described in this height map rendering article.
  3. doctorsixstring

    relative path for image.load()

    Wow, you learn something every day. Hollower's comments make more sense now. I'll keep that in mind, since I want to support Mac with my Python game development, which has so far been limited to Windows and Linux.
  4. doctorsixstring

    relative path for image.load()

    The simplest solution is to just store your art in the same directory as your py script, and use a relative path to load it.
  5. doctorsixstring

    Gravity and Solid?

    OpenGL is only a graphics library. It won't help you with physics (gravity) or collision detection with walls and other entities in your game world. Look for some decent articles or libraries under those topics.
  6. doctorsixstring

    GLSL tc_offset variable

    Quote:Original post by Yann L Keep in mind that uniforms declared without being actively used by the shader will be optimized away by the GLSL compiler. That makes perfect sense, and I immediately noticed the problem after reading this. If you look closely at the code in my original post, you'll notice that I was simply setting gl_FragColor = sample[1]. A multi-line comment was started (but not ended) after that, so the tc_offset usage was optimized away. I just changed it to the following code, and glGetUniformLocation returns 1 for the variable, and glGetProgramiv with GL_ACTIVE_UNIFORMS returns 2. gl_FragColor = (sample[0] + (2.0*sample[1]) + sample[2] + (2.0*sample[3]) + sample[4] + (2.0*sample[5]) + sample[6] + (2.0*sample[7]) + sample[8]) / 13.0; Thanks!
  7. doctorsixstring

    GLSL tc_offset variable

    That makes sense. I did some reading on glGetUniform, and it looks like I first need to query the location of a uniform variable with glGetUniformLocation() before setting it with glUniform(). If that's the case, then I'm not sure what I'm doing wrong. Calling glGetUniformLocation for the tc_offset variable returns -1. Calling it for sampler0 returns 0, so that seems to indicate a problem with tc_offset. I also tried creating other variables (e.g. "uniform int a;"), but -1 was returned for those, too. I also noticed that calling glGetProgramiv with GL_ACTIVE_UNIFORMS returned 1, regardless of how many uniform variables I declared. Here's a code snippet. I'm using Python, but the GL calls should be clear regardless: self.program = glCreateProgram() glAttachShader(self.program, fragmentShader) glLinkProgram(self.program) glValidateProgram(self.program) print glGetUniformLocation( self.program, "sampler0" ) # returns 0 print glGetUniformLocation( self.program, "tc_offset" ) # returns -1 That code is executed after creating and compiling the shader (stored in the fragmentShader variable).
  8. I'm trying to implement the blur fragment shader from the OpenGL Superbible, but I'm confused as to where the tc_offset variable is being set. Here's the code: uniform sampler2D sampler0; uniform vec2 tc_offset[9]; void main(void) { vec4 sample[9]; for( int i = 0; i < 9; i++ ) { sample = texture2D( sampler0, gl_TexCoord[0].st + tc_offset ); } // 1 2 1 // 2 1 2 / 13 // 1 2 1 gl_FragColor = sample[1];/*(sample[0] + (2.0*sample[1]) + sample[2] + (2.0*sample[3]) + sample[4] + (2.0*sample[5]) + sample[6] + (2.0*sample[7]) + sample[8]) / 13.0; } Is tc_offset automatically set to the texture coordinates of the neighboring texels, like sampler0 is automatically set to the first texture unit?
  9. doctorsixstring

    What is best language for 2D game ?

    Python does have type safety. It does type-checking at runtime, rather than compile time. In other words, its type-checking is dynamic, rather than static. Also, Python is not a new language by any stretch. The version appeared in '91. It is very robust and has a huge community behind it. As for the OP, I agree with the earlier recommendations for C# w/ XNA or Python w/ Pygame (or Pyglet). I use Python for my gamedev, and C# at work.
  10. doctorsixstring

    Hitpoints Outdated ?

    An Alternative View of "Hit Points"
  11. doctorsixstring

    Hitpoints Outdated ?

    Quote:Original post by lostzac ...I just think no matter what level you are you get whacked on a few times with a sword you should feel it or be going down...it lacks a certain realism. I remember hearing somewhere about hit points representing both physical health and a character's ability to avoid being hit. You could say that a player with 100 hit points could still be killed by a single sword strike, but he is five times better at dodging than a character with 20 hit points. You could probably come up with other reasons to suit your game.
  12. doctorsixstring

    Saving files in Python

    Check out the pickle module for serializing objects into strings that can be read from and written to files. There is even an example showing how to write a serialized object to a file.
  13. doctorsixstring

    Motion equation with gravity

    Thanks for the replies, guys. I'll go ahead and start working on using fixed-length time steps, and running one or more updates per frame, depending on frame length. I'll apply gravity, ship thrust, and other external forces as a summed acceleration vector at the start of each frame. Since we've established that it would be extremely difficult to create a single formula, I won't be able to use it to solve for vehicle thrust with a desired final position. So in order to calculate power and angle of launched missiles, it sounds like I'll need to use brute force to calculate a solution. I will calculate each frame's update logic ahead of time and see where the missile will end up. If it misses, I'll keep re-running the trajectory calculation for a slightly changed power/angle until the missile hits. This seems pretty computationally expensive, but I don't see any other way.
  14. doctorsixstring

    Motion equation with gravity

    Given the motion equation (d = v*t + 0.5*a*t2), I can find a vehicle's position after a given passage of time with a given starting velocity and constant acceleration. Solving this equation for two dimension allows me to calculate spaceship movement in a Gravity Wars-style game. That same formula can also be used by missiles that the ships will shoot at each other. Now I want to throw in some gravity wells (planets, black holes, etc.). How can I calculate the final position of a missile or ship at a given time, with an initial velocity, acceleration, and one or more sources of gravity? Is there a formula for calculating the trajectory of a vehicle with those parameters? I know I could simply apply gravity to the ship's position each game tick, but that would yield different results depending on the length of each tick. I would really like a solution that yields identical results regardless of the change in time. Any thoughts? - Mike
  15. doctorsixstring

    Newbie lost in space game

    Quote:Original post by Lezbein Can anyone elaborate on this idea any more? Explaining a direct example,like how would the program calculate a mountain from a far then near? Or how would a seem less entry from space into the planet's atmosphere -through the clouds then to the the ground- all work? Check out fractals and Perlin noise. Fractal Fractal Landscape Perlin Noise
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!