Advertisement Jump to content
  • Advertisement

Codelyy

Member
  • Content Count

    29
  • Joined

  • Last visited

Community Reputation

115 Neutral

About Codelyy

  • Rank
    Member

Personal Information

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I actually fixed it just now and it was because of the simplest mistake... as it normally is. That line shouldn't be there. I removed it and everything worked perfectly.
  2. Prefer if you didn't since I've spend hours trying to get this working but fine
  3. We were given a VERY bad tutorial on setting up UDP for our assignment and that is what it told us to do
  4. It's very strange since I'm able to send UDP packets from the client to the server and have the server's UDPClient pick them up fine, But I have issues when sending UDP packets from the server to the client so it's either that the UDPClient on the server side can't send any UDP packets back to the client, or the clients socket can't pick up any of the UDP packets.
  5. I tried what you mentioned in that post you posted above and it still didn't work. I honestly don't think it's anything like that. I just think I'm setting up my UDP wrong since as I've never actually implemented UDP before.
  6. This is the full error message: System.Net.Sockets.SocketException HResult=0x80004005 Message=An existing connection was forcibly closed by the remote host Source=System StackTrace: at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) at System.Net.Sockets.Socket.Receive(Byte[] buffer) at Pong___Concurrent_Networking.PlayerUtils.Client.UDPProcessServerResponse(Object client) in C:\Users\codel\Documents\Visual Studio 2017\Projects\Pong-Concurrent-Networking\Pong - Concurrent Networking\PlayerUtils\Client.cs:line 185 at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart(Object obj)
  7. What about fixed_dst? I've currently got this: void PlayerCamera::RotateAroundPlayer() { XMVECTOR cameraEye = XMLoadFloat4(&Eye); XMVECTOR cameraUp = XMLoadFloat4(&Up); XMVECTOR atPlayerPos = XMLoadFloat4(&this->playerPos); XMFLOAT4 distance = XMFLOAT4(0.0f, 20.0f, -15.0f, 0.0f); XMVECTOR distanceAway = XMLoadFloat4(&Eye); XMVECTOR playerDirection = XMVector3Normalize(atPlayerPos + cameraEye); XMVECTOR cameraRight = XMVector3Cross(playerDirection, XMVector3Normalize(cameraUp)); XMFLOAT4 cameraDistance; XMStoreFloat4(&cameraDistance, distanceAway * cameraRight); Eye.x = playerPos.x + (cameraDistance.x * std::sin(camYaw)); Eye.z = playerPos.z + (cameraDistance.z * std::cos(camYaw)); } It SORT of works... but still doesn't give the desired effect I should also mention that the camYaw is the mouse's X value multiplied by a scaler which is meant to be how fast the camera rotates camYaw += input->GetMouseInput().X * 0.05f;
  8. Would you be able to go into more detail about what exactly you're doing here? CDLDblQuaternion clARot(this->m_clTarget.clUp,this->m_fCAzimuth); clTemp.clFace = clARot.Rotate(this->m_clTarget.clFace); clTemp.clRight.CrossProduct(clTemp.clFace, this->m_clTarget.clUp); CDLDblQuaternion clERot( clTemp.clRight,this->m_fCElevation); clTemp.clFace = clERot.Rotate(clTemp.clFace); I've not done Quaternion's before so it's a little confusing
  9. Yea... I've never been good at asking questions based on programming, though I appreciate that you're nice about it instead of very direct and mean (Like a lot of people on Stack Overflow). I've updated my main post to add the information you mentioned so I hope that improves it
  10. Maybe a silly question but how would I work out the angle?
  11. I'm attempting to setup UDP for a multiplayer game I'm developing but I've been having lots of issue trying to get the UDP packets to send over to my clients as it seems my UDP listener (UDPClient) isn't setup correctly but I have no idea why. This is for an assignment and they didn't give us much help on it so I'm a little clueless to be honest which is likely why it isn't working. I'll go over what I've got currently. Currently I've got it setup where my clients will have their own UDPSocket and UdpEndPoint(IPEndPoint). I initialize the Socket when creating the Client object, and then create the endpoint and connect the socket to it when the user connects to the server. The IP and Port numbers are 127.0.0.1 and 4444 respectively public Client() { tcpClient = new TcpClient(); formatter = new BinaryFormatter(); udpSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); } public bool Connect(string ipAddress, int port) { try { tcpClient.Connect(ipAddress, port); stream = tcpClient.GetStream(); IPAddress IP = IPAddress.Parse(ipAddress); udpEndPoint = new IPEndPoint(IP, port); udpSocket.Connect(udpEndPoint); writer = new BinaryWriter(stream, Encoding.UTF8); reader = new BinaryReader(stream, Encoding.UTF8); } catch { return false; } I then send a TCP packet to the server containing the endpoint of the client. Server side has it's own client objects which also have an endpoint so when the server receives the packets, I assign the endpoint to the corresponding client object on the server side. case PacketType.CONNECTED: ConnectedPacket connectedPacket = (ConnectedPacket)packet; Console.WriteLine("Player " + connectedPacket.ID + " Has Connected!"); client.ID = connectedPacket.ID; client.AttachUDPEndPoint(connectedPacket.udpEndPoint); The Server has a UDPCLient which I set up when I create the server, along with connecting it to the same IP and Port I use for my TCP connection. Those being 127.0.0.1 for the IP and 4444 for the port. try { IPAddress IP = IPAddress.Parse(ipAddress); tcpListener = new TcpListener(IP, port); udpListener = new UdpClient(); udpListener.Connect(IP, port); } catch (Exception e) { Console.WriteLine(e.ToString()); } Whenever I want to send a packet to a client, I just call the corresponding client's (on the server side) "SendUDP" function which uses a passed in UDPClient from the Server, the same UDPClient which is set in the code above (udpListener). I just pass that listener from the server whenever I call the function. public void SendUDP(UdpClient listener, Packet packet) { MemoryStream memoryStream = new MemoryStream(); formatter.Serialize(memoryStream, packet); Byte[] buffer = memoryStream.GetBuffer(); listener.Send(buffer, buffer.Length, udpEndPoint); } player2.SendUDP(udpListener, positionPacket); Sadly whenever I sent a UDP packet and the client attempts to recieve it, I just get given an error like this: I get this error on every client and it's coming from a while loop which I use to check for incoming packets: int noOfIncomingBytes; byte[] bytes = new byte[256]; while (!disconnected && (noOfIncomingBytes = udpSocket.Receive(bytes)) != 0) { bytes = reader.ReadBytes(noOfIncomingBytes); MemoryStream memoryStream = new MemoryStream(bytes); Packet packet = formatter.Deserialize(memoryStream) as Packet; Console.WriteLine("Client UDP Packet Recieved"); switch (packet.type) { case PacketType.POSITIONCHANGE: PlayerPositionPacket postionPacket = (PlayerPositionPacket)packet; if (postionPacket.playerNumber == 1) { Vector2 newPos = new Vector2(postionPacket.newPosX, postionPacket.newPosY); gameInfo.player1Pos = newPos; } else if (postionPacket.playerNumber == 2) { Vector2 newPos = new Vector2(postionPacket.newPosX, postionPacket.newPosY); gameInfo.player2Pos = newPos; } break; } } I know the socket can't be set up "that incorrectly" as I'm able to send packets to the server fine, just receiving them is the issue as it seems the listener on the server side isn't connected? When debugging, it's "active" variable is false I'm assuming is bad. There is likely a obvious issue in my code somewhere though I'm not sure where (This is my first time ever doing networking). I hope that's enough info to go off of, I'd really appreciate some help. EDIT: My UDP socket seems to be connected fine when I create my client but as soon as my while loop (The while loop I posted above) that checks to see if it's received any packets runs, it disconnects.
  12. I'm attempted to create a third person camera which will rotate around the player as I move the mouse left and right. The camera is set to always look at the player so I've worked out a right vector to move the camera along which should change as the camera rotates to look at the player's position, resulting in it spinning around the player void PlayerCamera::RotateAroundPlayer() { XMVECTOR cameraEye = XMLoadFloat4(&Eye); XMVECTOR cameraUp = XMLoadFloat4(&Up); XMVECTOR atPlayerPos = XMLoadFloat4(&this->playerPos); XMVECTOR playerDirection = XMVector3Normalize(atPlayerPos - cameraEye); XMVECTOR cameraRight = XMVector3Cross(playerDirection, XMVector3Normalize(cameraUp)); cameraEye += camYaw * cameraRight; XMStoreFloat4(&Eye, cameraEye); } Currently though I'm having issues with it's speed and also mainly the fact that the camera doesn't stay at a fixed position away from the player like a normal third person camera should, so when the player moves away, the camera doesn't move with it so the further away the player is, the bigger the spin around the player. The thing is that I have no clue on how to keep the camera at a fixed distance away from the player while still allowing it to rotate around the player. The rotation effects the X and Z positions of the eye of the camera so they just simply override whatever I do to keep the camera at a fixed distance via something like adding a offset from the player position. I'm kinda stumped on what to do at this point. I'd love some help if anyone can provide
  13. Thank you very much for the detailed description I only just remembered actually that it was a PS2 game so a video like I originally thought wouldn't of been ideal Also you could make a Unity example if you really wanted too, I'd be very grateful. I'm not doing this in Unity (Currently using Monogame) though I have used Unity before so I could understand what's going on.
  14. I was wondering if anyone by chance had a clue of how they pulled off this main menu transition in Kingdom Hearts 2? I'm trying to recreate a similar thing and my original idea was to do it all through programming though I'm thinking that it's unlikely it's done just through programming. It seems like there would be way too many lines of code to get it like this
  15. One of the things I really want to get into and actually do if I become a Games Programmer in Industry is AI though truthfully I'm not really sure where to start. How exactly should I go about learning? and What should I learn first? are questions that I've always wondered. The most I've really looked into about AI is Finite State Machines though I'm sure there is MUCH more to AI then just that so I was wondering if you guys would possibly give me some advice on where to start, I'd very much appreciate it
  • 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!