MyI@FarNiche

Building an XNA Game Studio XBox360 Indie Game.

[page 0053] ~ The Unity Game Engine:

Updates – Windows shutdown update.

The theme this month is still LOOPS.

I started reading “Unity 4.x Game Development by Example Beginner’s Guide” from Safari Books Online as another way of getting some idea of what to expect while jumping into this new type of game creation environment.  So far, but back in the day, game programming was all line numbers with code pages and auto-Make files, then it turned into classes, sprite sheets, .obj, .fbx and .x files, height-maps with some fairly fancy precompiler things that wouldn’t bark at all even if there were errors, but which, when done running through that pipeline found their way into the main compilers prolific debuggers that would bark at everything if it would work at all, if it got to that point.  Now I’m looking at this Unity Game Engine trying to figure out how it will become of any use.  Although, I really think it may become of some great use because, of the features I have seen so far.  They have made sense and are things that I was looking into building or was more like looking into figuring out how to start building to use for what I was looking to do, which is build video games, and not reinventing another wheel that helps build video games.  I guess this is going to turn into more of that “Its got to work or all of this wouldn’t seem like it should”, kind of deal.  And that is what I have run into already.  In the Unity web documentation and tutorials the C# language protocol is emphasized while in this Safari Unity book the JavaScript language protocol is initially emphasized.  But, as I read along, I find a C# appendix at the end of each chapter that gives a translation so as to not just “dust” the reader and leave them to hunt and peck their way through the differently coded language contents of the books games, good for them, good for me.

Well then, after uploading my .unity3D file and its accompanying .html file, that provides access to my game, and then going to where I thought I would see my first try at something like a game in my browser , I found instead from the built in the given Unity Web Player page, “Failed to download data file”, how special.  So, like most things in life, it was not the end of the world but more Search and Research.  The first thing to do was to paste, “Failed to download data file” into the Unity – Search eyeglass on their website and voila it seems to be a common problem for those who don’t work with the IIS of their website directory that much.  It seems that each server provider has their own specific way of dealing with this problem, being that the file cannot be downloaded from the uploaders site because the file extension type is unknown and therefore inaccessible.  Simple enough, so here it is, Failed to download data file, and that’s the homework.  The other half is, is to read the documentation for the specific server platform from your provider and follow their directions to allow Multipurpose Internet Mail Extensions (MIME) access to the types of files that are to be recognized by putting them in a config-like file on the topmost directory of your websites folder structure.  Here are some other searches, one on Unity’s site Publishing the game, and one on Google, iis add mime type.  Of course it will take a little, “does this work, how about this, hmm, well, and so on and so forth …”, but in the end it does work from the given files of the build from the Unity API when placed in the owners directory to be accessed from the web, beautiful.  And as a bonus, I added a second file type, that for Processing, a .pde file type, then low and behold, that also works from their given .html file and the constructed .pde file on my web directory.  So I have figured out that mystery, thanks Unity, I no longer will need to have my entire running code base accessible from my web page, nice.  I think I might backlog my chess games and let them be accessed by the .pde files, oh well, all that happy logic and code was out there for a time.  Now back to Unity.

After reading another chapter or two of the “Unity 4.x Game Development …” book I went back to the Unity 4 website and started to review the Space-Shooter video tutorials.  With a flash of inspiration I thought, “Hey, I’ve already built HUD-On”, so maybe I could see if any of that previous work would fit into the Unity pipeline.  And per usual, it’s an ongoing battle to get things to work by trying to remember how they used to work, or at least how I would like to remember that they actually did work.  And now I have my big terrain in Unity.  Also from all that camera transforms and rendering stuff back from the XBox 360, I could find Unity’s “fog” in their Render Settings.  I gotta tell ya’ that those Unity sliders and input text boxes are a good thing, it beats building a bunch of code lines to capture the variables of object positions, converting all that to some lines of text and then figuring out where on the game screen it would fit so as to not be in the way and still be viewable in a discernable fashion.  I think I like this Unity Game Engine thing, and, I might be able to use it to build games for the XBox 360 for their Indie Games for XBox Live, maybe, but I might be jumpin’ the gun on that one.  So anyway, after getting my terrain in the Unity Game Engine and having the camera along with the fog with its near and far viewing frustum set up well enough I took it a step further and thought, “Sure, what the heck, that Space Shooter game has a free 3D space ship that isn’t doing a whole lot in their 2D game, so, maybe if I imported it into what I’m working on now …”.  Then, after clicking on the Download Assets in the Space Shooter introduction page and following their instructions I now have an all Pink/Fuchsia colored space ship, along with all the other assets from their space shooter game, thank you, again.  But fuchsia isn’t quite the color that I was thinking, for my space ship, at least, and there are some other textures that were downloaded along with that ship, hmm, more research and development.  Wow, now that’s cool.  I now have two ships that look like the ones in their given tutorial that work with, and in, my new 3D Unity game.  This could be HUD-On’s big resurgence, ok, now back to the tutorial videos.

There are going to be some problems in taking this Space Shooter 2D game into a HUD-On 3D game.  The first is when adding a Rigidbody component and not being in Space Shooter space.  This 3D game takes place on the fringes of the atmosphere where there is gravity, and by selecting Use Gravity on the Player ship Rigidbody component, when the game is started, the ship plummets towards the terrain.  And so the gears start turning, “How long before the collision when the ship hits the ground?”, that would be some kind of altimeter gauge for the HUD.  Next, having added a collision detection component to the Player ship model they also request that the Prefab engines are to be added to the ship.  One problem though, this is a 3D game and the thruster light from the burning fuel is positioned to only shoot out of the back of the ships engines when facing one direction as in what is seen in the 2D game.  This could probably be fixed by some kind of script that aligns the engine thrust to the rotation of the ship, somehow, but also another question, where in the HUD is the fuel gauge and where does the ship get refueled for all that thrust. On to the next video.

Alright, this video has to do with the lighting and so it has to do with the API and the models that make up the game.  And, as things tend to make sense through repetition, or at least are realized to be in correlation because of their continuity being in close mental proximity I have found that this Unity game and GeoControl2 both have a similar system of saving parts of the API as a separate file and then that of the game project as another file.  I would guess being able to keep those settings separate helps keep the continuity between differing instances from different game build types while keeping the same feel from the same API settings would prove to be useful.  I’m good with that, makes sense to me.  I’ll just have to remind myself of that when I start digging into ZBrush 4R6, that interface is somewhat, no, more like most intriguing, but that will be later on.

I’ve gotten to the Move Player video and they don’t use the “Y” axis in the video or give it in the “Done” C# script in the downloaded assets either.  It looks like I’ll need to hook all that up myself if I would like to see this ship fly around in my game.  Whoa that is simple, double click on the script to open it up in MonoDev and in less than three seconds, one copy, one paste and two change “x” to “y” for the Min Max values in the script declaration, save and enter Unity and there are the new values with labels and input boxes, way cool, gotta love it, this is goin’ to be good.  But that doesn’t change the fact that adding that PlayerController script makes my ship disappear, now why would that be?  That’s good enough for now, the Player ship moves, but the camera doesn’t chase after the ship or follow it around.

And now it does, but flying a space ship around using a keyboard does not bring any fluidity to the actions that help the player realize, from viewing the game, how to grapple with flying in 3D space.  Joysticks are the best way as they use values from [-1.0, 1.0] decimally to provide an accurate transition through an increasing and decreasing magnitude of input variables.  If I want to move left, just a little, I press left on the joystick just a little and ease back just a little while getting into the line of sight that I would like next.  A keyboard is kind of clunky when it comes down to things like that, but it could be done by using a timer to count off how long the key is pressed.  Using that mode of input would allow the player to always slowly add to the desired turn and while the button is held down longer the rate would increase more quickly.  But what if you would want to make a slow sweeping turn with a constant low rate of input.  On a button configuration, either another button set would need to be used via an alt or ctrl key mix or a new set of assignments to the keyboard map would need to be laid out and constructed.  I can see why there are so many 2D games out there and why so many faux 3D games, games that use 3D assets on a 2D surface (no Y axis) are so prevalent.  But I like my XBox 360 joystick controller and it works with both my PC via wireless receiver and XBox console through its built in wireless receiver.  One thing that this Unity Game Engine does provide is a robust set of C# script programing that can be easily incorporated into a game building methodology.

Or, to move the ship, I could just try something like building a Reticle and by using the mouse to move that reticle around the game screen the ship would then follow the reticle, it might work.  But first I need to figure out how to get this script for the ship to work because I used that same script for the camera to navigate in tandem with the ship as it flies.  The only, well more than only, thing that happens is that, because that script is used to also fire the weapon for the ship that too is incorporated when given to the navigation of the chase view camera within the same script.  So, of course there needed to be some tinkering around with that because the camera threw an error where those laser bolts had no launcher incorporated with that camera.  A camera doesn’t shoot laser bolts.  Now its time to have two separate scripts, but what might be more likely is to have supra script and sub script builds so the overlap of code that is needed and referenced because the ship needs Bounds checking and so does the camera.  But if both scripts try to build a Serializable class of the same name and type there is a conflict where one could possibly overwrite the other, thus the thrown error.  It can’t build the inspector panel because of the error, bark goes the compiler, par for the course.

Slightly familiar my mind says to my brain, in 15.Counting points and displaying the score of the Space Shooter tutorial video.  It was some time ago that I was trying to do the vary thing that they are talking about.  Theirs had to do with a method that was called to do an internal search for an object <type> to get the running in-game instance of a class that would access its runtime variable, change its value and update that what was seemingly disconnected to be seen as a change on the game screen, all quite magically.  But before this little jolt, at the time, way back when, it was a very mysterious and strange way of taking care of business, which may also have seemed to be too much work, as a one man operation, and that may be why I would always opt for the global variable route where everything is accessible from anywhere simply and easily.  Old methods die a slow death from the school of hard knocks.  BASIC, line numbers, 64k of memory and of course global variables, are my version of the good ol’ days.  But this video did spark a vague remembrance of intrigue which is better off left in a haze of twilight just so I can use what this tutorial chapter has made more clear for what needs to be done here within Unity.  Back then is just some dark and spooky stuff, like an old forgotten dungeon that I remember I had walked through from time to time and then when something new that is actually quite old passes by like a specter becomes the thing that is pointing the way out, strange brain, but its mine.  Two more videos to go.

And that’s it, two times through this Space Shooter tutorial with the second time through having an incorporation of one of my old XBox 360 games.  Now for some more reading and then to do this all over again with this month theme LOOPS in mind.  ‘Till then.

G’day.

Advertisements

February 23, 2014 - Posted by | 2014 [0050] to [00??], The Process | , ,

No comments yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s