• Content count

  • Joined

  • Last visited

Community Reputation

151 Neutral

About m41q

  • Rank
  1.   ok, good to hear   yeah... they don´t do that on my screen ^^. Anyway, because of this bug I tried a workaround with a brightness option, so even your screen would probably be fine ;-)
  2. Thx @all for the answers!   Ok, I´ll just finish my current ToDo and then will test all the things you suggested. It´s quite possible that I messed up something in the code and did not write it in the "standard-way" of doing it since this is my first time using GLSL. It looks like this language is a bit nasty compared to Java and its convenient Exceptions.   Btw, what do you think of the overall graphics quality? My friend always wants to know what others think of his work.
  3. It has been a while since I worked on the graphics (have been busy with other functionalities), but this bug still affects the game.   Every one that works on a computer with this bug is able to set the brightness to 50% and the overall lightness is good. But it doesn´t create the effect I wanted: Now everything looks the same, regarding brightness. There are no bright or dark parts like those on the computer where this bug doesnt occur...   What could  POSSIBLY  make the SAME shader work DIFFER ENT on different machines? Are there ANY possible circumstances that influence the calculations?   Still thanks if anyone knows anything...
  4. i still have not found the cause of the problem, but I think I at least was able to reduce the consequences of the bug: Now the player can decide for himself, what brightness suits him best.   But still, if anyone knows why there are different calculations on different pcs when using shader, an answer would be much appreciated.
  5. I had to program the same thing as well (just for a 3D game) and my current solution is this:   Whenever the server gets information about one clients position, he simply saves it (no cheat-prevention yet). As soon as he comes to the main loop, the position of all clients nearby a specific client is sent to that specific client. Since I have to transmit much more data than that (terrain, objects, actions, ...), I ran into those bottleneck problem you described.   To prevent these problems, everytime the server wants to send something to a client, he tells a client-object (i´m doing java, object-oriented) the data that he wants to send him. This objects simply saves all the data that is to be sent and from time to time the main program tells all client-objects to send a bunch of data. The client-objects now take the first 310 bytes and send them to the clients. Therefore, no problems with sending too much data is eliminated.     But maybe, I went to much in detail. I don´t know how much data you have to send altogether, but if it´s just a few bytes about position, you should be fine just sending all at once. The chunk of data shouldn´t be that "large".
  6. [quote name='MrLolEthan' timestamp='1356290785' post='5013740'] It's 3D and i'm using lwjgl (OpenGL) [/quote]   nice, me too ^^ To do the physics stuff, I use the JBullet engine, a java port of Bullet: http://jbullet.advel.cz/ Problem is, it´s a little bit outdatet and it has got an issue with direct and indirect buffers. To get it to work with my own project, I fixed this issue (can send it to you, if you want), but you will still have to take some time to break into working with this engine.   But once you got it to work properly, it does ANYTHING for you ^^ This thing uses bullet, too: http://vimeo.com/20760525   It may take some time to get it to work, but for me, it totally was worth it
  7. Yeah, it looks like version 1 is the better approach to get fast responses when pressing a key or something. But usually, if the game runs with 5 fps, no one will like to play it anyway ^^ Don´t think to much over something that simple. If you run into problems with the time the game needs to react, you are still able to change your code...
  8. it depends on what you want to do.   If you want to develop a game, I too would recommend using an existing engine, it´s much easier (and possibly better looking too, better performance...) You will have much more time to focus on programming the real gameplay-features.   But if you want to develop a game just for the sake of developing, this book really is a good starting point. You´ll get good insight in how game graphics are made for example, but it will take quite long if you want good looking results with good gameplay.   Your choice
  9. ok, checked Usually, the value of the lighting-variable should be 2 nearly all the time; but to be certain, I changed the code of the shaders to make them do always the same, regardless of the value of this variable. When we tested it on the problematic computers, no differences was to be found... Also, I tested it the other way round, now on my computer: I set the shaders to only act like lighting was 1 all the time. No great differences, just slightly darker and no directional light. So the lighting variable should act like it is supposed to act, thanks for the suggestion anyway. I think there may be some calculation of some vector or something that is done differently on both computers. To eliminate as many sources for errors as possible, I checked the version of OpenGL on the computers. We both use the same version, 4.2.
  10. Hi, I´m currently developing an online multiplayer game using OpenGL. Until recently, I used the fixed OpenGL rendering pipeline, but I (nearly) successfully switched to shaders (it looks MUCH better [img]http://public.gamedev.net//public/style_emoticons/default/wink.png[/img] ) But there is an issue with the lighting: On my computer everything is fine (I guess because I took suitable values for the lights) ; but on two other computers, the lightning is pretty much brighter than on mine. Therefore we can not figure out some good looking values for the light... Could it have something to do with me having ATI and my friend Geforce? Anyway, I´ll attach two images of the situation to this post. Now for the code: As far as the shader goes, here is the code of the fragmentshader: [source lang="java"]varying vec4 diffuse, ambient; varying vec3 normal, lightDir, halfVector; varying vec4 glColor; uniform sampler2D tex0; uniform sampler2D tex1; uniform sampler2D tex2; uniform int lighting; uniform int texturing; uniform int alphamap; void main (void) { vec3 n,halfV; float NdotL,NdotHV; vec4 color = glColor; if (lighting==1) {color*=2*ambient;color.a=1; } else if (lighting==2) { color*=ambient;color.a=1; n = normal; NdotL = dot(n,lightDir); if (true) { NdotL+=0.6f; NdotL/=1.6f; color += diffuse * NdotL; } } switch (texturing) { case 0: gl_FragColor=color;break; case 1: gl_FragColor=color*texture2D(tex0,gl_TexCoord[0].st);break; case 2: vec4 texture0 = texture2D(tex0,gl_TexCoord[0].st); vec4 texture1 = texture2D(tex1,gl_TexCoord[1].st); vec4 texture2 = texture2D(tex2,gl_TexCoord[2].st); if (alphamap==0) {gl_FragColor = color*mix(texture1,texture2,texture0.g); } else if (alphamap==1) {gl_FragColor = color*mix(texture1,texture2,texture0.r);} else {gl_FragColor= vec4(1,1,1,1);}break; } } [/source] Usually lighting equals 2 and texturing equals 1. There are some calculations in the vertexshader as well: [source lang="java"] if (lighting>=1) { ambient = gl_FrontMaterial.ambient * gl_LightSource[0].ambient; ambient += gl_LightModel.ambient * gl_FrontMaterial.ambient; } if (lighting==2) { normal = normalize(gl_NormalMatrix * gl_Normal); lightDir = normalize(vec3(gl_LightSource[0].position)); halfVector = normalize(gl_LightSource[0].halfVector.xyz); diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse; }[/source] Finally, I set up the lighting in the program itself: [source lang="java"]//Lighting GL11.glLightf(GL11.GL_LIGHT0,GL11.GL_SPOT_DIRECTION,180); GL11.glLightf(GL11.GL_LIGHT0,GL11.GL_CONSTANT_ATTENUATION,1); GL11.glLightf(GL11.GL_LIGHT0,GL11.GL_LINEAR_ATTENUATION,0.0f); GL11.glLightf(GL11.GL_LIGHT0,GL11.GL_QUADRATIC_ATTENUATION,0f); FloatBuffer lightPosition = BufferUtils.createFloatBuffer(4); lightPosition.put(0.0f).put(1.0f).put(0.0f).put(0.0f).flip(); GL11.glLight(GL11.GL_LIGHT0,GL11.GL_POSITION,lightPosition); FloatBuffer whiteLight = BufferUtils.createFloatBuffer(4); whiteLight.put(0.7f).put(0.7f).put(0.7f).put(1.0f).flip(); GL11.glLight(GL11.GL_LIGHT0, GL11.GL_SPECULAR, whiteLight); GL11.glLight(GL11.GL_LIGHT0, GL11.GL_DIFFUSE, whiteLight); FloatBuffer lModelAmbient = BufferUtils.createFloatBuffer(4); lModelAmbient.put(1.4f).put(1.4f).put(1.4f).put(1.0f).flip(); GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT,lModelAmbient); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_LIGHT0); GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glColorMaterial(GL11.GL_FRONT_AND_BACK,GL11.GL_AMBIENT_AND_DIFFUSE);[/source] Basically, the scene consists of a simple ambient light and one directional light (representing the sun). Now, I get that 1.4f may be a pretty high value for the ambient light, but when I turn it down, the scene gets very dark (at least on my computer). Do you have a clue of where to look for the mistake? Is there some kind of function or calculation that may be treated differently by different graphic cards or even by different versions of GLSL? It´s like one computer adds a certain value to the light and the other doesn´t... Thanks in advance for any clues
  11. ok, thanks for all the replies. I actually am working on the project for a pretty long time now, but switching still may be worth it. So I decided to learn more about shaders and program two or three and probably I will stick with them. "Master of my own lighting" sounds very good, but I´d rather like to focus on features for the gameplay[img]http://public.gamedev.net//public/style_emoticons/default/wink.png[/img] Even if I don´t use it in this project in the end, I hope it at least will be worth the experience.
  12. How to send data for an RTS?

    Hi, I´m programming in Java but I think the general concept may be useful for you too: The Data that I transmit is an array of bytes. The first byte determines wich data is sent (e.g. position of an unit,), the second the length of the data (e.g. 200 bytes). Next comes the data itself and then comes the next package. On the other side I read the first two bytes and then read the data and from the transmitted bytes I am able to assign the right values to the objects. You can convert ANY value into bytes and back. So if you have to send text, you convert it and when it is on the other side, you just reconvert it. But as a sidenote, multiplayer programming is hard... I would have been much faster with my own project if it wasn´t for the multiplayer [img]http://public.gamedev.net//public/style_emoticons/default/wink.png[/img]
  13. Multiple cameras rendering in OpenGL

    I don´t know, but... why would one want to have that many cameras? Do I understand it right that you want to have 300-700 different point of views? If so, it is pretty obvious the computer has [b]very[/b] much to do...
  14. thanks, Although I see the advantage of having more features with shaders, to me it looks like they are a ton of work: Currently I´m using lighting with the fixed pipeline and it works quite well. Of course one could improve it, but for me it works fine. But when I want to change something (like programming texture splatting) and I choose to use shaders, I have to reprogram the whole lighting again! Is there anywhere anything like a "default shader" that can just be modified? [b]IF[/b] I have to program light and fog by myself again, I´d really prefer to focus on other issues rather than reimplementing existing features...
  15. Hey, when I wanted to implement texture splatting for the terrain in my game, I found a post, wich suggested using shaders. Since I had nearly no experience with shaders until then, I thought it would be nice to learn more about them. I implemented a simple shader and noticed that the lighting wasn´t there anymore. It looks like one has to program lighting, fog and all that stuff [i]again oneself[/i] in the new shader. Is that true? It would be nice if I just could change the texturing for example and leave the lighting as it is in the standard pipeline. The only thing I want to do is a nice transition between two or three textures. I know it is possible to do this with the fixed pipeline as well, but I also heard about shaders being much faster doing this. Can I use shaders AND the functionality of the default fixed pipeline or do I have to either do it without shaders or program this functionality myself? thanks in advance