• What do you need help with? Version 5
    5,752 replies, posted
[QUOTE=ryan1271;37667085]This is an odd problem. I'm writing the Game Of Life in Java and at seemingly random times the KeyboardListener will not even function. Does anyone know of this issue? I can't replicate the issue and it seems to only happen on my laptop. My desktop is fine with it however. Just wondering if anyone has seen this before. Its quite annoying.[/QUOTE] We need to see your KeyboardListener class. It's most likely a problem with your laptop. I got a Java question: Can anyone show me an example of sending a Vector class or Array with elements to a Input/OutputStream, adding some data, and getting the Vector class/Array back? Does the code change if it's a Socket's Input Stream?
[QUOTE=Overv;37661091]You need to export with normals, texture coordinates and vectors, it's currently optimized to be fast and not very tolerant. Sorry about that. Actually, if you send me that file, I'll submit an update that parses it.[/QUOTE] Alright, it's literally the default Blender cube exported with default settings though. [url]http://www.4shared.com/file/hxkP58hY/cube.html[/url]
I want to create some LoD on a sphere such as: [video=youtube;eVVCgH2K__4]http://www.youtube.com/watch?v=eVVCgH2K__4&feature=related[/video] How should I do it? considering im planning on having a cube normalized to a sphere. Quad tree is the natural option so should I have a node base class, and then an inherited class for each of the 6 sides (this will just change the X,Y,Z values of the operations to reflect the side) Or should I do it this way, using some sort of octree? [video=youtube;fW6LZy2OG5g]http://www.youtube.com/watch?v=fW6LZy2OG5g[/video]
I think I've asked something like this before but I'm really not understanding network prediction, specifically for weapon firing. For example. If I tell the server I'm starting to fire my weapon, it's going to simulate weapon firing until it gets told to stop weapon firing. I don't see how client timestamps of these two actions can solve that because it doesn't know the exact time the client held down fire until the stop firing messages comes in, this could come in late due to packet latency. So it's possible that server simulated weapon firing for 5 seconds but client did it for 4.9 seconds, that has a chance of popping off a weapon fire when its off cooldown on the server but the client didn't play the animation and effects. Ammo count is now out of sync (unless I then correct that prediction error but I still didn't see the weapon fire effects for the last fire and I think it would be too late to correct that and play the animation and effects) I see no possible way to solve that and It's pissing me right off.
[QUOTE=evil-tedoz;37665389]-snip-[/QUOTE] Those abc points make me really confused, try to debug it. If seems that in the second step you put a square outside the original position of the whole carpet.
[QUOTE=laylay;37675094]I think I've asked something like this before but I'm really not understanding network prediction, specifically for weapon firing. For example. If I tell the server I'm starting to fire my weapon, it's going to simulate weapon firing until it gets told to stop weapon firing. I don't see how client timestamps of these two actions can solve that because it doesn't know the exact time the client held down fire until the stop firing messages comes in, this could come in late due to packet latency. So it's possible that server simulated weapon firing for 5 seconds but client did it for 4.9 seconds, that has a chance of popping off a weapon fire when its off cooldown on the server but the client didn't play the animation and effects. Ammo count is now out of sync (unless I then correct that prediction error but I still didn't see the weapon fire effects for the last fire and I think it would be too late to correct that and play the animation and effects) I see no possible way to solve that and It's pissing me right off.[/QUOTE] There is a very good explanation of how the Source engine handles network prediction here [url]https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking[/url] It could be of help.
[QUOTE=Fear_Fox;37675442]There is a very good explanation of how the Source engine handles network prediction here [url]https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking[/url] It could be of help.[/QUOTE] Not really. I'm aware of it but it doesn't really solve my problem.
[QUOTE=laylay;37675094]I think I've asked something like this before but I'm really not understanding network prediction, specifically for weapon firing. For example. If I tell the server I'm starting to fire my weapon, it's going to simulate weapon firing until it gets told to stop weapon firing. I don't see how client timestamps of these two actions can solve that because it doesn't know the exact time the client held down fire until the stop firing messages comes in, this could come in late due to packet latency. So it's possible that server simulated weapon firing for 5 seconds but client did it for 4.9 seconds, that has a chance of popping off a weapon fire when its off cooldown on the server but the client didn't play the animation and effects. Ammo count is now out of sync (unless I then correct that prediction error but I still didn't see the weapon fire effects for the last fire and I think it would be too late to correct that and play the animation and effects) I see no possible way to solve that and It's pissing me right off.[/QUOTE] Let the client tell the server when and where the gun goes off. The client plays its animations and spawns decals etc. immediately. When the server receives knowledge of the gun going off, it verifies its sanity, calculates where it really hit and tells other clients to display the same animations.
That doesn't address the problem at all. Say you had a weapon that fires every 0.1 seconds. The local client holds fire for 0.9 seconds and predicts fire animations, it's going to play a total of 9 fire animations. When the weapon is simulated on the server, it could simulate for 1 second because of the stop fire packet comes in 0.1 second late. Now the server fires a total of 10 times, the local player misses 1 animation and has incorrect ammo count.
Just eliminate the concept of a "stop firing" message and instead send a new "bullet fired" one each time a bullet is fired.
[QUOTE=esalaka;37676312]Just eliminate the concept of a "stop firing" message and instead send a new "bullet fired" one each time a bullet is fired.[/QUOTE] Start and stop firing messages is much better because it allows for continuous weapons like a flame thrower. Having single fire messages still has the same problem anyway I think because of paket latency, there's situations where clients weapon is off cooldown but the server side one isn't.
[QUOTE=laylay;37676368]Start and stop firing messages is much better because it allows for continuous weapons like a flame thrower. Having single fire messages still has the same problem anyway I think because of paket latency, there's situations where clients weapon is off cooldown but the server side one isn't.[/QUOTE] With individual fire messages the server is guaranteed that it will never fire a bullet unless the client did. Packet latency will never mean that too many or too few bullets are fired, unless the latency is so bad that the server can no longer verify whether the client should've been able to fire. I think that's acceptable. I don't think you can entirely eradicate out-of-syncing if you're doing prediction.
The only way that would work is if the server queued up the fire messages and simulated the weapon until the weapon could fire each one off. I dunno though, I feel like there's a better solution to this. Most games I've seen just samples player input and sends it to the server so doing it that way wouldn't work.
I don't know much about network programming but couldn't you send the amount of bullets fired with the "stop fire" message?
It wouldn't be useful because the server would have already fired too many shots by the time the end fire packet comes in.
[QUOTE=AlienCat;37675430]Those abc points make me really confused, try to debug it. If seems that in the second step you put a square outside the original position of the whole carpet.[/QUOTE] Thanks man ! You made me realise that I was creating my new squares outside the original one. [IMG]http://i.imgur.com/1w6hG.png[/IMG] Now, I want to apply this drawing to each face of a cube, how would I do it ? I know how to draw a cube, but applying this fractal to each side seems a little hard.
[QUOTE=evil-tedoz;37677455]Thanks man ! You made me realise that I was creating my new squares outside the original one. Now, I want to apply this drawing to each face of a cube, how would I do it ? I know how to draw a cube, but applying this fractal to each side seems a little hard.[/QUOTE] There are several ways to do this, I do not know if the easiest would be to create a texture. You simply make a big array of RGB bytes and then loop trough the whole array and set all pixels to black and then loop through all the squares and set all pixels within the square to white.
[QUOTE=evil-tedoz;37677455]Thanks man ! You made me realise that I was creating my new squares outside the original one. [IMG]http://i.imgur.com/1w6hG.png[/IMG] Now, I want to apply this drawing to each face of a cube, how would I do it ? I know how to draw a cube, but applying this fractal to each side seems a little hard.[/QUOTE] Are you doing this in a fragment shader or just generating white squares on a black background? [editline]15th September 2012[/editline] If you're generating squares, you can use a framebuffer and render-to-texture, then apply that texture to a cube. If you're using a fragment shader, texture coordinates are interpolated for you in the fragment shader, so generate a cube with texture coordinates 0-1 and include a uniform that's the side length of the cube and do some math to get how far along the surface you've gone and run the algorithm on that (or if you've got your algorithm working in the 0-1 range, just use texture coords)
[QUOTE=laylay;37677379]It wouldn't be useful because the server would have already fired too many shots by the time the end fire packet comes in.[/QUOTE] Yeah sending a stop fire packet is broken and unfixable. ThePuska is right.
I don't think I'm going to resort to single weapon fire packets. The only data im sending to the server is input sampled from the player and I want to keep it that way. I think I'm going to try and solve it by timestamping the user commands with the client time and then just try and prevent speed hacks somehow.
Hello! I'm using C, and I'm having a bit of trouble with reading files. I have the following code: [cpp] size_t i; for(i = 0; i < header.fileCount; ++i) { struct file_info info; fread(&info, sizeof(info), 1, file); toLE32(&info.size); struct zip_source* source = zip_source_file(archive, filename, fileDataPos, info.size); zip_add(archive, info.name, source); fileDataPos += (info.size + (info.size % paddingAmount)); }[/cpp] Basically I'm reading a binary file containing a list of files, their names and sizes. Then I'm seeking to after the list where all the files are stacked against each other, and reading the file's data in to libzip. (The files are padded to be a multiple by 4, with zeros.) However, somehow I'm not reading it properly. When I convert my ZIP to a binary file back and diff a hexdump of it, I get this: [code]< 0000000: e43e 0300 0e00 0000 2f03 0000 5245 4144 .>....../...READ --- > 0000000: e63e 0300 0e00 0000 2f03 0000 5245 4144 .>....../...READ 101c101 < 0000640: 5449 460d 0a0d 0acd 0000 0012 0000 0008 TIF............. --- > 0000640: 5449 460d 0a0d 0a00 0000 0012 0000 0008 TIF............. 108c108 < 00006b0: 6372 6e34 0000 0000 0000 0000 00cd cdcd crn4............ --- > 00006b0: 6372 6e34 0000 0000 0000 0000 00cd cd00 crn4............ 116c116 < 0000730: 494e 452e 3100 0000 0000 0000 0000 cdcd INE.1........... --- > 0000730: 494e 452e 3100 0000 0000 0000 0000 0000 INE.1........... 310c310 < 0001350: 00cd cdcd 0000 0012 0000 0008 0000 0005 ................ --- > 0001350: 0000 cdcd 0000 0012 0000 0008 0000 0005 ................ 2624c2624 < 000a3f0: 0000 00cd 0000 0012 0000 0008 0000 0005 ................ --- > 000a3f0: 0000 0000 0000 0012 0000 0008 0000 0005 ................ 2919c2919 < 000b660: 0000 00cd 5645 5253 494f 4e20 320d 0a2f ....VERSION 2../ --- > 000b660: 0000 0000 0000 5253 494f 4e20 320d 0a2f ......RSION 2../ 3523c3523 < 000dc20: 5645 5253 494f 4e20 340d 0a0d 0a2f 2f20 VERSION 4....// --- > 000dc20: 5600 0000 494f 4e20 340d 0a0d 0a2f 2f20 V...ION 4....// 13295c13295 < 0033ee0: 0000 cdcd .... --- > 0033ee0: 0000 cdcd 0000 ......[/code] I can confirm that the corruption happens before or when adding it to the zip, so it may possibly be a problem with me using libzip. Two things that interest me is the file size has shrunk (the first 4 bytes indicate file size), and that the text 'VERSION' is being converted to 'RSION' and filled with null padding bytes at the start. So I'm pretty sure I'm not reading in 2 bytes or something, but I can't find where in my code. Euck.
I know it's probably a silly issue but I can't find a single .obj exporter that will work with OOGL.
Okay, so I narrowed it down to bad padding. My problem now is that I have this horrible code: [cpp] size_t padding = (4 - (sizeStat.size % 4)); if(padding == 4) padding = 0; while(padding--) fwrite(&paddingChar, 1, 1, file);[/cpp] How can I fix this?
You can get rid of the if statement like this: [cpp]size_t padding = (3 - (sizeStat.size - 1) % 4); while(padding--) fwrite(&paddingChar, 1, 1, file);[/cpp]
Thanks! I still don't get the fwrite thing. [editline]17th September 2012[/editline] Eh, I just made a 3-byte array filled with stuff I'll use to pad.
[QUOTE=robmaister12;37681185]Are you doing this in a fragment shader or just generating white squares on a black background? [editline]15th September 2012[/editline] If you're generating squares, you can use a framebuffer and render-to-texture, then apply that texture to a cube. If you're using a fragment shader, texture coordinates are interpolated for you in the fragment shader, so generate a cube with texture coordinates 0-1 and include a uniform that's the side length of the cube and do some math to get how far along the surface you've gone and run the algorithm on that (or if you've got your algorithm working in the 0-1 range, just use texture coords)[/QUOTE] I'm generating squares. So, if I understood, I need to render those squares in a FBO, render-to-texture that, and use the generated texture for my cube ? [URL="http://www.songho.ca/opengl/gl_fbo.html#renderbuffer"]http://www.songho.ca/opengl/gl_fbo.html#renderbuffer[/URL] Is this a good tutorial about it ?
[QUOTE=evil-tedoz;37692447]I'm generating squares. So, if I understood, I need to render those squares in a FBO, render-to-texture that, and use the generated texture for my cube ? [URL="http://www.songho.ca/opengl/gl_fbo.html#renderbuffer"]http://www.songho.ca/opengl/gl_fbo.html#renderbuffer[/URL] Is this a good tutorial about it ?[/QUOTE] Renderbuffers can't be used as textures, instead attach a texture with glFramebufferTexture2D. A good texture size would be 512x512 or 1024x1024. Since the pattern never changes, you could just do this once during initialization and just use that texture. Other than that, the tutorial is good. Basically just do what the example is doing, only you don't need to generate/attach the depth renderbuffer. Only do the color buffer (since you don't need depth for your texture).
I'm going through a book (Beginning Game Programming Third Edition, Jonathon S. Harbour) and I got stuck on the program that introduces you to initializing Direct3D. Apparently I made the wrong project type and fucked everything up, so I loaded the project from the CD. Even if I try to compile that, I get [cpp]1>LINK : fatal error LNK1181: cannot open input file 'd3d9.libkernel32.lib'[/cpp] Help?
What C function do I use to print colored in console?
[QUOTE=Meatpuppet;37693018]I'm going through a book (Beginning Game Programming Third Edition, Jonathon S. Harbour) and I got stuck on the program that introduces you to initializing Direct3D. Apparently I made the wrong project type and fucked everything up, so I loaded the project from the CD. Even if I try to compile that, I get [cpp]1>LINK : fatal error LNK1181: cannot open input file 'd3d9.libkernel32.lib'[/cpp] Help?[/QUOTE] Looks like a terribly malformed link. Looks like it's d3d9.lib and kernel32.lib.
Sorry, you need to Log In to post a reply to this thread.