火星任务(2):探索太阳系(译文)
By robot-v1.0
本文链接 https://www.kyfws.com/games/mars-mission-2-explore-the-solar-system-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 23 分钟阅读 - 11116 个词 阅读量 0火星任务(2):探索太阳系(译文)
原文地址:https://www.codeproject.com/Articles/129312/Mars-Mission-2-Explore-the-Solar-System
原文作者:Christ Kennedy
译文由本站 robot-v1.0 翻译
前言
strategy/action game defending the solar system : interplanetary space
捍卫太阳系的战略/动作游戏:行星际空间
下载1_MarsMission__2__SourcCode.zip-692.36 KB(Download 1_MarsMission__2__SourcCode.zip - 692.36 KB) 下载2_MarsMission__2__Sprites_A.zip-5.76 MB(Download 2_MarsMission__2__Sprites_A.zip - 5.76 MB) 下载3_MarsMission__2__Sprites_B.zip-2.37 MB(Download 3_MarsMission__2__Sprites_B.zip - 2.37 MB) 下载4_MarsMission__2__Bitmaps.zip-4.9 MB(Download 4_MarsMission__2__Bitmaps.zip - 4.9 MB)
火星任务(Mars Mission)
在系列的上一篇和第一篇文章中(In the previous and first article in the series) 火星任务(1):水面着陆(Mars Mission (1): Surface Landing) 我们看了碰撞检测(we looked at the collision detection) classLandscape
以专门用于调试该项目着陆和起飞阶段的形式进行开发.在过去的一个月中,我一直在忙于将着陆阶段纳入太阳系模拟器中,并将两者结合在一起,以便您现在可以在太阳系中的任何位置飞行航天飞机.您不再可以像我们刚刚测试碰撞检测系统那样无限期地反弹,而不必担心突然撞毁并烧毁整个维纳斯远景之前会遇到一些颠簸和擦伤.就是说,只有当您的船体没有被地球上如此巨大的大气如此严重地粉碎,您才能使凭证无效,并用压碎的您和您的船员一点点将灰尘扑到下面.(being exploited in a form designed for the sole purpose of debugging the landing and take-off phase of this project. This past month I’ve been busy incorporating the landing stage into a solar-system simulator and have joined the two together so that you can now fly your shuttle anywhere in the solar system. You can no longer bounce around indefinitely like you could when we were just testing the collision detection system but rather have to worry about getting a few bumps and bruises before you suddenly crash and burn all over the virgin Venus vista. That is, only if your ship’s hull doesn’t get pulverized so severely by the planet’s massive atmosphere that you void your voucher and riddle the dust down below with crushed little flaming bits of you and your crew.)
classSprite(classSprite)
我不想谈论我已经做出的更改(I don’t want to talk about the changes I’ve made to) classSprite
及其编辑器.在上个月的大部分时间里,有很多改进工作才能正常进行.我承认,在发布上一篇文章并将景观领域纳入其中之前,我已经让太阳系模拟器工作了,这并不是什么难题.我喜欢控件和良好的UI,所以我花了一些时间,但大部分时间我都一直沉迷于Sprite-Editor及其类的修复工作,该类解决了该项目的起落架的"镜像"问题.一切正常,该类当前正在加载" .sp3"文件,而不是以前的任何版本.每四分之一圈的图像数量是可变的,可以使用编辑器进行修改.他们不会在加载时加载所有肢体图像,而是根据请求加载,这意味着(and its editor. There are lots of improvements which took the better part of the last month and a half to get working right. I admit, I had the solar-system simulator working before publishing the previous article and incorporating the landscape area into it wasn’t that much of a challenge. I love controls and a good UI so I took my time about it but mostly I’ve been bogged down working on Sprite-Editor and its class fixing the problem with the ‘mirrors’ for this project’s landing gear. And that’s all working and the class is currently loading “.sp3” files instead of any of the previous versions. The number of images per quarter rotation is variable and can be modified using the editor. They do not load all limb-images at load time but on request which means the) classSpriteMaker
保留一系列打开的文件流以避免冲突,并且它们都使用一组通用的三叉树将其输出图像缓存到硬盘上.这些缓存文件从一个会话增长到下一个会话(每个工作目录一个),这意味着您的项目需要在启动时加载缓存的RAM部分.它有点复杂和扭曲,但远不及我尝试使这些精灵工作时所经历的三角体操扭曲,然后我最终决定采用一种简单的方法来完成复杂的工作,并决定降低计算时间的成本&较小的内存要求是使用更简单的方法来完成相同操作的不错的折衷方案.简而言之,我沉迷于尝试用困难的方法做事的头脑,然后下意识地想出一种正确的方法来解决这个问题.精灵很棒.(keeps an array of open file-streams to avoid conflicts and they all cache their output images onto the Hard-Drive using a common set of ternary trees. These cache-files grow(one per working directory) from one session to the next which means your projects need to load the RAM-part of the cache at startup. its a bit complicated and twisted but nowhere near as contorted as the trig-gymnastics I went through trying to get the mirror images of these sprites working before I finally settled on a simple means of doing the complicated and decided that a lesser cost in computation time & smaller memory requirements were a good compromise for the use of a simpler means of doing the same thing. In short, I wracked my headed trying to do it the hard way and then alighted to an easy means to getting it right and … tada! the sprites are great.)
但是我不想谈论这一点,每当我下半年写它的时候,它将在Sprite-Editor升级中,也许是明年.(but i don’t want to talk about that, that’ll be in the Sprite-Editor upgrade whenever I get around to writing it, maybe next year.)
安装(Installation)
要将Mars Mission安装到计算机上,您首先必须下载源代码和随附的sprite/image文件.一共有四个文件,您应按其顺序下载(1\2\3和4).第一个有源代码,提取其中的文件将创建一个目录,从中提取其他文件.应将编号为2\3和4的文件提取到您从第一个文件中提取的目录中,在该目录中,您将找到下面显示的项目图标.(To install Mars Mission onto your computer you’ll first have to download the source-code and the accompanying sprite/image files. There are four files in all which you should download in their enumerated order(1, 2, 3 & 4). The first one has the source-code and extracting the files in it will create the directory in which to extract the others. The files numbered 2,3 & 4 should be extracted into the directory which you extracted from the first file where you’ll find the project’s icon shown below.)
它应该与" resources"和" properties"目录位于同一目录中,这样,一旦您将精灵和图像添加到项目中,所有这些新文件(* .sp3,*.bmp和* .jpg文件)将与"资源"和"属性"目录一起列出.这些文件保存在计算机上后,便可以启动(*It should be in the same directory as the “resources” & “properties” directories such that once you’ve added the sprites and images to the project all these new files (*.sp3, *.bmp & a *.jpg file) will be listed along with the “resource” and “properties” directories. Once these files are on your computer you can spark-up your*) C#2010(C#2010) 并加载项目.(*and load up the project.*)
初始化数据(Initializing the data)
首次运行"火星任务"时,它必须自行初始化.除了耐心之外,您无需执行任何操作.它很大.初始化速度很慢,因为它在运行时需要大量数据.因此,我强烈建议您在第一次加载游戏时编译项目并运行可执行文件.这样做的原因是因为现在所有这些位图都需要旋转N次.行星及其卫星在代码中都被称为"太阳物体",并且每个都是(The first time you run Mars Mission it will have to initialize itself. You don’t have to do anything except be patient. Its big. Its slow to initialize because it needs a lot of data at the ready during run-time. So I strongly suggest you compile the project and run the executable the first time you load up the game. The reason for this is because all those bitmaps now need to be rotated N times each. The planets and their satellites are all called “solar-objects” in the code and are each instances of) classSolarObject
.在运行时,这些行星和卫星绕其轴旋转,尽管每四分之一圈旋转图像数的默认建议设置为16(项目将提示您将此值作为建议设置)以获得更好的结果,但将其更改为90.运行时的差异是巨大的,而成本只是在您首次加载游戏时进行设置的时间.使用可执行程序而不是调试器,意味着可以更快地完成此操作,但是它仍然需要花费几个小时,因此您应该将它放开然后走开,与孩子一起玩耍,或者阅读带有’空格"写在封面上,因为这将需要一段时间.如果可以将它们全部打包到CD-ROM上并邮寄给您,则不是这种情况,但是生成的文件太大,以至于取决于您的Internet连接,下载它们可能需要更长的时间.(. During runtime these planets and moons rotate about their axes and though the default suggested setting for the number of images per quarter rotation is 16 (the project will prompt you with this value as the suggested setting) to get better results change this to 90. The difference during run-time is huge and the cost is only in the time it takes to set-up the game the first time you load it. Using the executable, as opposed to the debugger, means this is done much faster but it does nevertheless take a couple of hours so you should probably get it going and walk away, go play with your kids or read a glossy magazine with the word ‘space’ written on the cover because it’s going to be a while. This wouldn’t be the case if I could package it all onto a CD-ROM and mail that to you but the size of the generated files are so big that, depending on your internet connection, it could take you longer to download them.)
在上方,您可以看到构建时间很长的文件的图像.这里最重要的文件是" .soi"文件,其中包含所有"太阳能对象图像".这些图像是所有太阳对象的各种旋转,但并非所有太阳对象都有自己的图像.我从互联网上下载了这些图像,当我找到它们时,其中一些是极地风景,而其他则不是.这个太阳系模拟器是二维的,不会模拟行星的轴向倾斜,例如天王星以偏离其轨道平面法线97度的角度旋转.因此,如果不是这样,那么一个行星自转的图像与下一个行星自转的图像之间的差异会更加明显,相反,它们都以恒定的角速度围绕圆形轨道自转,并绕其自身的轴旋转,其倾斜度等于零,这个时间应该足够好了,也许是在我决定重写这个项目的十到二十年后,我会考虑使其成为3D第一人称射击游戏^但这是一条路.(above you can see an image of the files which took so long to build. The most important file here is the “.soi” file which contains all the “solar-object images”. These images are the various rotations of all the solar-objects but not all solar-objects have their own images. I downloaded these images off the internet and some of them are polar-views when I could find them and others aren’t. This solar-system simulator is two-dimensional and does not simulate the planetary axial tilt, such as Uranus which rotates at a tilt 97 degrees off from its orbital plane’s normal. So the difference in the images of one planet’s rotation compared to the next would be much more pronounced if this were not so, instead they all rotate about in circular orbits, at constant angular velocity and rotate about their own axes with a tilt exactly equal to zero which should be good enough for this time around, maybe in ten or twenty years when I decide to rewrite this project I’ll consider making it a 3d-first- person shooter… but that’s a ways away.) SOI文件使用将文件流重定向到您要查找的图像的位置的索引.因为这些索引的大小都相同,并且每个太阳对象都有相同数量的要缓存的图像,所以将索引初始化为-1的值,然后在将图像附加到文件末尾时进行更新.我们每转会缓存两张图像,一幅是原始颜色,另一幅是灰度图像.尽管下面的图像没有显示这两个图像,但是灰度图像紧随原始彩色图像之后并具有自己的索引,因此构成索引的长整数变量的数量等于(The SOI file uses indices that redirect the filestream to the location of the image you’re looking for. Because these indices are all the same size and because each solar-object has the same number of images to cache, the indices are initialized to the value of -1 and then updated as images are appended to the end of the file. We cache two images per rotation, one of original color and a second which is set to gray-scale. Though the image below doesn’t show the two the gray-scale image immediately follows the original colored one and has its own index therefore the number of long integer variables that make up the index is equal to) 总指数=(太阳物体的数量)x(每四分之一圈的图像数量)x 2(total indices = (number of solar object) x (number of images per quarter rotation) x 2) 这些都生成并设置为-1之后,我们开始存储图像.这是您对文件数据分布方式的描述.(After these have all been generated and set to -1 we start to store the images. Here’s a depiction of you how the file’s data is distributed.)
控件(The Controls)
在上图中,您可以看到显示在屏幕右上方的主控制台.此"名称"和" starfield"的左上方有两个按钮.这些控制星际地图的外观,并允许您切换是否可以看到星空背景,以及是否在屏幕上显示名称.您可以在以下图像中看到四种设置组合之间的差异.(In the image above you can see the main console which appears at the top- right of the screen. There are two buttons at the top left of this “names” & “starfield”. These control the look of the interplanetary map and allow you to toggle whether or not the star-field backdrop is visible or not and whether the names are displayed on the screen. You can see in the following images the difference between the four setting combinations.)
没有三颗行星,太阳和您的航天飞机"圣约翰"的名称的星空(no starfield with names of three planets, the sun and your shuttle the “St.John”)
没有星空场没有名字,和上面没有名字的同一张图片(no starfield no names, same image as above without the names)
具有名称的星空(starfield with names)
没有名字的星空(金星和水星这两个行星为您圈出)(Starfield without names (the two planets Venus and Mercury are circled for you)) 控制台最右上角的"焦点"按钮可让您控制控制台将通知您的行星,船舶或基地.当您试图降落在遥远的星球或月球上时,这一点很重要.假设您要飞往火星,就不能只是朝这个方向前进,然后期望当您击中它时会飞起来的颜色(如果您确实靠近它的话!),并在整个红色滑坑上飞溅,装满灰尘的碗.您需要做的是监视相对于目标目的地的速度.火星不仅停滞不前,而且还不足以接近它,您必须以相对于它自己的速度接近它.通过使用"聚焦"按钮,您可以看到从太阳向下分支的整个太阳系的树状视图.每个太阳物体都可能具有卫星,基地和船只.因此,您从太阳开始,向下扫描其卫星,找到火星并选择它,然后再次按下``聚焦'‘按钮并将树视图隐藏在原处,以便将精力集中在飞行航天飞机上.只需关注行星的速度,并记住在到达那里之前就开始减速.(The “focus” button on the top-most right of the console will allow you to control which planet, ship or base your console will inform you about. This is important when you’re trying to land on a distant planet or moon. Let’s say you’re flying to Mars, you can’t just head that way and then expect to get flying-colors when you hit it (if you actually get close to it!) and splash all over its the red-skied crater-filled dust bowls. What you need to do is monitor your speed relative to your target destination. Mars isn’t just sitting still and its not enough to just get close to it, you have to approach it at a velocity relative to its own. By using the “focus” button you bring up a tree-view of the entire solar-system branching down from the sun. Every solar -object can potentially have satellites, bases and ships. So you start with the sun, scan down its satellites, find Mars and select it before pressing the “focus” button again and hiding the tree-view back where it was so you can center your energies on flying the shuttle. Just keep an eye on the planet’s velocity and remember to start slowing down long before you get there.)
但是,让我们回到更重要的控件上:如何驾驶飞船.有很多事情要做,所以我会尽量简洁明了.航天飞机有三个主要的导航控件,需要使用键盘:(But let’s get back to the more important controls : how to fly your ship. There are a lot of things to do so I’ll try to be clear and concise. Your shuttle has three main navigation controls that require the use of the keyboard :)
- 引擎强度(*engine strength*)
- 立式减震器(*vertical dampers*)
- 卧式风门(*horizontal dampers*)
发动机的力量使您可以控制推进器的动力.第一次从Terran One起飞时,您可能会希望将其设置为5,但是当您接近引力拉力较小或可能飞得比预期更远的较小行星时,您必须决定要多少引擎力.失去控制.减震器可以帮助您降低速度,但仅在大气层(风景区)内有效,并且在洞穴中飞行时必不可少.简而言之,它们是在水平和垂直轴上工作的制动器,可以通过按下键盘上的" V"和" H"键来激活.您可以通过先按Shift键然后释放阻尼器的控制键来锁定它们.仅使用鼠标左键发射引擎,并以与上一篇文章的项目相同的方式将飞船向前进方向推进.要更改这些力量的强度,您可以使用数字键(请记住,这三个导航控件的船舶当前最大值均为5),并将其与适当的键组合:发动机的V,H或E .(The engine strength lets you control the power your thrusters are exerting. When taking off from Terran One for the first time you’ll probably want this set to five but then you’ll have to decide how much engine force you want when approaching lesser planets that have weaker gravitational pulls or risk flying farther than you anticipated and losing control. Your dampers help you reduce your speed but are only effective inside the atmosphere (landscape area) and are essential when flying around in a cave. Simply put, they are brakes which work in the horizontal and vertical axes and are activated by pressing the “V” and “H” keys on your keyboard. You can lock them by pressing the shift key first and then releasing the damper’s control key. The engines are only fired using the left mouse button and force the ship forward in whatever direction it is heading in the same way it did in the previous article’s project. To change the strength of these forces you can either use the numeric keys (keeping in mind that your ship’s current maximum values for all three of these navigation controls is 5) and combine it with the appropriate keys : V, H or E for the engines.) 使用鼠标滚轮和V,H或E键可以更改这些值.无论您是否按下Shift键,风门都会以0.1的步长变化,但如果不使用Shift键,则发动机将以整个值跳跃,而如果使用Shift键,则发动机将以0.1的步长跳跃.(It is possible to change these values using the mouse-wheel incombination with the the V, H or E keys. The dampers are changed by steps of 0.1 whether you’re pressing down on the shift-key or not but the Engines jump by whole values without the shift key and by 0.1 with.) 在上面的主控制台图像中,您可以看到这些值反映在Ship-data组框内,该组框是构成控制台的三个组框的顶部.在同一船舶数据框中,您可以看到"详细信息"按钮,该按钮将调用一个单独的表格,其中包含有关航天飞机St.John的更多信息.(In the main-console image above you can see these values reflected inside the Ship-data groupbox which is the top of the three groupboxes that make up the console. In that same ship-data box you can see the “details” button which will call up a separate form containing more information about your shuttle, the St.John.)
在上图中,您可以看到船的一些详细信息.它目前分为四个不同的选项卡,但目前只有两个选项卡:“导航"和"乘员组”.导航选项卡显示在上方,您可以在此处确定谁将驾驶您的船.选择一名优秀的飞行员很重要,因为这将使您的航天飞机在飞行时反应更快.船员选项卡如下所示:(In the image above you can see some of the ship’s details. Its currently broken down into four different tabs but for the moment only two of them are populated : Navigation and Crew. The navigation tab is shown above and this is where you can decide who will pilot your ship. Its important to pick a good pilot because that will make your shuttle more responsive when you fly. The Crew tab shown below :)
显示航天飞机的机组人员,尽管您可以根据其指定的熟练程度(飞行员,工程,化学和地质)对其进行重新排序,但除了我上面提到的飞行员操作外,这些熟练程度目前在游戏中都没有意义.在同一张图像中,您可以看到游戏开始时将您的船停靠在其中的基本Terran One.(displays the crew of your shuttle and though you can reorder them according to their given proficiencies (Piloting, Engineering, Chemistry & Geology) none of these proficiencies are currently meaningful in the game except for the piloting which I mentioned above. In this same image you can see the base Terran One where your ship is docked when the game starts.) 作为有关控件的最后说明,我应该在上面的星际空间地图上解释飞船的外观.见下图:(As a final note about the controls I should explain the appearance of the ship on the interplanetary space maps above. See the image below:)
您可以看到船的速度以及金星在上方右上方以红色突出显示的速度,但是您最需要注意的是该图像的蓝色圆圈和红色和蓝色的线条在图像的左侧表示为"船".蓝色圆圈随着您的船速(相对于太阳)而增长和收缩,蓝色线指示该速度的方向,并且与右侧船舶数据的圆圈控制中的红色箭头相同.红线表示船舶前进的方向,其长度描述了船舶的发动机设置,红色表示您的推进器已启动且处于活动状态,如果它们处于空闲状态,则该线为绿色.像在景观地图上一样,您可以放大到足够近的距离才能实际看到您的飞船,但是这样做会使您难以飞行,因为尽管后面的星空保持不变,但您将不再看到周围的行星.通过将与右侧金星行星相关的数据与该船的数据进行比较,您可以看出该船正在以相当快的速度从金星移开.短暂游览该星球的令人愉快的气氛后,很可能要回家.(you can see the velocities of your ship and the planet Venus highlighted in red on the right above but what you should note most about this image is the blue circle and red and blue lines indicated as the “ship” in the left of the image. The blue circle grows and shrinks with your ship’s velocity (relative to the sun), the blue line indicates the direction of that velocity and is in the same direction as the red-arrow in the ship-data’s circle-control on the right. The red line is in the direction the ship is heading, its length describes the ship’s engine setting and the red color tells you that your thrusters are fired and active, were they idle that line would be green. Like on the landscape map you can zoom in close enough to actually see your ship but doing this would make it difficult for you to fly because you would no longer see the planets around you though the star-field in the back remains the same. From the data relevant to the planet Venus on the right compared to the ship’s data you can tell that the ship is moving away from venus at considerable speed. Likely heading home after a brief excursion into that planet’s heady atmosphere.)
起落架(Landing Gear)
当您在空中时,起落架应缩回,因为它会引起阻力(看着起落架起落,起落非常酷!).要切换起落架的位置,请使用键盘上的键" G".(Your landing gear should be retracted while you’re in the air because it causes drag (and watching the gear go up and away or down and out is really cool!). To toggle the position of your landing gear use the key “G” on your keyboard.)
暗影(Shadows)
太阳是太阳系的中心,这意味着如果我们将其称为星巴克空间,那将是一件奇怪的事,但更重要的是,太阳将其光线照射到其系统的每个部分.不…实际上,不是.你知道这个.你不应该让自己那样被误导.先前的陈述显然是错误的,您不能让自己的思想徘徊或疲倦.但是太阳的确向各个方向向外辐射光,如果幸运的话,您可以感受到行星的阳光,那么您会感到热,但平克`弗洛伊德(Pink Floyd)的<月之暗面>比好的轨道更重要踢回来.(The sun is the center of the solar-system which means it would be strange if we were to call it Starbuck Space, but more importantly, the sun sheds its light on every part of its system. no… actually, it doesn’t. you know this. you shouldn’t allow yourself to be misled like that. That previous statement was clearly false and you can’t let your mind wander or tire too much. But the sun does radiate light outwards in all directions and if you’re lucky enough to be on the sunny side of a planet then you’d feel the heat but there’s more to Pink Floyd’s “Dark Side of the Moon” than a good track to kick back with.) 漫无目的,ba不休,闲置,恒星…(ramble, babble, idle, sidereal…) 我在哪(where was I?) 对,好的太阳向各个方向发光.但这意味着它还会使阴影出现在距离该光源最远的行星背面.为了模拟行星,白天和黑夜以及所有其他方面的阴影外观,我们必须跟踪太阳相对于我们正在观察的行星的位置.然后,在将其放到屏幕上之前,确定我们是否要投射阴影(风景视图上没有阴影,下面更多内容),并且当我们知道要在输出图像上放置阴影时,我们获取两个图像从SOI文件.我们同时获取阴影图像和原始彩色图像,并将这些图像与第三个图像一起使用,可用于所有这些可疑事件:阴影!阴影是阴影的旋转图像,用于在将灰度图像粘贴到彩色图像之前掩盖灰度图像.必须先旋转所有这三个位图,然后才能将它们全部剪切并粘贴到一起,这确实需要一些时间,但是由于我们将它们全部缓存到HD上,因此非常容易找到并快速检索它们相对轻松地结束.(right, ok. the sun sheds light in every direction. but that means it also causes shadows to appear on the back of planets farthest from this light source. To simulate the appearance of a shadow on a planet, night and day, and all that, we have to keep track of the sun’s position relative to the planet we’re looking at. Then, before putting it onto the screen, decide whether we want to cast a shadow or not (no shadows on the landscape view, more on that below) and when we know we want to put a shadow on the output image we retrieve two images from the SOI file. We retrieve both the shaded image and the originally colored one and use these images along with a third which is handy for all these shady affairs : The Shadow! The shadow is a rotated image of a shadow which is used to mask the gray-scale image before pasting it onto the colored image. All three of these bitmaps have to be rotated before we can cut-em’up and paste it all together which does take some time but since we cache all of them onto the HD its pretty easy to find and retrieve them quick enough for it all to be over relatively painlessly.) 看看下面的阴影:(Have a look at the shadow below :)
看起来不多,但确实如此.右侧的圆角的角度为0,尽管阴影的图像与所有太阳物体图像的大小相同,但它首先通过使黑色中心透明并将其粘贴到旋转的灰色上,从而只覆盖了一半的太阳物体.尺寸的图像,然后使生成的"切碎的"灰度图像在外面透明,并粘贴到彩色图像上,这样放置比完整图像小的切碎的灰度图像,使其与彩色图像完全匹配,除了对于所有的灰色.(Doesn’t look like much but there it is. The rounded edge on the right faces angle 0 and though the shadow’s image is the same size as all the solar-object images it covers just a bit more than half the solar objects by first making the black center transparent and pasting it onto the rotated gray-scale image, then the resultant ‘chopped’ gray-scale image is made transparent around the outside and pasted onto the colored image so that this chopped-gray-scale less than complete image is positioned such that it and the colored image match perfectly except for the grayness of it all.) 您可以在下面的图像中查看结果.首先看一下屏幕上太阳在月球上方时的月神:(You can see the results in the images below. First a look at Earth’s moon Luna when the sun is above it on the screen :)
这是金星的景色:(and here’s a view of Venus :)
在这里很难看到,但金星和太阳都充满生气.金星的气氛特别活跃,为了模拟这一点,我使用一个程序组合在一起,以去除金星彩色图像中最暗的部分,直到只剩下静脉状的条纹为止.然后,将它们切成小段,并用它们来创建您下载的Atmosphere_Venus_nn.sp3文件.它们位于随机分布的位置,并从零的绘制大小增长到最大值(1.0倍于游戏缩放),并且在影响整个配置后消失时又重新回到零.由于每个行星都先查看硬盘驱动器,以查看是否存在任何文件,然后再决定是否需要为大气设置动画(它仅在第一次将硬盘驱动器放到屏幕上时才搜索硬盘驱动器,然后记住要这样做)只需创建大气精灵(使用升级的Sprite-Editor)并使用程序的正确文件名保存它们,以查找它们并为大气设置动画(我会为地球做一些事情)以及后来的燃气巨头,但这不是优先事项).太阳的耀斑非常凉爽,但是由于它们突出到原始大小的图像之外,因此输出的图像不正确,这就是为什么我必须做进一步测试以围绕系统的中心星飞行以衡量太阳的引力的原因.不符合<星际迷航>对时间旅行的期望.我将不得不向伦纳德`尼莫伊(Leonard Nimoy)寻求帮助!(its difficult to see here but both Venus and the sun have animated atmospheres. Venus’s atmosphere is particularly active and to simulate this I used a program I put together to remove the darkest parts of the colored image of venus until only the vein-like streaks were left. Then I cut these up into small segments and used them to create the Atmosphere_Venus_nn.sp3 files you downloaded. These are positioned at randomly distributed locations and grow from a draw-size of zero to max of (1.0 x the game’s zoom) and back to zero again when they disappear after having affected their entire configuration. Since each planet first looks on the hard drive to see if any files exist for it before deciding whether or not it needs to animate an atmosphere(it searches the hard- drive only the first time it is put to the screen and then remembers what to do) its simply a matter of creating atmosphere-sprites (using my upgraded Sprite-Editor) and saving them with the correct file-name for the program to find them and animate the atmosphere(I’ll get around to making some for the earth and the gas-giants later but its not a priority). The sun’s solar-flares are pretty cool but since they protrude outside the original sized image the output image is not correct which is the reason why I’ll have to do some further tests flying around the system’s central star to weigh the sun’s gravitational pull which doesn’t live up to Star-Trek’s expectations of time travel. I’ll have to ask Leonard Nimoy for some help with this!)
景观与日光(Landscape and the light of day)
因为我们现在是太阳系的一部分,所以重要的是要知道它在一天中的什么时间在表面上.因此,随着时间的流逝,我们可以看到太阳升起/落山,天空变亮,并逐渐变暗.在将太阳置于天空之前,必须考虑太阳相对于行星的角度以及您在表面上的位置.一旦知道了我们在景观上的X轴位置,就可以确定当前位置和太阳之间的距离,从而确定太阳应该出现在距屏幕中心多远的位置.确定后,我们将该值插入到描述椭圆的方程中,该椭圆的高度/宽度值设置得比卫星的宽/高,并且我们可以计算出从屏幕顶部向下观察需要绘制的身体的距离乐趣.这里没有阴影或动画气氛,因为无论如何它们可能都太远了,而且我认为大多数计算机都无法处理额外的工作,因为这是以后很多战斗要发生的地方.(Because we’re now a part of the solar system its important to know what time of day it is where you are on the surface. For this reason then we can see the sun rise/set and the sky light up and fade to darkness with the passage of time. The sun’s angle relative to the planet and your location on the surface are taken into consideration before the sun is positioned on the sky. Once we know where we are the sun’s X location on the landscape is determined and we measure the distance between our current location and the sun to determine how far away from the center of the screen the sun should appear. Once this is determined we plug that value into an equation describing an ellipse with height/width value settings wider and taller than those for moons, and we figure out how far down from the top of the screen the body needs to be drawn for your viewing pleasure. No shadows or animated atmosphere here since they would probably be too far to see anyway, and I don’t think most computers could handle the extra work given that this is where a lot of the fighting is going to happen later.)
进入/离开风景(Entering/Exiting Landscape)
这个项目中比较棘手的部分之一是弄清楚您的船在进入和退出景观阶段时应该向哪个方向移动.这样做的原因是,当您在风景中时,向上是东方,在右边是东方,在左边是西,但是当您到达星际视图时,情况会有所不同.如果看地球的极地景色(One of the trickier parts of this project was figuring out what direction your ship should be moving/heading when entering and exiting the landscape stage. The reason for this is because when you’re on the landscape up is up and east is on the right with west to the left, but then when you get to the interplanetary view things are a little different. If you look at a polar view of the Earth)
您可能会想像那里也在那里,但事实并非如此.实际上,当您退出大气层并进入行星际空间时,从该角度来看相对于行星的方向就是水平镜,有点像原始的.计算船舶角度及其运动方向的计算必须围绕您的船舶与行星中心所成角度的法线水平地反射(水平镜).这是因为从该角度看,向上的方向辐射远离行星,而东方则向左辐射,而西方则向右辐射.一旦您绕开了那条跳闸,您就没事了.但是花了我一段时间,所以如果您不首先想到它,就不会感到难过.(You might image that up is up there too but it isn’t. Actually, when you exit the atmosphere and enter into the interplanetary space your direction relative to the planet from this perspective is a horizontal mirror, sort-of-speak of the original. The calculations to figure out the angle of the ship and its direction of motion have to be reflected horizontally(horizontal mirror) about the normal of the angle your ship makes with the center of the planet. This is because the upwards direction radiates away from the planet and east, from that point of view, is to the left and west is to the right. Once you get your head around that little bit of trip-wire you’ll be fine. but it took me a while so don’t feel so bad if you didn’t think of it first.)
报告书(Reports)
不过请记住,如果您没有正确地装入严重坚固的物体,金星将是一个艰难的地方.在下图中,您可以看到航天飞机St.John进入金星大气层的距离太远.(Remember though, Venus is a rough place to go if you’re not properly encased in something seriously sturdy. In the image below you can see the results of the Shuttle St.John venturing too far into Venus’s atmosphere.)
报告系统只是报告队列,由(The report system is simply a queue of reports made up of the) classGraphicText
的(’s) Panel_GraphicText
您可能在我以前的一篇文章中看到过(you may have seen in one of my previous articles like) GCide:完整的英语词典(GCide: A Complete English Dictionary) 我在这里进一步解释.该报告表单当前具有三个相关按钮,其中两个出现在表单本身上,而第三个按钮在需要时显示在主控制台上的装运数据上方.单击"下一步"将显示队列中下一个待处理的报告,仅当还有另一个报告要显示时,此按钮才会出现. ok按钮隐藏报告,但Q保持不变.第三个按钮在发货数据上方的控制台中,当您需要关注新报告时显示.这样,您在战斗中就不会遇到报告表阻塞视图的问题.(where I explain it further. The report form currently has three relevant buttons, two of which appear on the form itself and a third one appears when required above the ship-data on the main console. Clicking next will display the next report pending in the queue, this button will only appear if there is another report left to show. And the ok button hides the report but leaves the Q intact. The third button is in the console above the ship-data and appears when a new report needs your attention. This way you’re not faced with the report-form blocking your view while you’re in a fight.)
新游戏消息框是使用(the new game messagebox is made using) 位图区域(bitmap region) 我不会在这里(which I won’t go into here)
下一步是什么(What’s next)
我现在要做的第一件事是实现游戏的保存/加载.然后,在下一篇文章之前,我将让宇航员在轮船,风景,洞穴和建筑物的进/出处走来走去,在这些建筑物中,他们将执行与熟练程度相关的职责,例如驾驶轮船,挖一些泥土或处理自己的东西他们挖了.为此,他们将需要一个资源/动作引擎,当我在新年的某个时候写它时,我将使用它.(The first thing I have to do now is implement the game save/load. Then, before the next article, I’ll have the astronauts walking around the ships, landscape, caves, and in/out of buildings where they will perform duties relevant to their proficiencies like pilot the ship, dig up some dirt or process their stuff they dig up. For this they’ll need a resources/action engine which I’ll get into when I write about it sometime in the new year.) 在那之前,Ski-doo安全,嗯,您将准备好进行越野行走!(until then, Ski-doo safe, eh, and you’ll be ready for your space-buggy!) 火星任务(3)(Mars Mission (3))
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
C# Windows 新闻 翻译