什么是“正常”向中央服务器(MMO)进行反馈游戏动作的方式

发布于 2025-01-27 18:27:32 字数 245 浏览 3 评论 0原文

基本上,我需要使用GDScript将“事件”送回中央服务器。 IE用户拿起了此功能,用户将其丢弃了。 https适合我的目的。 (一种适用于需要在应用程序之间共享活动事件的应用程序的技术)

如何在GDScript中实现队列/线程来处理此活动?

我倾向于将事件放入SQLITE数据库中,然后具有某种“线程”来拾取并重试发送事件。这通常是从头开始编码的吗?您如何进行线程?如果没有线程,则在HTTP请求失败时如何处理,您如何确保某些内容会重新检索消息。

Basically I need to feed "events" back to the central server using gdscript. i.e. User picked up this, user dropped this, etc.... Im assuming the mobile phone holds an "event queue" that needs to be shipped off to the server. HTTPS is fine for my purposes. (A technique that would apply to any application that needs to share activity events between applications)

How does one implement a queue/thread in gdscript to handle this activity?

Im inclined to drop events into an sqlite database, then have some kind of "thread" that picks up and retries sending the events. Is this something that is normally coded from scratch? How do you do threads? If there are not threads, how do you handle when a http request fails, how do you ensure that something retries the message.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

仅一夜美梦 2025-02-03 18:27:32

在此时间点,似乎没有在事件队列样式框架中进行标准化/内置。

一个带有队列的数组的简单类/节点与简单的功能很好地排队消息。这说明了提交HTTP请求,当请求完成或失败时,将回调对http_result进行回调。

http_request = HTTPRequest.new()
add_child(http_request)
http_request.connect("request_completed", self, "http_result")

HTTP结果处理:

func signin_status(结果,响应_code,标题,身体):

if response_code == 200:
    var data = parse_json(body.get_string_from_utf8())
    print("json: ", data)
    print("headers: ", headers)
else:
    print("http response: ", response_code, " CODE: ", result, " data:", body.get_string_from_utf8())
remove_child(http_request)
http_request = null

At this point in time, there does not appear to be a standardized/built in event queue style framework.

A simple class/node with an array acting as a queue works well with a simple function to queue messages. This demonstrates submitting a http request, where a callback is made to a function called http_result when the request is complete or fails.

http_request = HTTPRequest.new()
add_child(http_request)
http_request.connect("request_completed", self, "http_result")

http result handling:

func signin_status(result, response_code, headers, body):

if response_code == 200:
    var data = parse_json(body.get_string_from_utf8())
    print("json: ", data)
    print("headers: ", headers)
else:
    print("http response: ", response_code, " CODE: ", result, " data:", body.get_string_from_utf8())
remove_child(http_request)
http_request = null
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文