Jump to content

Berniemack

Member
  • Posts

    16
  • Joined

  • Last visited

Reputation

5 Neutral

Personal Information

  • Pronouns
    he/him

Recent Profile Visitors

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

  1. Absolute Chad, thanks for sharing!
  2. I am indeed leaning into the generic host + BackgroundService pattern but only for LoginHandshakeService, GameHandshakeService, ConnectionWorker and im currently experimenting with an ExperienceService but im not really liking how I have that set up (no real reason other than I feel like there probably is a better way to do what im currently doing with it). Everything else is regular old DI, Parsers and handlers are discovered through assembly scanning. So far I dont have any complaints, I do have to say this is my introduction to game server development as a whole, so I dont know if i can really recommend anything to anyone, other than say so far for me it fits my needs. I really probably should read more into the topic and see more about why things are done a certain way in other game servers. Thank you!
  3. Thank you! Haven't updated in a bit but I'm still hard at work at this whenever I can get the time to work on it. Will update the thread when I get some time today to update the repo. (Mostly refactoring changes still "stuck" on the dhkey exchange, really I've mostly just so happened to have shifted focus on working on another part of this project).
  4. Thanks for the suggestions! Just using MySQL, any PostgresSQL stuff is just uncleaned up code from playing around with ideas. The reason for the appsettings.shared.json is I was toying around with separating some things that I plan on putting in a regular appsettings.json. May not end up doing that at all though so, It may end up just being an appsettings.json in the end. Will definitely look into disabling tracking, and possibly using a globals file, I'll see if I like it for this. Again thank you for taking the time to look at my project and give me some kind feedback! I will be updating the repo at some point today
  5. Its not currently playable, I'd guess the error youre facing is the missing appsettings.shared.json, since you didnt give me the error you got just the program.cs file. Either way, I wouldnt expect much progress on this for a few more months. Life things, plus I've shifted partial focus to trying to deob the client to release along with this if I can, if not hopefully some useful tools or info comes out of it at least. Feel free to dm me if you have specific issues with at least building the project I'll try to help you get set up. Although I do remember there were other errors at some point in time with my with my AddScoped's, I'll update the repo this weekend, here's what I currently have using Microsoft.EntityFrameworkCore; using OpenConquer.Domain.Contracts; using OpenConquer.GameServer; using OpenConquer.GameServer.Calculations.Implementation; using OpenConquer.GameServer.Calculations.Interface; using OpenConquer.GameServer.Dispatchers; using OpenConquer.GameServer.Handlers; using OpenConquer.GameServer.Queues; using OpenConquer.GameServer.Session.Managers; using OpenConquer.GameServer.Workers; using OpenConquer.Infrastructure.Mapping; using OpenConquer.Infrastructure.Persistence.Context; using OpenConquer.Infrastructure.POCO; using OpenConquer.Infrastructure.Services; using OpenConquer.Protocol.Crypto; using OpenConquer.Protocol.Packets.Parsers; using OpenConquer.Protocol.Utilities; HostApplicationBuilder builder = Host.CreateApplicationBuilder(args); builder.Configuration.SetBasePath(AppContext.BaseDirectory).AddJsonFile("appsettings.shared.json", optional: false, reloadOnChange: true).AddJsonFile("appsettings.json", optional: true, reloadOnChange: true).AddEnvironmentVariables(); builder.Services.Configure<NetworkSettings>(builder.Configuration.GetSection("Network")); builder.Services.AddDbContextFactory<DataContext>(opts => opts.UseMySql(builder.Configuration.GetConnectionString("Default"), new MySqlServerVersion(new Version(8, 0, 36)))); MapsterConfig.RegisterMappings(); builder.Services.Scan(scan => scan.FromAssemblyOf<IPacketParser>().AddClasses(c => c.AssignableTo<IPacketParser>()).AsImplementedInterfaces().WithSingletonLifetime()); builder.Services.AddSingleton<PacketParserRegistry>(); builder.Services.Scan(scan => scan.FromAssemblyOf<PacketDispatcher>().AddClasses(c => c.AssignableTo(typeof(IPacketHandler<>))).AsImplementedInterfaces().WithTransientLifetime()); builder.Services.AddScoped<IAccountService, AccountService>(); builder.Services.AddScoped<ICharacterService, CharacterService>(); builder.Services.AddSingleton<ILevelStatService, LevelStatService>(); builder.Services.AddSingleton<UserManager>(); builder.Services.AddSingleton<WorldManager>(); builder.Services.AddSingleton<PacketDispatcher>(); builder.Services.AddSingleton<ExperienceService>(); builder.Services.AddSingleton<IExperienceService>(sp => sp.GetRequiredService<ExperienceService>()); builder.Services.AddHostedService(sp => sp.GetRequiredService<ExperienceService>()); builder.Services.AddSingleton<ConnectionQueue>(); builder.Services.AddHostedService<ConnectionWorker>(); builder.Services.AddHostedService<GameHandshakeService>(); IHost host = builder.Build(); host.Run(); for the appsettings file just make it and put it in your debug folder { "Network": { "LoginPort": 9959, "GamePort": 5816, "ExternalIp": "" }, "ConnectionStrings": { "Default": "Server=localhost;Port=3306;Database=openco;User=root;Password=;" } }
  6. seems like they do use this https://gitlab.com/conquer-online/servers/cops-v6-emulator-enhanced-edition/-/blob/master/MsgServer/Database/DBI/MongoDB.cs?ref_type=heads Youll have to check what actually drives that though to see if you need it or not
  7. I figured it out in case any one was wondering or stumbles into this in the future, despite albetros saying that the auth response packet length should be 54 bytes on the wire they actually only write 36, changed my length from 54 to 36 and now were cooking again boys! So note to anyone in the future working on a 5517 server the auth response packet length should be 36
  8. Heres an example of me pinging the gameserver so I know its listening and receiving the client is just never reaching out to it properly for some reason. info: Microsoft.EntityFrameworkCore.Database.Command[20101] Executed DbCommand (8ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] SELECT `l`.`profession`, `l`.`level`, `l`.`Agility`, `l`.`Health`, `l`.`Mana`, `l`.`Spirit`, `l`.`Strength`, `l`.`Vitality` FROM `LevelStats` AS `l` ORDER BY `l`.`profession`, `l`.`level` info: Microsoft.EntityFrameworkCore.Database.Command[20101] Executed DbCommand (3ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] SELECT `e`.`curve_type`, `e`.`level`, `e`.`experience` FROM `ExperienceCurves` AS `e` ORDER BY `e`.`curve_type`, `e`.`level` info: OpenConquer.GameServer.Calculations.Implementation.ExperienceService[0] ExperienceService initialized: loaded 720 level-stat entries across 6 professions, 141 curve entries info: OpenConquer.GameServer.GameHandshakeService[0] GameHandshakeService listening on port 5816 info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down. info: Microsoft.Hosting.Lifetime[0] Hosting environment: Development info: Microsoft.Hosting.Lifetime[0] Content root path: D:\repos\OpenConquer\OpenConquer.GameServer info: OpenConquer.GameServer.GameHandshakeService[0] Accepted game connection from redacted:53377 fail: OpenConquer.GameServer.GameHandshakeService[0] Error during game handshake for redacted:53377 System.InvalidOperationException: Unable to resolve service for type 'OpenConquer.Protocol.Packets.Parsers.PacketParserRegistry' while attempting to activate 'OpenConquer.GameServer.Session.GameClientSession'. at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters) at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance[T](IServiceProvider provider, Object[] parameters) at OpenConquer.GameServer.GameHandshakeService.HandleClientAsync(TcpClient client, CancellationToken ct) in D:\repos\OpenConquer\OpenConquer.GameServer\GameHandshakeService.cs:line 65 info: OpenConquer.GameServer.GameHandshakeService[0] Closed game connection for redacted:53377 it would expect to error out as I am building it out to expect specific packets only (i'll flesh that out to swallow invalid packets or something properly later) but this shows that the code on the gameserver is working as I expect it to, if the darn client would just send it a packet.
  9. So, I may have had this working before, honestly ive been staying up so late these days I cant remember if I dreamed that this worked at one point or if I actually had it working. Either way, into the issue, I believe I am completing the login handshake just fine. the code runs properly as expected when i step through manually and we send the AuthResponsePacket heres my console messages: ignore the closed login session message I commented out my Disconnect call to see if I was just disconnecting early but no. I even tried awaiting another packet from the client to see if I was missing a step or something but nothing ever came from the client after I sent the AuthResponsePacket. After the following code it just never connects to the gameserver private async Task<AuthResponsePacket> BuildResponseAsync(string user, string pass, CancellationToken ct) { uint loginSessionKey = _keyProvider.NextKey(); uint accountSessionHash = (uint)Random.Shared.Next(1, 1000000); Account? acct = await _accounts.GetByUsernameAsync(user).ConfigureAwait(false); if (acct is null) { acct = new Account { Username = user, Password = pass, Permission = PlayerPermission.Player, Hash = accountSessionHash, Timestamp = (uint)DateTimeOffset.UtcNow.ToUnixTimeSeconds() }; acct = await _accounts.CreateAsync(acct, ct).ConfigureAwait(false); if (acct is null || acct.UID == 0) { return AuthResponsePacket.CreateInvalid(); } } else if (acct.Password != pass || acct.Permission == PlayerPermission.Error) { return AuthResponsePacket.CreateInvalid(); } else if (acct.Permission == PlayerPermission.Banned) { return new AuthResponsePacket { Key = AuthResponsePacket.RESPONSE_BANNED }; } else { acct.Hash = accountSessionHash; await _accounts.UpdateHashAsync(acct.UID, accountSessionHash, ct).ConfigureAwait(false); } return new AuthResponsePacket { UID = loginSessionKey, Key = acct.UID, Port = (uint)_gamePort, ExternalIp = _externalIp }; } private async Task RespondAsync(LoginRequestPacket req, uint seed, CancellationToken ct) { string password = DecryptPassword(req, seed); var resp = await BuildResponseAsync(req.Username, password, ct).ConfigureAwait(false); _logger.LogInformation("AuthResponse: Port={Port}, ExternalIp='{IP}'", resp.Port, resp.ExternalIp); var outBuf = PacketWriter.Serialize(resp); _logger.LogInformation("AuthResponsePacket bytes: {Hex}", BitConverter.ToString(outBuf)); await SendToClientAsync(outBuf, ct).ConfigureAwait(false); _logger.LogInformation("Sent AuthResponse (Key={Key}) for {User}", resp.Key, req.Username); } public async Task HandleHandshakeAsync(CancellationToken ct) { var endpoint = _tcpClient.Client.RemoteEndPoint; _logger.LogInformation("Starting handshake for {Endpoint}", endpoint); try { uint seed = await SendSeedAsync(ct); var (pktLen, pktId, fullPacket) = await ReadAndDecryptRequestAsync(ct); _logger.LogInformation("Received login request (Len={Len} Id={Id})", pktLen, pktId); var req = LoginRequestPacket.Parse(fullPacket); _logger.LogInformation("Parsed LoginRequest for {User}", req.Username); await RespondAsync(req, seed, ct).ConfigureAwait(false); await Task.Delay(100, ct); //Disconnect(); _logger.LogInformation("Handshake complete, closed login session for {Endpoint}", endpoint); } catch (OperationCanceledException) { _logger.LogInformation("Handshake canceled for {Endpoint}", endpoint); Disconnect(); } catch (Exception ex) { _logger.LogError(ex, "Handshake failed for {Endpoint}", endpoint); Disconnect(); } } I dont think its the Gameserver code as an issue or a firewall issue because I can ping the gameserver from powershell and it will get the connection and try to parse the ping. but the client just wont connect. using conquerloader to launch the client with these settings [Loader] IPAddress=redacted <--- port forwarded address yes I have checked that on both ports for login and gameport are port forwarded LoginPort=9959 GamePort=5816 Website=http://www.elitepvpers.de Force=TRUE Wondering if anyone sees a blatant flaw in my implementation that im not seeing, or could just give me a few ideas of where or what to check, I would greatly appreciate it, been racking my brain on this one since yesterday.
  10. Awesome I'm gonna check this out today! Thanks for sharing, hopefully we can make some cool things come of this!
  11. Oh wow thanks for the reply, nice to meet you dude!
  12. Super interesting! Cool to see something new and innovative be shared like that. What community chat rooms are you finding these? would love to peruse and see what else people are talking about/doing with conquer these days.
  13. Hey everyone, I may be sharing this project prematurely out of excitement lol. There is not much here yet, and what is here is nothing new or special really. Sharing for feedback and for anyone interested in following my journey down this little adventure. Preface (feel free to skip): About a month or so ago I got an itch to mess around with conquer online this old game I used to love. Just wanted to hop in and look around (not the retail version of course haha) one rabbit hole lead to another and now here I am. I have never worked on a game server before this project. My development velocity has been... slow to say the least but thats because im really trying to take my time and learn as much as I can in this process, and further more try to avoid the dreaded scrapping of the project because of an eventual roadblock caused by a design oversight. As much as I can with my limited knowledge on this topic. Credits: All credits go to whoever's code you recognize, if you see any. A lot of the ideas and implementation here was taken either directly or with a grain of salt from either Comet or Albetros. I claim nothing here, as nothing Ive done so far would be possible for me without the leg work the community has done. Some details on what the project does now this thread will be updated as the project gets updated, I will try my best to have daily commits for anyone interested in following. - Right now the server is implemented up to the point where we respond to the client to the create player packet https://github.com/berniemackie97/OpenConquer 8/23/2025 first update. dont remember the current state just pushed up what I had when I was last working on this a few weeks ago. Will be coming back to this soon, what I'm working on now should make working on the server easier
  14. Totally get that! I have a 9 month old and up until recently I thought I would never have time for another hobby project again haha. It comes and goes for me. I think prior to this I havent dusted off VS on my personal computer in almost a year. Between work, and life I just couldnt find the motivation or I should say anything that interested me enough to take on. I certainly partially envy that I didnt get into this back in the day when the community around conquer as a whole was more alive, that must have been an experience seeing and being a part of all the developments and discoveries as they happen. Speaking of I want to give a huge thank you to not only yourself but also all the other amazingly talented individuals that I have seen and learned from. Despite being pretty new here (and seemingly late to the party lol), I feel like I almost got to see a piece of all from an observers lens, through reading posts on epvp. Thanks for the welcome!
  15. Hey everyone! My name is Bernie, going to just copy my intro from another post I made here earlier: I've recently gone down a rabbit hole over this old game I used to play back in my youth and have become fascinated not only with the community around this game and server emulation for it, but its history and everything, its been very cool reading all the forum posts and conversations, It's sucked up many of my nights these last couple of months haha. That said before this little adventure I've never done multiplayer game programming (did a few little mobile games back in college but that's it) mostly because I suck at art/modeling etc. Recently I've been working on revamping a 5518 client/server to be a game that can actually be enjoyed by a small handful of people (mainly intended to by played by just me and my wife). Any way its really cool to see so many familiar names here and on other forums still posting and talking about this topic. I also wonder what else you guys may have gotten into over the years outside of conquer. After I feel I've learned what I can from messing around with conquer I was thinking of messing around with some runescape server emulation as well. Also really Interested in sharpening my skills with reverse engineering and making my own tools for that.
×
×
  • Create New...