更改游戏服务器平台 [英] Changing a game server platform

查看:29
本文介绍了更改游戏服务器平台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个小型多人游戏,目前游戏服务器在 c# 控制台应用程序中运行.

I'm developing a small multiplayer game, and currently the game server runs in a c# console application.

这限制了我,因为:

  • 每当我在控制台中启动文本选择时,服务器就会卡住.如果我什至不小心触摸了控制台,服务器就会卡住,我很震惊客户端不知何故卡住了,而一旦我右键单击控制台并取消选择,它就会超时
  • 我无法向服务器提供用户输入.说,我想实现服务器命令,我编写了一个很棒的系统来处理我可以使用的发布-订阅消息,但我没有任何方法可以轻松发送这些消息,因为服务器是基于控制台的我不能依赖控制台输入,当控制台有很多输出时,客户端(也可以发布这些消息)是 XNA 基础,并且没有简单的方法在客户端实现控制台(这将是一件很棒的事情,如果我为 XNA 控制台找到一个好的库,它会以某种方式解决我的一些问题).

我有几个选项可供选择 -

I have several options to choose from -

  • WPF - 我可以用 WPF 而不是 ConsoleApplication 编写服务器.这会给我一些不错的 GUI,并且它会相对容易集成,因为大部分代码是一个库,我什至不需要导出事件,因为我将能够使用我的发布订阅系统事件.

  • WPF - I can write the server in WPF instead of a ConsoleApplication. This would give me somehow nice GUI, and it would be relatively easy to integrate since the majority of the code is a library and I wouldn't even need to export events, since I would be able to use my pub-sub system for the events.

Web - 我脑子里有这张图 - 我运行一个可执行文件来启动本地服务器,它只会在后台运行,人们可以定期连接,但我可以访问一个网页,并通过它控制服务器.它当然是与游戏服务器本身不同的端口(我假设),我将能够通过它控制服务器(发送命令、踢球员、重新开始回合等等).

Web - I have this picture in my mind - I run an executable which starts a local server, and it would just run in the background, people would be able to connect regularly, but I would be able to access a web page, and control the server through it. It would of course be a different port than the game server itself (I assume), and I would be able to control the server (send commands, kick players, restart rounds, and so on) through it.

我来这里的目的,首先是为了您的建议.你觉得什么更适合,利弊.如果我们谈论的是基于 Web 的服务器,那么最标准的做法是什么?我的意思是...主要是为了提升服务器,以及网站如何与它通信.

What I'm here for, is for your suggestions, first of all. What do you find more suitable, pros and cons. And if we're talking about a web-based server, what's the most standard way of doing that? I mean... mostly for raising a server, and how the website would communicate with it.

感谢阅读,提前感谢您的建议!

Thanks for reading, and thanks in advance for the advises!

推荐答案

最简单的可能是使用类似 Nancy 的东西(使用起来超级简单)来处理 REST 命令.您可以将 Nancy webhost 项目添加到您的解决方案中,并与您的服务器一起运行,重复使用您的发布/订阅架构.此外,您还可以将 Nancy 用于某些在服务器上可能无法正常工作的客户端服务.

Easiest would probably be to use something like Nancy (which is super simple to use) to process REST commands. You can add a Nancy webhost project to your solution and run it alongside your server, reusing your pub/sub architecture. Bonus, you can then use Nancy for certain client services that may not work as well on the server.

这实际上类似于我们在没有 XNA 游戏时所做的事情,除了 Nancy 还与服务器一起直接与客户端对话,以提供某些对性能不重要的 CPU 或数据库绑定数据.我们使用 redis 来处理 Nancy 主机和服务器实例之间的 pub/sub 通信.

This is in fact similar to what we're doing with out XNA game, except Nancy also talks directly to clients, alongside the server, to serve up certain cpu or database bound data that isn't performance critical. We use redis to handle the pub/sub communication between the Nancy hosts and server instances.

这篇关于更改游戏服务器平台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆