• Content count

  • Joined

  • Last visited

Community Reputation

310 Neutral

About laylay

  • Rank
  1. I recently simplified my map geometry merging identical faces with each other. The problem is I have a 3d texture that defines a damage value for each cell of the map. I sample the center of these texels to shade cells with the damage value. This works perfectly when there's 4 vertices per face cell but now that 2 triangles can make up many face cells, the damage shading has to change.   This is how it looks when each face cell has 4 vertices each.   This is the simplified mesh with my shader changes.   I first pass the vertex position as a varying. In the frag shader I floor it and add 0.5, I think this is what Nearest neighbour filtering does. This is very aliased and unacceptable so I tried smoothing it out, which is what you see in the second picture.   This works well for removing the aliasing but it means edges that are adjacent to an air cell get interpolated back to a light colour.   I want to be able to have the exact results of the first image without having 4 vertices per cell face.   It's almost like I need to be able to emulate what CLAMP_TO_EDGE does because the error does not happen for edges touching the map bounds, which is when clamp to edge takes effect. I'm not sure if that's possible to do though.
  2. I think making it easier to find exploits is actually a good thing. If everything is closed source and someone malicious exploits it for their benefit then that's all they're able to do. Open source at least allows them to contact you and explain exactly what the problem is. I think It's much better to get hackers on your side rather than banning them as they're probably going to be more willing to help you fix problems rather than using them to ruin the experience of others.   That's the attitude I'm going to have at least if people start hacking my game, I'll embrace it.
  3. Even if it's running the same code, the server is using the last received input to drive the player. Without going back in time on the server, actions are going to happen at completely different times than what got predicted. I know that it's going to go out of sync if the server does something to the player that the client can't predict, I'm fine with that. I just can't fix this specific problem without causing some kind of cheating.   One way I thought about solving this is to timestamp the input packets and have the server go back in time to apply inputs and simulate the player from where they actually happened but only allow a small timeframe of about 200ms. That's still open to abuse but maybe there's no stopping that completely.   Perhaps it's better if I just send frametimes to server so it knows how long to simulate for but protect against huge frametimes that can't possibly happen, that way a cheater wont gain an advantage but could freeze the player in mid-air (which may not be an advantage depending on the game)
  4. I have a fast paced multiplayer FPS game with the client running the player movement code and sending its position to the server. Obviously this is open to cheating so I want to have the player movement run on the server with the client sending only input to the server.   I have read all about client side prediction but there's still a few problems I'm not able to solve.   When I sample input and send that packet to the server, by the time the server receives it, the player simulation will have potentially moved the player to a different position than where the clients player was during that input.   One way to solve this is to send the frame time in the input packet to progress the simulation by that amount using that input. The problem with this is that it's also open to cheating, someone could speed up their client so the server simulates the player faster. I'm sure there's ways to detect that but there's still the problem of the player on the server freezing in mid-air when input isn't being received.   So to me it doesn't look like there's a perfect solution to this problem, I want the server to always simulate the player but due to packet latency, it's going to receive input at a different time than the client predicted it, resulting in constant error correction for the player.   An example of this is, imagine the client is predicting the player moving forward and then jumps, the server will be moving the player forward but the input with the jump keypress hasn't been received yet so the player on the server keeps running forward. When the input with the jump key press finally comes in, the player on the server has already ran into a hole but the client predicted that the player jumped over the hole.
  5. Rollercoaster Track Orientation

    I don't think it's a wrapping problem because it doesn't matter what combination of roll values the nodes have - it will still twist in that situation no matter what. I'm starting to think there's no simple fix for this and the calculations needed to do this are much more complicated than the basic ones I'm doing.
  6. Rollercoaster Track Orientation

      This kinda makes it easier to see what's going on but I still have no idea how to fix it.   They are just the up vectors at each point.
  7. Rollercoaster Track Orientation

    Yeah, there's multiple points between nodes, I need to calculate the up vector for each point.   In wireframe just to make it clearer.     I tried dotting the previous up with the current up and negated it if it's negative - doesn't seem to fix it, I'm probably just not understanding what you mean :(
  8. Rollercoaster Track Orientation

    By a segment do you mean between 2 points, not nodes?
  9. I'm making a rollercoaster and I'm having trouble figuring out the tracks up and side vectors from the track tangent. I have a series nodes with roll values and points that make up the track. Now, I want to keep the track upright as much as possible so it doesn't start to roll around corners but at the same time allow for the node roll values to make loops. No matter what I do, I get twists and bends when the loop goes up and starts to bend back around.   This is the code I have now that works okay apart from loops. I'm at a dead end with this, I just can't figure out a way to keep the track upright but still allow for loops. I know it's possible - I just don't know the maths to do it. My requirement is that there can't be any other data the user needs to give - just the node positions and roll values at each node. I'm using bezier curves if that helps. m_trackLength = 0.0f; const Vector3f up(0.0f, 1.0f, 0.0f); size_t segmentIndex = 0; size_t segmentPointIndex = 0; for (unsigned int i = 0; i < m_points.size(); ++i) { Point& point = m_points[i]; Vector3f trackDelta; size_t rollIndex; size_t nextRollIndex; float rollPercentage; if (i < m_points.size() - 1) { trackDelta = m_points[i + 1].position - point.position; size_t segmentPointCount = m_segments[segmentIndex].pointCount; rollIndex = segmentIndex; nextRollIndex = rollIndex + 1; rollPercentage = (float)segmentPointIndex / ((float)segmentPointCount - 1); ++segmentPointIndex; if (segmentPointIndex >= (segmentPointCount - 1)) { ++segmentIndex; segmentPointIndex = 0; } } else { trackDelta = m_points[1].position - point.position; rollIndex = m_nodes.size() - 1; nextRollIndex = 0; rollPercentage = 1.0f; } m_trackLength += trackDelta.Length(); point.tangent = trackDelta.Normalise(); float firstNodeRoll = m_nodes[rollIndex].GetRoll(); float nextNodeRoll = m_nodes[((rollIndex < (m_nodes.size() - 1)) ? nextRollIndex : 0)].GetRoll(); float pointRoll = Math::RadiansToDegrees(nextNodeRoll - firstNodeRoll); pointRoll -= floor(pointRoll / 360.0f) * 360.0f; if (pointRoll >= 270.0f) { pointRoll -= 360.0f; } else if (pointRoll <= -270.0f) { pointRoll += 360.0f; } pointRoll = Math::DegreesToRadians(pointRoll); pointRoll = firstNodeRoll + Util::Interpolate(0.0f, pointRoll, rollPercentage); point.normal = up; point.normal.Rotate(-pointRoll, point.tangent); point.binormal = point.tangent.Cross(point.normal).Normalise(); point.normal = point.binormal.Cross(point.tangent).Normalise(); } And here's a picture of the problem:     I've heard about "Parallel Transport Frames" and have tried implementing them but all it seems to do is make the track roll around corners - something I don't want to happen. Maybe I'm just doing it wrong?
  10. Yes, streaming audio files over the voice chat is just a fun feature for my game. Source engine games do this with third party software, my game will have it built in just for fun.   Anyway I've solved it for now by outputting to a zero volume sound source, very ghetto but it works.
  11. I have added voip to my game which works perfectly for broadcasting speech over network using the audio data from an input device. I want to add support for streaming audio from files but the problem I'm having is deciding how often I should be reading parts from the file to send over network. When streaming and playing audio locally this problem is easy to solve because I can just queue a buffer when there's a slot available, this isn't an option here because I'm not playing back the audio I'm sending.   The only solution I see is to send packets in timed intervals but I see that being unreliable. What do you guys think?   A ghetto way would be to actually play the stream locally but with zero volume, that doesn't seem too bad.
  12. Sound (Voice) over Network

    Thanks, I'll give it a try. You say to drop the packet if it's not the in correct order, why not just swap them around?
  13. Sound (Voice) over Network

    So I got my encoded voice sending across UDP and seems to play smoothly (on localhost) Now I need to know what I need to do to have it play nicely when connected to other servers. So from what you've all told me there's 2 main things I need to solve. Packet reordering and packet loss. Let's start with packet reordering. I imagine I'd have to wait for a certain amount of packets to come in before I can put them in order and play them. How many packets should I be waiting for before i sort them though? 5, 6, 7, 10? If I'm waiting too long then there's going to be a lot of latency. Any other problems I'll have to solve? I want this to be on par with something like the voice chat in Source Engine games.
  14. Sound (Voice) over Network

    Well I've got OpenAL setup so I can just play it through that without a problem.   I think tomorrow I'm going to atleast get the encoded audio sent to server and across to clients, having clients decode what they get sent. From there I'll have a much better idea of what needs fixing. I'll be missing packets and have packets in the wrong order but I should be able to atleast hear something through my speakers.   I'll be testing on localhost anyway so It will probably be audible :)
  15. Sound (Voice) over Network

    I think this is kinda something I want to do myself or just not have it at all. I've written the game from scratch so far, I may aswell have just used unity or something otherwise.   Despite all the problems, I think this is something I can pull off. I may use Speex over Opus if there's better examples and docs. I think Opus is made by the same people though.