java Java即时战略游戏开发
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3711487/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Java real time strategy game development
提问by avatarX
I'm coming to the end of my first year of CS and I thought a great way to consolidate all the things I've learnt this year would be a personal game project.
我即将结束我在 CS 的第一年,我认为巩固我今年学到的所有东西的好方法是个人游戏项目。
I would like to implement a 2D based rts, I'm thinking along the lines of starcraft I, warcraft II or even command and conquer. I will have about 3 months without interruptions to implement the game.
我想实现基于 2D 的 rts,我正在考虑星际争霸 I、魔兽争霸 II 甚至命令与征服的思路。我将有大约 3 个月的时间不受干扰地实施游戏。
So to anyone experienced with java game programming, I have a few questions:
所以对于任何有 Java 游戏编程经验的人,我有几个问题:
Is it realistic to design a 2D rts engine from scratch in 3 months? If so what are some good books/resources to get started?
在3个月内从头开始设计一个2D rts引擎是否现实?如果是这样,有哪些入门的好书/资源?
Would it be better to modify some existing project? I would think the experience of having to work with a lot of someone else's code would be good since our exposure to such topics in an undergrad cs degree seems very rare, if non-existent.
修改一些现有的项目会更好吗?我认为不得不使用很多其他人的代码的经验会很好,因为我们在本科 cs 学位中接触这些主题似乎非常罕见,如果不存在的话。
Are there any decent open source 2d rts projects that anyone could recommend? I've looked through a few but most seem to be written in c/c++
是否有任何人可以推荐的体面的开源 2d rts 项目?我看过一些,但大多数似乎是用 c/c++ 编写的
My humble thanks
我谦虚的感谢
Edit: Thanks for the quick responses, I think that perhaps it was a bad idea to post this in a rush since I think I misrepresented what I want to do.
编辑:感谢您的快速回复,我认为匆忙发布此内容可能是个坏主意,因为我认为我歪曲了我想做的事情。
When I say "along the lines of warcraft II etc" I mean more like that style of rts using sprites. I don't intend to implement a game nearly that complex, more like just a basic prototype.
当我说“沿着魔兽争霸 II 等的路线”时,我的意思更像是使用精灵的那种 rts 风格。我不打算实现一个几乎那么复杂的游戏,更像是一个基本的原型。
My goal would be some thing more like a flat textured map with some basic obstacles like trees, a single unit producing structure like a barracks. I'd like to have the units to have health bars, be able to move and attack and die (and possible morph into another unit).
我的目标是一些更像是带有一些基本障碍物(如树木)的平面纹理地图,以及像兵营这样的单个单元生产结构。我想让这些单位拥有生命值,能够移动、攻击和死亡(并可能变形为另一个单位)。
Far off goals would be to implement some basic pathing using a modified version of the dijkstra shortest path algorithm, ranged units with missle attack, etc.
遥远的目标是使用修改版的 dijkstra 最短路径算法、使用导弹攻击的远程单位等来实现一些基本路径。
I don't plan to implement any opponents or ai or networking or anything like that.
我不打算实施任何对手或人工智能或网络或类似的东西。
回答by Merlyn Morgan-Graham
I'm thinking along the lines of starcraft I, warcraft II or even command and conquer
我正在考虑星际争霸 I、魔兽争霸 II 甚至命令与征服的思路
Make sure you purge your mind of matching the full scope of any of those. They took large teams of developers multiple years to make, with multi-million dollar budgets, so you can't even hope to approach those. They're called AAA for a reason. That being said, there's no reason you can't very minimally ape their design, or make a tiny game in their genre, assuming you have previous experience making small games.
确保您清除了匹配其中任何一个的完整范围的想法。他们花了很多年的时间来制作大型开发团队,预算数百万美元,所以你甚至不能指望接近这些。他们被称为AAA是有原因的。话虽如此,假设您以前有制作小游戏的经验,没有理由不能极少地模仿他们的设计,或制作他们类型的小游戏。
A sub-genre of RTS that might be doable in that amount of time is a Tower Defensegame. Plants vs Zombies is a good example. The reason I suggest this sub-genre is that you can avoid implementing any sort of AI or path-finding, which are notoriously difficult to get working, and I think technically impossible to implement "perfectly", especially with a limited CPU budget.
在这段时间内可能可行的 RTS 子类型是塔防游戏。植物大战僵尸就是一个很好的例子。我推荐这个子类型的原因是你可以避免实现任何类型的 AI 或路径寻找,众所周知,它们很难开始工作,而且我认为在技术上不可能“完美地”实现,尤其是在 CPU 预算有限的情况下。
Make sure to reign in your scope. Favor a "complete" game over new features, because you can then call it "done" at any time. Get your game playable ASAP, and don't sweat the polish or details until you have to. Add one enemy type and one type of player unit (with only one ability, if you were thinking of implementing multiple abilities per unit). Make a title screen, menus (even if the menu is just "click screen to play"), game over screen, level complete or stat screens, cross-level player statistics, etc. Once you have all that ironed out, spend equal time adding new features and polishing the gameplay/graphics/bugs.
确保在你的范围内统治。与新功能相比,更喜欢“完整”的游戏,因为您可以随时称其为“完成”。尽快让您的游戏具有可玩性,在必要之前不要担心修饰或细节。添加一种敌人类型和一种类型的玩家单位(只有一种能力,如果您想为每个单位实施多种能力)。制作标题画面、菜单(即使菜单只是“点击屏幕播放”)、游戏结束画面、关卡完成或统计画面、跨关卡玩家统计等。一旦你解决了所有这些问题,就花相同的时间添加新功能并完善游戏玩法/图形/错误。
Once you have a playable, "complete" game ready (no matter how small in scope), find a real artist to do graphics for you. A shiny game always draws an audience, no matter how simple the gameplay.
一旦您准备好可玩的“完整”游戏(无论范围有多小),请找一位真正的艺术家为您制作图形。无论游戏玩法多么简单,闪亮的游戏总是能吸引观众。
回答by AHungerArtist
It is very unrealistic to think you could implement a 2D RTS engine anywhere even close to the complexity in those kind of games. You could maybe get something very rough if you were experienced, but with only one year I think it's doubtful.
认为您可以在任何地方实现 2D RTS 引擎甚至接近此类游戏的复杂性是非常不现实的。如果你有经验,你可能会得到一些非常粗糙的东西,但只有一年我认为这是值得怀疑的。
I can't help but feel like it would be much better for you if you used an existing engine or framework and built off of it. Like you said, working with other code would probably be a good learning experience as well. It would allow you to experiment without getting bogged down in having to do everything.
我不禁觉得,如果您使用现有的引擎或框架并基于它构建,对您来说会好得多。就像您说的那样,使用其他代码也可能是一种很好的学习体验。它可以让您进行实验而不会陷入必须做所有事情的泥潭。
回答by Thorbj?rn Ravn Andersen
Keep it simple or you will simply drown in complexity before getting around to have anything playable. Since you have not tried it before, you will have a lot of nuts to crack and you don't know how long they will take.
保持简单,否则在四处寻找任何可玩的东西之前,您只会淹没在复杂之中。由于您之前没有尝试过,您将有很多坚果要破解,您不知道它们需要多长时间。
Also remember that report writing and documentation takes time too.
还要记住,编写报告和文档也需要时间。
The idea is good, and I think you can pull off a whole game if you find good building blocks. I would suggest discussing this with your teacher to hear what is acceptable for you to use. Would it e.g. be ok to do a game on an open source engine if you add some non-trivial functionality?
这个想法很好,我认为如果你找到好的构建块,你可以完成整个游戏。我建议与您的老师讨论这个问题,以了解您可以接受的内容。例如,如果您添加一些重要的功能,在开源引擎上做游戏是否可以?
Update: Seems to be several engines available from Java at http://www.devmaster.net/engines/list.php?fid=6&sid=1
更新:在http://www.devmaster.net/engines/list.php?fid=6&sid=1 上似乎有几个可用的 Java 引擎
回答by Justin
Perhaps it would make sense to look at some existing efforts to get a feel for the scope of what you are looking at. These should give you some ideas or even code to build on:
也许看看一些现有的努力来了解你所看到的范围是有意义的。这些应该会给你一些想法甚至代码来构建:
http://www.duncanjauncey.com/btinternet/old/javagame/game.html
http://www.duncanjauncey.com/btinternet/old/javagame/game.html
http://en.wikipedia.org/wiki/Lightweight_Java_Game_Library
http://en.wikipedia.org/wiki/Lightweight_Java_Game_Library
http://en.wikipedia.org/wiki/JMonkeyEngine
http://en.wikipedia.org/wiki/JMonkeyEngine
It would be a lot for me to bite off (from scratch) in the time given that is for sure. That is about all I can say.
鉴于那是肯定的,在这段时间里我要咬掉(从头开始)。这就是我能说的。
EDIT:I thought maybe JOGREwas not what you are looking for. Then I thought about it and it seems like it would have all the right kinds of plumbing for what you are trying to do.
编辑:我想也许JOGRE不是你要找的。然后我考虑了一下,似乎它会为您尝试做的事情提供所有正确的管道。
EDIT AGAIN:After my answer, one of the related questions links on the side seemed relevant: Java Game Programming: JOGL vs LWJGL?
再次编辑:在我回答之后,旁边的一个相关问题链接似乎相关:Java 游戏编程:JOGL 与 LWJGL?
回答by InsertNickHere
People often forget, that creating games is MUCH MORE than just coding the technique thing. Its about content creation, game design, sound and music, the "fun factor". If you make heavy use of existent APIs or engines, it will be possible, but writing it from scratch with no experience in 3 month is like asking yourself if you can code 100,000 LOC in this time which means 1111 LOC per day. This might be possible, but not if you have to desing and think, and just having the code makes no game.
人们常常忘记,创建游戏不仅仅是编写技术代码。它关于内容创作、游戏设计、声音和音乐,“有趣的因素”。如果您大量使用现有的 API 或引擎,这是可能的,但是在 3 个月内没有经验的情况下从头开始编写它就像问自己,您是否可以在这段时间内编写 100,000 个 LOC,这意味着每天 1111 个 LOC。这可能是可能的,但如果您必须进行设计和思考,并且仅拥有代码并不能成为游戏,则不可能。
回答by Matthew
Well if it gives you any hope at all, my team and I are currently working on an RTS game called "The Genesis Project". We call ourselves MotherBoard Games, or MBG for short. If you would like, I am always looking for more coders. You can email me at [email protected], I can give you some advice and tips form my 6 year experience, 2 of which have been spent making this game (to give you a scope)
好吧,如果它能给你任何希望,我和我的团队目前正在开发一款名为“创世纪计划”的 RTS 游戏。我们称自己为 MotherBoard Games,简称 MBG。如果您愿意,我一直在寻找更多的编码员。您可以通过 [email protected] 给我发电子邮件,我可以从我 6 年的经验中给您一些建议和技巧,其中 2 年用于制作这个游戏(给您一个范围)