Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
425 views
in Technique[技术] by (71.8m points)

javascript - 如果使用Socket.IO,是否可以为HTML编译LibGDX游戏? 如果是这样,怎么办?(Is it possible to compile a LibGDX game for HTML if it uses Socket.IO? If so, how?)

From what I've seen , it seems to use socket.io in my game and have it run, I would need to do a lot of work to wrap JS code for Java and other things that currently fall outside my field of expertise.

(从我所看到的来看 ,它似乎在我的游戏中使用了socket.io并使其运行,我将需要做很多工作来包装Java的JS代码以及目前不在我的专业知识范围内的其他东西。)

Should I try to learn and do this proposed solution?

(我应该尝试学习并执行建议的解决方案吗?)

Is it supposed to work by default and I'm just not doing something right?

(默认情况下应该可以正常工作吗?)

Is there an alternative to Socket.IO that I could use and implement without having to change too much of my code base?

(是否可以使用和实现Socket.IO的替代方法,而不必更改太多代码库?)


If you want the more specific issue , the following error happens during task "draftCompileGwt":

(如果需要更具体的问题,则在任务“ draftCompileGwt”期间会发生以下错误:)

> Task :html:draftCompileGwt
Loading inherited module 'com.lab.guy.GdxDefinitionSuperdev'
  Loading inherited module 'io.socket'
   [ERROR] Unable to find 'io/socket.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?

When I add this code to GdxDefinitionSuperdev.gwt:

(当我将此代码添加到GdxDefinitionSuperdev.gwt时:)

<inherits name='io.socket' />

When I don't, the error is:

(当我不这样做时,错误是:)

> Task :html:draftCompileGwt
Compiling module com.lab.guy.GdxDefinitionSuperdev
   [ERROR] Errors in 'file:/C:/Users/Gui/Desktop/Projects/Games/TouhouIO/core/src/com/lab/guy/Touhou.java'
      [ERROR] Line 53: No source code is available for type io.socket.client.Socket; did you forget to inherit a required module?
      [ERROR] Line 177: No source code is available for type io.socket.client.IO; did you forget to inherit a required module?
      [ERROR] Line 188: No source code is available for type org.json.JSONObject; did you forget to inherit a required module?
      [ERROR] Line 204: No source code is available for type org.json.JSONException; did you forget to inherit a required module?
      [ERROR] Line 212: No source code is available for type io.socket.emitter.Emitter.Listener; did you forget to inherit a required module?
      [ERROR] Line 409: No source code is available for type org.json.JSONArray; did you forget to inherit a required module?
   Tracing compile failure path for type 'com.lab.guy.Touhou'
      [ERROR] Errors in 'file:/C:/Users/Gui/Desktop/Projects/Games/TouhouIO/core/src/com/lab/guy/Touhou.java'
         [ERROR] Line 188: No source code is available for type org.json.JSONObject; did you forget to inherit a required module?
         [ERROR] Line 204: No source code is available for type org.json.JSONException; did you forget to inherit a required module?
         [ERROR] Line 53: No source code is available for type io.socket.client.Socket; did you forget to inherit a required module?
         [ERROR] Line 177: No source code is available for type io.socket.client.IO; did you forget to inherit a required module?
         [ERROR] Line 212: No source code is available for type io.socket.emitter.Emitter.Listener; did you forget to inherit a required module?
         [ERROR] Line 409: No source code is available for type org.json.JSONArray; did you forget to inherit a required module?
      [ERROR] Errors in 'file:/C:/Users/Gui/Desktop/Projects/Games/TouhouIO/core/src/com/lab/guy/Player.java'
         [ERROR] com.lab.guy.Touhou cannot be resolved to a type

Full log with stack trace: https://pastebin.com/uT1pH0PV

(具有堆栈跟踪的完整日志: https : //pastebin.com/uT1pH0PV)

PS: When compiling for Desktop, Socket.IO is properly included.

(PS:为桌面编译时,正确包含Socket.IO。)

It is featured in the "core" section of my build.gradle.

(它在我的build.gradle的“核心”部分中进行了介绍。)

The server I'm running is in Node.JS.

(我正在运行的服务器在Node.JS中。)

PPS: If I could just see how to make the basic LibGDX application (baglogic logo) compile for HTML with Socket.IO, I could substitute it for my code and have it work :)

(PPS:如果我能看到如何使用Socket.IO使基本的LibGDX应用程序(baglogic徽标)为HTML编译,我可以用它代替我的代码并使它工作:))

Thank you for reading!

(感谢您的阅读!)

  ask by Guy translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...