如何移植项目?

发布于 2024-09-19 22:55:40 字数 448 浏览 5 评论 0原文

我想将别人用 Java 编写的一个简单游戏移植到 GWT。他主要将其组织为两个包:一个用于用户界面,一个用于游戏逻辑。希望我可以重用他的游戏逻辑并重写用户界面,但我可能需要更改一些内容才能使用 GWT 进行编译。

我想知道如何最好地重用他的游戏逻辑代码。它是开源的,所以我有很多可能性。我应该使用 git 的子树合并或子模块功能以某种方式将他的代码混入我的存储库中吗?或者我应该吞下复制并粘贴游戏逻辑代码?如果我选择后者,那么回馈主项目或继承主项目的改进和错误修复将非常困难。

我问他是否愿意将他的游戏分成两个项目:一个用于 UI,一个用于游戏逻辑,但是一旦我必须更改游戏逻辑代码以使其在 GWT 中编译,这就会导致问题。此外,他不喜欢将单个应用程序拆分为多个项目的想法,他希望保持简单,我尊重这一点。

我怎样才能最好地接近这个端口?我想以前也发生过这种情况,即将 Java 软件移植到 JavaME 时,反之亦然。

I want to port a simple game someone else has written in Java to GWT. He organized it mainly into two packages: One for the user interface and one for the game logic. Hopefully, I can reuse his game logic and just rewrite the user interface, but I might need to change some things in order to make it compile with GWT.

I'm wondering on how to best reuse his game logic code. It's open source, so I have a range of possibilities. Should I use git's subtree merge or submodules features to somehow fumble his code into my repository? Or should I just gulp copy and paste the game logic code? If I do the latter, it would be extremely difficult to contribute back to the main project or inherit improvements and bug fixes from it.

I asked him whether he would like to split his game into two projects: One for the UI and one for the game logic, but this would lead to problems as soon as I have to change the game logic code to make it compile in GWT. Furthermore, he didn't like the idea of splitting a single application into several projects, he wants to keep it simple and I respect that.

How can I best approach this port? I presume it has happened before, i.e. when porting piece of Java software to JavaME or vice versa.

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

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

发布评论

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

评论(1

一江春梦 2024-09-26 22:55:40

如果您不想在服务器上运行游戏逻辑,那么您可以忘记回馈。您可以复制逻辑代码并将其逐行转换。或者编译器错误的编译器错误。这大约是。比新写快10倍,但会消耗很多时间。

问题是,GWT 中只有 JavaScript 中可能的情况。 95%不是问题,但最后5%就很难了,很费时间。如果您已编译它,则可以开始下一步。一般来说,您需要进行许多性能优化来减少下载大小。将代码拆分为多个脚本等。

If you does not want run the game logic on the server then you can forget to contribute back. You can copy the logic code and convert it line for line. Or compiler error for compiler error. This is approx. 10 times faster as a new writing but will consume many time.

The problem is that you in GWT has only this what in JavaScript possible is. 95% are not a problem but the last 5% are difficult and consume the time. If you have compile it then you start with the next step. In general you need to do many performance optimization to reduce the download size. Split the code to multiple scripts, etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文