我想知道什么方法最好为射击者渲染 2D 地图(这些将是静态地图),类似于 士兵。我考虑过的多个选项是基于图块的地图(存储在 txt 文件中),或者只是为我计划使用的不同地形创建不同的类,并创建一个数据结构来读取/存储它们在文件中。 (我还希望能够包括在墙上跳跃/奔跑、从墙壁/斜坡上滑下等内容)
我觉得一定有比这两种方法更好的方法,但一直无法找到明确的信息:/
谢谢 :)
I'm wondering what way would be best to render a 2D map for a shooter (these will be static maps) similar to Soldat. Multiple options I've considered are a tile based map (stored in txt files), or just creating different classes for the different terrains I plan to use and creating a data structure to read/store them in a file. (I want to also be able to include things like jumping/running on walls, sliding down walls/slopes ect)
I feel like there must be a better way than either of these, but haven't been able to find definitive information :/
Thanks :)
发布评论
评论(4)
Solat 使用基于多边形的格式来渲染和表示其级别。编辑器将允许用户绘制点和它们之间的连接,以制作墙壁和结构,然后给出纹理和属性(例如碰撞=死亡)。然后将项目和图像叠加在其上。
然后,solat 渲染引擎将使用这些结构来执行碰撞检测并构建世界的多边形(绘制的三角形)表示。
Soldat used a polygon based format to render and represent it's levels. The editor would have allowed the user to plot points and connections between them to make walls and structures when were then given textures and properties (such as collide = death). Items and images where then overlayed over this.
The soldat rendering engine would then use these structures to perform collision detection and to build up the polygon (triangles that are drawn) representation of the world.
我原本打算“只使用瓷砖地图”,但后来我查看了 Soldat,发现它有点复杂。
我不知道他们在使用什么,但我怀疑他们正在使用多边形,并且可能还会与多边形发生碰撞。这些关卡可能是用 3D 游戏中看到的相同类型的图元生成的,但全部在一个平面上。例如,纹理映射三角形以及与表面边缘的碰撞而不是与表面本身的碰撞。
根据我的经验,“地形”本身通常是一个对象,碰撞和视觉表示是该对象内部的数据(通常聚合到该对象中)。不同的地形不一定需要是不同类型的东西,事实上,在我制作的所有游戏中,整个世界通常是“地形”或“世界”或其他类型的单个对象,并且它管理进入和离开视野的各种可见部件的行为。
这感觉不是一个很好的答案,但我想我会尽力给你一些东西。
I was going to go with the "just use a tile map," but then I looked at Soldat and it's a bit more complex.
I don't know what they're using, but I suspect they're using polygons and probably colliding against polygons as well. The levels are likely generated with the same sort of primitives you'd see in 3D games, but all in a plane. E.g. texture mapped triangles and collision against the edges of the surfaces rather than against the surface itself.
In my experience, "terrain" is usually an object in itself and the collision and visual representations are data inside that object (aggregated into that object, typically). The different pieces of terrain don't necessarily need to be different types of thing, indeed in all of the games I've made the entire world was generally a single object of type "Terrain" or "World" or something and it managed the doings of the various visible pieces coming into and out of view.
This doesn't feel like a great answer, but I thought I'd try to give you something.
执行您想要的操作的平台游戏示例有 Braid 和 Aquaria。通过 Humble Indie Bundle,您只需 2 便士就能获得 Aquaria。
这是Aquaria 编辑器的实际应用。我找不到一个像样的辫子编辑器视频。
我发现 这个关于 IndieLib 的另一个视频,以及他们创建的类似于 Aquaria 的关卡编辑器(免责声明:我自己还没有尝试过)。
除此之外,谷歌搜索“Braid 和 Aquaria 平台引擎”应该会给你更多结果。
Examples of platform games doing what you want are Braid and Aquaria. You can get Aquaria for 2 pennies litteraly, with the Humble Indie Bundle.
Here's the Aquaria's editor in action. I could not find a decent video of the Braid editor.
I found this other video about IndieLib, and a level editor that they have created which is similar to Aquaria's (Disclaimer: I haven't tried it myself).
Appart from that, googling for "Braid and Aquaria platform engine" should give you more results.
我建议阅读这本书构建 XNA 2.0 游戏:独立游戏开发实用指南。它引导您完成一款名为 Zombie Smashers 的 2D 横向游戏的开发(基于作者获奖的 洗碗机:死武士)。
第 4 章:地图编辑器正是您所需要的。
即使您不打算在 XNA 中进行开发,它也会对您有所帮助。
I would recommend reading the book Building XNA 2.0 Games: A Practical Guide for Independent Game Development. It walks you through the development of a 2D side-scoller game named Zombie Smashers (based on the author's award-winning The Dishwasher: Dead Samurai).
Chapter 4: The Map Editor is what you are looking for.
It will help you even if you don't plan on developing in XNA.