Jump to content
  • Advertisement

Christopher Crain

  • Content Count

  • Joined

  • Last visited

Community Reputation

189 Neutral

About Christopher Crain

  • Rank
  1. Christopher Crain

    Login Server Question

    I want to separate my login process from my game server, but I am trying to wrap my head around this...   This is my understanding / thoughts on how to implement the login server.     1. The client connects to the login server. 2. The client provides username and password 3. The server authenticates the username and password. 4. The server stores a unique code in database for the username. 5. The server sends the account id and unique code to the client. 6. The client tries to connect game using the account id and unique code. 7. The Game Server validates the unique code is within the allotted time between login and game server connection. 8. Client is now connected to the Game Server.     I may be completely off, since I have never done anything like this.   Thoughts? Ideas?      
  2. Christopher Crain

    ISO quick max distance check

    Ok so here is the implementation I got working last night, there is one piece I didnt fully understand though and it might be wrong. float Velocity = 0.9f; public void ClientPositionUpdate(Vector3 ppu) { try { _timer.Stop(); float timeSinceLastUpdateInSeconds = ((float)_timer.Elapsed.TotalMilliseconds / 1000.0f); Vector3 diff = _currentPos - ppu; float maxDistance = _speedLimit * timeSinceLastUpdateInSeconds; float actualDifferenSquared = diff.LengthSquared(); float maxDistanceSquared = (maxDistance * maxDistance); if (actualDifferenSquared > maxDistanceSquared) { Console.SetCursorPosition(0, 15); Console.WriteLine(string.Format("Player might be cheating...{0} / {1}", actualDifferenSquared, maxDistanceSquared)); Console.SetCursorPosition(0, 4); } else { } _currentPos = ppu; _timer.Restart(); } catch (Exception ex) { } } private void SetSpeedLimit(float add) { _speedLimit = (Velocity + add) * 5.5f; } SetSpeedLimit(0.0f); So I set it up so that I could adjust the speed limit on the player in-case they got a buff that increased or decreased their velocity. So after tweaking the speed limit the 5.5f multiplier seems to catch the player if they somehow adjust their velocity on the client side without the server velocity being updated. I guess I should just leave it be, but I dont understand the whole 5.5f part.
  3. Christopher Crain

    ISO quick max distance check

    Awesome, thanks guys! I will try implementing this tonight.
  4. Christopher Crain

    ISO quick max distance check

    I am currently allowing the client to update the server of the players latest position updated every ~2 seconds. I am trying to extrapolate out a max distance the player can travel from the last update to the current position being reported. I tried doing a _currentPos * deltaTime * Velocity and some huge number comes out they would probably never be able to achieve. For example Current Position = (X=54, Y=1, Z=30) * 2.0f * 0.9f = I get number in the 200 range for X, Y dont care, Z is 144 ish.  Any help would be appreciate thank! public void ClientPositionUpdate(Vector3 ppu) { float distance = Vector3.Distance(ppu, _currentPos); if(distance == 0.0) { } else { float maxDistance = <=== NEED help here. if(distance <= maxDistance) { } else { // flag for cheating... } } _currentPos = ppu; }
  5. Christopher Crain

    Level Loading on the Server

    Ahh good point on tagging certain places in the zone, thanks. I think I will explore this path for the server.
  6. Christopher Crain

    Level Loading on the Server

    Sorry hplus0603, the Client is created in Unity3D version 5 and I am using the Lidgren Network library to connect to a custom server built in a C# console application. I am trying to find the best approach to extract the geometry from the scenes I create in Unity3D into a file that my server can read. Currently I am exporting the terrain to a .obj file but I may see about just exporting just the triangles since the server doesn't care about textures.   I want the server to do all the raycasting (line of sight) for spell casting and ranged combat, also have the server calculate the walkable areas for players / npc's via a navigational mesh (SharpNav).   Has anyone used SharpNav? Are there any other navmesh libraries in C#? The setup I am aiming for for raycasting / walkable areas using the geometry file on the server is this the best approach?   I love the way EQEmulator folks have the server implemented, so I would like to model mine in a similar way but in C#. (https://github.com/EQEmu/Server/)
  7. Christopher Crain

    Level Loading on the Server

    I just want to ensure I am going about this the right way, since I am still trying to wrap my head around all this. I guess this is more of a design question, but it's alot to do with multi-player / servers.   1. Create a scene in Unity and exporting the geometry to a file. - Done 2. Load the geometry file in my server code. - Done   Things I am about to attempt, this is where I need to know if this is the correct approach?   3. Create a Navigational Mesh from the Geometry? I am about to test out SharpNav (https://github.com/Robmaister/SharpNav) 4. Use the Navigational Mesh and RayCasting for the players and npc's line of sight and walkable area's?
  8. Christopher Crain

    winsock UDP not working

    Some things you may want to try:   Allow the port to receive data from the outside world: http://windows.microsoft.com/en-us/windows/open-port-windows-firewall#1TC=windows-7   You may want to just disable your firewall for testing purposes right now to ensure that is or isnt the issue.   Try running the application for the server in "admin" mode as well.   You may also want to download Wireshark to help with your debugging: https://www.wireshark.org/
  9. Christopher Crain

    Interpolation Issue

    Thanks for the replies, I will check out the article and code linked. The 160msec rate is that too much time between update packets? This game is not a FPS so I figured a little bit longer delay on position updates would be ok and then I would be able to balance the load of sending out state data on specific zones on different iterations. For example: on iteration 0 I would send out zone001 states, next server cycle (~16msec) send out zone002, next zone003 etc...  Perhaps there is a better approach I am not sure, I am open to suggestions!
  10. Christopher Crain

    Interpolation Issue

    I am tweaking my client code to interpolate movements between the server position and the client's current position. This seems to work "ok" but I still notice a little bit a jitter when the NPC is being interpolated to his destination. Hopefully someone could inspect this code and see what I am doing wrong. I ported this from another post I found. http://www.gamedev.net/topic/639568-network-interpolation-help/.   To test this I am setting up an NPC on the server side to move 0.3f every ~16 msec, BUT I send the position packet at ~160 msec. Perhaps this test case is wrong or inaccurate? Note : the "Update" method is manually called from an entity manager class every frame. using UnityEngine; using System.Collections; using SharedNetworkLibrary.Types; public class EntityType { public int ID { get; private set; } private GameObject _gameObject; private Vector3 _displayPosition; private Vector3 _latestPosition; private float _latestPositionTime; private string _currentAnimation = "idle"; private Vector3 _previousPosition; private bool _isMoving = false; private const float _interpolationPeriod = 0.3f; private Animation _animation; public EntityType(int id, GameObject gameObject) { ID = id; _gameObject = gameObject; _animation = _gameObject.GetComponentInChildren<Animation> (); } // Update is called once per frame public void Update () { if (_isMoving == true) { float t = 1.0f - ((_latestPositionTime - Time.time) / _interpolationPeriod); _displayPosition = Vector3.Lerp (_previousPosition, _latestPosition, t);   } else { _displayPosition = _latestPosition; }     _gameObject.transform.position = _displayPosition; } public void UpdateAnimation(string animation) { _currentAnimation = animation; } public void UpdatePosition(EntityStateType entityType) { if (entityType.IsMoving == true) { _isMoving = true; _latestPosition = new Vector3 (entityType.X, entityType.Y, entityType.Z); _latestPositionTime = Time.time + _interpolationPeriod; _previousPosition = _displayPosition; if(_animation.isPlaying == false) { if(_currentAnimation.Length > 0) { _animation.Play (_currentAnimation); } } } else { _isMoving = false; } } }
  11. Christopher Crain

    [Visual C#] Help with passing an object between forms

    Well you could add a static class to hold character creation in and all form can access this data without having a reference. For example public static class CharacterCollection { public static Dictionary<string, Character> Characters = new Dictionary<string, Character>(); private static string _currentCharacter = string.Empty; static CharacterCollection() { } public static Character SelectCurrent() { if (Characters.ContainsKey(_currentCharacter) == true) { return Characters[_currentCharacter]; } return null; } public static void Add(Character character) { if(Characters.ContainsKey(character.Name) == false) { Characters.Add(character.Name, character); } else { Characters[character.Name] = character; } } public static bool SetCurrent(string name) { if (Characters.ContainsKey(name) == true) { _currentCharacter = name; return true; } return false; } } Usage:   FormA: Character newPlayer = new Character("PlayerA", 1, 1); CharacterCollection.Add(newPlayer); CharacterCollection.SetCurrent(newPlayer.Name); FormB Character player = CharacterCollection.SelectCurrent(); This will give you the ability to navigate multiple forms without having to pass a reference to each form or the game, just grab it out of the collection.
  12. Christopher Crain

    Sending 'command duration' from client to server

    This article helped me understand some of this process, I ultimately decided I didnt need this type of protocol for my RPG. But this may help you http://www.gabrielgambetta.com/fast_paced_multiplayer.html
  13. Christopher Crain

    Help Selecting a 3D Engine

    Thanks for the replies, I was able to find a terrain script to export the scene geometry. I may still look at the unreal tournament.
  14. Christopher Crain

    Unity Help Selecting a 3D Engine

    I am venturing into the 3D realm for creating a game idea I have but I am having difficulty selecting a 3D game engine. Hopefully someone can help guide my decision.   Here is the criteria:   - 3D Level / Scene Editor with the ability to export a vertices file (.map or similar) - Easily import Blender content (.fbx, .dae or .obj) - C# - User Interface with UI designer - Free or relatively cheap (under $200)     I am leaning toward Unity 5 but I havent seen a way to generate a vertices file with unity yet for the scene. This will be needed for the server to test collisions and LOS.   Thanks for your time.
  15. Christopher Crain

    Packet safety

    Perhaps we should analyze the data you are wanting to send from the client that you dont want to be injected?
  • 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!