by Luke Konior

卢克·科尼尔(Luke Konior)

SpriteKit Advanced —如何构建2,5D游戏(第一部分) (SpriteKit Advanced — How to build a 2,5D game (Part I))

介绍 (Intro)

This article is about graphical evolution of Raft Challenge from the prototype to the final product. It’s AIM-ed for the people who are thinking about making their own game with graphics like Raft, but don’t know exactly how to start.

本文介绍了Raft Challenge从原型到最终产品的图形演变。 它是针对那些想使用Raft之类的图形制作自己的游戏,但又不知道该如何开始的人的AIM 。

筏挑战的开始 (The very beginning of Raft Challenge)

Raft Challenge was born during the first hackathon organized by All In Mobile. The idea was to make a game where a player avoids obstacles. We wanted to keep things as simple as possible.

Raft Challenge诞生于All In Mobile组织的第一次黑客马拉松。 当时的想法是制作一款能够避免障碍的游戏。 我们希望使事情尽可能简单。

After the weekend, we had a prototype that looked like this:

周末之后,我们有了一个看起来像这样的原型:

Raft Challenge won the hackathon. The company announced that it’ll make the resources to improve the game.

Raft Challenge赢得了黑客马拉松。 该公司宣布将投入资源改进游戏。

让它变成2,5D! (Let’s make it 2,5D!)

At the start of the project, Raft had the simplest possible graphics. A view was directly over a flat ground texture, with colored circles that indicated the player and the enemies. It was beautiful and as simple as the code underneath. Then our graphic designer came and messed up everything. He said, “Let’s make it 2,5D!”. The challenge was accepted and the animation above was the result.

在项目开始时,Raft拥有最简单的图形。 视图直接位于平坦的地面纹理上,带有彩色圆圈,指示玩家和敌人。 它很漂亮,而且与下面的代码一样简单。 然后我们的平面设计师来了,把所有东西弄乱了。 他说:“让我们制造2,5D!”。 挑战被接受了,上面的动画就是结果。

After the hackathon he showed up once again. This time it was something more than one sentence.

黑客马拉松结束后,他再次出现。 这次不只是一句话。

It was an evil smile and this video:

这是一个邪恶的微笑,这个视频:

透视解释 (Perspective explained)

Ok, let’s drop the act :-). I’ve wanted to give him the feeling that he’s in charge. But I’m the boss here! The perspective is easy to implement in code, regardless of what 2D engine we use.

好吧,让我们放下行为:-)。 我想给他一种他负责的感觉。 但是我是这里的老板! 无论我们使用哪种2D引擎,该透视图都易于在代码中实现。

First, we have to determine where we want to put the vanishing point. The example below shows this point in the center of the canvas.

首先,我们必须确定消失点的位置 。 下面的示例在画布中心显示此点。

Raft Challenge has this point in the upper half of the screen, because the sky and everything overhead isn’t as important as obstacles on the river.

“木筏挑战赛”的这一点位于屏幕的上半部分,因为天空和头顶上的一切都没有河上的障碍那么重要。

How are the sprites themselves made? While it may be obvious for someone with artistic background, it isn’t necessarily clear for a technical person.

精灵本身是如何制作的? 尽管对于具有艺术背景的人来说可能是显而易见的,但对于技术人员而言并不一定很清楚。

There are two rules:

有两个规则:

  • Moving parts must be drawn along the helper lines as shown above

    如上所示,必须沿辅助线绘制运动零件

    All those lines intersect in the vanishing point

    所有这些线在消失点处相交

Note: The coast part isn’t reaching the vanishing point. It stops somewhere in the middle, leaving the transparent area behind.

注意:海岸部分尚未达到消失点。 它停在中间的某个位置,而后面保留透明区域。

  • That empty area between the graphic and the vanishing point has an important purpose

    图形和消失点之间的空白区域具有重要目的

    It’ll hold elements that are further away.

    它将容纳更远的元素。

Those parts are made by applying a twice smaller scale for each step. The resulting image should be seamless if the texture is well-made.

这些零件是通过在每个步骤上应用两倍较小的比例来制作的。 如果纹理制作精良,生成的图像应该是无缝的。

组装现场 (Assembling the scene)

After we’ve prepared all our assets, we need to put them all into the scene.

准备好所有资产后,我们需要将它们全部放入场景。

Let’s see how it looks in Raft Challenge.

让我们看看Raft Challenge中的外观。

Starting from the bottom:

从底部开始:

  1. Background layers

    背景层

    Background

    背景

    Grass

    Fog bottom

    雾底

    Sun

    太阳

    Mountains

    山脉

    Horizon Line

    地平线线

  • These layers are all static they don’t move这些图层都是静态的,不会移动
  • Background acts for both the sky and water背景作用于天空和水
  • The background is a plain gradient

    背景是纯色渐变

    It’s stretched to fill the entire device’s screen

    它被拉伸以填满整个设备的屏幕

    The aspect ratio is ignored

    长宽比被忽略

  • We may merge layers other than Background for increased performance unless we want to change some properties除非要更改某些属性,否则我们可以合并除Background以外的其他层以提高性能
  • We may move the sun during the gameplay

    我们可能会在游戏过程中移动太阳

    or replace mountains for something different

    或用别的东西代替山脉

2. Perspective layers Trees with reflections Coast Obstacles

2.透视图层树木反射海岸障碍物

  • For the clarity of the image above, layers with similar content were grouped

    为了清晰显示上图,将内容相似的图层分组

    There were:

    曾经有:

    2 layers of Obstacles

    2层障碍

    8 layers of Coast

    8层海岸

    8 layers of Trees with reflections

    8层树木与思考

  • These layers are scaled up by 2 when a player is moving forward玩家向前移动时,这些图层将按2缩放
  • Order of these layers depends on

    这些层的顺序取决于

    distance

    距离

    closer ones are on top

    最接近的是最上面的

    priority

    优先

    Obstacle > Coast > Trees

    障碍物>海岸>树木

3. Character

3.性格

  • If an Obstacle is in the closest possible position, it may have z-position higher than the Character itself

    如果障碍物位于最接近的可能位置,则其z位置可能比角色本身高

    In this case, the Obstacle covers the Character, which is desirable

    在这种情况下,障碍物会覆盖角色,这是可取的

4. GUI

4. GUI

  • Good graphics should depend on illusions and tricks instead of hardware好的图形应该依靠幻想和技巧而不是硬件

摘要 (Summary)

This article should give us an idea how to approach the problem of making assets to a 2,5D game and organizing them into a scene.

本文应该给我们一个思路,如何解决将资产制作成2,5D游戏并将其组织到场景中的问题。

You can read part 2 of this series here.

您可以在这里阅读本系列的第2部分 。

About the author: Kamil Ziętek is an iOS Developer at www.allinmobile.co

关于作者:KamilZiętek是www.allinmobile.co上的iOS开发人员

翻译自: https://www.freecodecamp.org/news/spritekit-advanced-how-to-build-a-2-5d-game-part-i-2dc76c7c65e2/

SpriteKit Advanced —如何构建2,5D游戏(第一部分)相关推荐

  1. advanced east_SpriteKit Advanced —如何构建2,5D游戏(第二部分)

    advanced east by Luke Konior 卢克·科尼尔(Luke Konior) SpriteKit Advanced -如何构建2,5D游戏(第二部分) (SpriteKit Adv ...

  2. 【独立开发一个2.5D游戏 】—— 2.5D视角构建

    一.写在前面 本文提供常见2.5D游戏创建地图的方式,实现思路来源于Google以及个人的分析.如有解释不妥当之处,还请各位及时指出. 下面会留一个本文配套工程的运行截图,过后将开始我们的正文. 二. ...

  3. 从零开始的2.5D游戏开发

    游戏按照镜头视角来分,可以分为2D游戏.3D游戏,除此之外还有一类游戏被称为2.5D游戏.这是一个比较有争议的分类,这个分类有着不同的解释.有的人认为这只是厂商的噱头,它本身就是2D游戏(我曾经也这么 ...

  4. Unity3D 游戏引擎之构建简单的游戏世界(三)

    Unity3D 游戏引擎之构建简单的游戏世界 雨松MOMO原创文章如转载,请注明:转载至我的独立域名博客雨松MOMO程序研究院,原文地址:http://www.xuanyusong.com/archi ...

  5. 画布式编程_构建HTML5画布游戏如何帮助我学习编程

    画布式编程 by Surbhi Oberoi 由Surbhi Oberoi 构建HTML5画布游戏如何帮助我学习编程 (How building HTML5 canvas games helped m ...

  6. 使用ThreeJs从零开始构建3D智能仓库——第一章(一切的基础)

    引用链接:https://blog.csdn.net/homula123/article/details/101197463 使用ThreeJs从零开始构建3D智能仓库--第一章 写在前面 如何实现 ...

  7. 现代软件工程—构建之法》第一章 中出现的计算机专业术语

    现代软件工程-构建之法>第一章 中出现的计算机专业术语 软件 程序 软件工程 二叉树 遍历算法 数据结构 算法 应用软件 软件服务 源程序 软件架构 软件设计与实现 依赖关系 编译参数 链接参数 ...

  8. 青瓷引擎打造HTML5游戏第一弹——《神奇的六边形》Part 4

    近期出现一款魔性的消除类HTML5游戏<神奇的六边形>,今天我们一起来看看如何通过开源免费的青瓷引擎(www.zuoyouxi.com)来实现这款游戏. (点击图片可进入游戏体验) 因内容 ...

  9. wxWidgets:构建wxWidgets程序的第一步

    wxWidgets:构建wxWidgets程序的第一步 wxWidgets:构建wxWidgets程序的第一步 介绍 wxWidgets 架构和你的第一个程序 使用 MinGW 构建 wxWidget ...

最新文章

  1. relative和absolute的区别
  2. 最大似然估计Maximum-likelihood (ML) Estimation
  3. hibernate继承关系映射方法(三)--每个具体类一张表TPC
  4. 每天进步一点点:(11)进程优先级学习 nice
  5. Qt Linguist手册
  6. 前端学习(1809):前端调试之微博头部开发
  7. Appium——api常用函数
  8. faster rcnn的tensorflow代码的理解
  9. 让你的silverlight更炫(一):从自定义控件说起
  10. jquery双击一行跳转页面_Word软件使用小技巧,鼠标双击在不同操作对象中有不同的功能...
  11. java中map函数指针_如何用Rust编写合适的map函数?
  12. 爱与光 android4.0学习
  13. 容智RPA可以在医疗哪些业务上降本增效
  14. 2020年最好用的手机是哪一款_2020最好用的5G手机是哪一款?热销2020年5g手机推荐及点评...
  15. SpringBoot整合Memcached缓存
  16. 整理一下用得着的链接
  17. 张恩民谈程序员“三点式” 学习方法
  18. RxJava 两种生产和消费模式,(冷)cold和(热)hot
  19. UR机器人通信接口总结
  20. Bot Chat(聊天机器人) HeroCard的简单用法

热门文章

  1. 设置让终端保持utf8 cmd的设置
  2. 更新显示当前歌曲的名称 winform 0130
  3. java演练 循环嵌套 菱形图案的打印 四个阶段完成输出
  4. fastdfs-客户端配置
  5. 网络编程-关于get请求与post请求
  6. linux批量替换文件夹中所有文件内容
  7. 荣耀发布了全球首款 4800 万像素手机,并推出 YOYO 智能音箱...
  8. ECS上配置FTP Filezilla
  9. Mongoose之 SchemaTypes 数据类型
  10. 让IE支持HTML5