Developing with Unity (Pt. 4)

Isn’t it great how a camera finds you and follows you around?

Just like that guy who followed you home from school every night. Except less creepy, more essential, and less likely to result in a restraining order or other legal action! It’s one of the unsung parts of game development. When you think about everything you see when you first load any game (the GUI, the character model, the environment, the monsters etc.) you never think about the one thing that makes it all work- the camera. Without the camera the GUI has no canvas with which to display precious information. Without the camera there is no way you’d be able to see your character and the environment around them.

While systems, statistics, formulae, and other goodies make everything do what it is supposed to- cameras show you that it’s working. Or not working. Yet, funnily enough, you never really think about that and how to attribute cameras to an object in order to persistently follow its adventures.

The other thing about cameras is that the angle, rotation, and type are very important in what kind of game you make. Something like Diablo II could be made with a first person camera but a lot of the core design, the graphics, and interactions would need to be changed. Likewise, while The Elder Scrolls V: Skyrim could be made in isometric top down style, it would sacrifice a lot of the detailing already present in the world.

So, in short- cameras are the best.

But within this there are many questions revolving around the control system. For instance, most first person games don’t have a point and click control system as it wouldn’t work overly well, while they are also reliant on key binds, and more attention is paid to exploring up close and personal. In isometric games, while key binds are present, they aren’t as required for most functions as you can click the elements on screen, and often you click to move. This means some games inherently work better with W, A, S, and D while others are better point and click.

All of these little details swirl around my brain as I think of how to build my camera and how to follow my character through the world.

I have opted for the point and click method as that is what I would prefer my game to be. Something where you can click the terrain, explore the world, click chests, and generally it fits the art direction I am going for. However, I am encountering a few bugs switching from an over the shoulder to point and click camera rotation.

Mostly in the case of higher terrain elevations that the point and click method cannot compute methods to reach. While there are likely some ways you could make it compute those methods- I’m actually not too bothered as I’m not set on what I want my starting zone to look like. I know I want a beach. Maybe. Which is why I can easily restructure it as a lot of what I use is stored in prefabs anyway. So I can simply bring those models back into the game world fully customised.

Time has also been spent updating the various systems in the game and polishing things such as combat so that, in a crude sense, but one with a few bells and whistles, I have a basic outline for magical and special attacks. I also have an outline for attack speed. While my older scripts already calculate a number of combat formulae.

So, basically- lots of good stuff!

Have a nice weekend, all!

Moggie

Advertisements

Developing with Unity (Pt. 3)

Today we’re not talking systems, development, and code- we’re talking GUI instead!

One of things I wanted to implement fairly early was some form of UI for the player to interact with. While this helps the player (as is the purpose of a UI existing) it also helps with the development process as I can check whether statistics, UI element interactions, and other awesome stuff is actually working or not. Again, while it could be added later, it’s probably better to add it now and make sure all of it works rather than try and implement something that may or may not work later.

It also accelerates the time scale in which I can actually have a playable game.

Imagine if you didn’t have a UI and you went into combat and your only indicator of your survival was if you got a game over screen or not? That would be terrible! I will not have terrible things within my development! Well, besides the things that I think are good but are actually awful. Of which there will no doubt be a few over the coming months.

As mentioned in my previous Developing with Unity post I am using the Unity GUI tools. I am considering using the OnGUI functions instead, as even though you can’t place these so accurately, they are slightly easier to use. Or, rather, they don’t require as much to actually get them working. As, at the moment, my GUI is stored in a prefab which I add to each new scene as and when I need to. However, that only works to a degree as you need to link any game objects within the scene back up to the GUI. Whereas a script with the OnGUI functions would just draw them and display them regardless of where the character went, fully inclusive of all connected game objects, and a pretty much easier to handle experience overall.

Both systems have drawbacks and benefits.

In my case it would also mean I can scrap three prefabs, probably five-ten scripts, and a bunch of other stuff which would make the development process smoother and less resource intensive. All of this taken into account, I am not going to do anything just yet, as I am currently rewriting and polishing all of the old game systems. Much to do!

Speaking of rewriting and polishing the old game systems I now have some new features. Such as a save system that continually and automatically updates your saved character file to make sure you’ve always got the current health, currency, and all of that other good stuff stored. I am also working on tying this into a checkpoint type system for each area so that on death you will return to the last checkpoint. At the moment it just returns you to the character spawn position which is good enough as I only have one scene.

However, I will go forward and fix that to get it working as intended in the next update of the systems and engine.

I’ve also implemented a fairly crude but working combat system where an enemy can look for, find, and attack you when you get within a specific radius of them. It’s fairly basic at the moment and I need to find a better way to differentiate enemies- but it’s working. Which means you can fight and/or die. Basic combat calculation systems included. Tying into this quite nicely is a new character creation system with all new statistics and the like. So there’s a lot going on right now.

Have a nice week, all!

Moggie

Developing with Unity (Pt. 2)

Today we’re talking systems, development, and code. Pretty much all we ever talk!

After I got to grips with the various things that Unity could do, got a bit better at C# scripting, and began to understand the logic behind the creation process I started working on the core systems. Admittedly this is quite a difficult task when you’re just working from an idea and you don’t actually have anything tangible. But I’m going with this creation process for the first project as I know that when I come back to the scripts, systems, components, or whatever else that needs to be improved it will be easier to do so.

That and I don’t really want to plan out such a large project with all these bells and whistles that I would likely be able to code but wouldn’t know how to.

I never could take naming my characters seriously.

I never could take naming my characters seriously.

I’m also trying to keep it fairly simple for the time being so that I have something to show for it in a reasonably short space of time. Say a month or so. Not that I would have a fully completed and tested game in a month- but I’d have something playable at the very least. Otherwise I would have this half finished “it will be finished one day” project staring at me.

I can’t really say where I’m going with this or how I want it to play out in the end. I do know that I want basic things like magical attacks, equipment, an inventory, some form of currency (or maybe multiple currencies), and a few other RPG staples. I’ve already started working out a few basic elemental types of damage so you can be more resistant to one than the other or some will hurt more than others. It’s very difficult to fully explain without seeing it but it is there.

The style of the game is something a little Diablo-ish but a little Kingdoms of Amalur: Reckoning-ish, too.

With that I mean that you’ll generally be facing enemies like you do in Diablo and having a number of them on you at a time- but defensive, evasive, and other similar strategies would be useful. Of course at this point in time I’ve not even implemented basic combat so who knows where it will go? Or how it will change?

However, the reason I am looking at this all now even before I have a basic combat system in place is to make sure I lay some good foundations. Even if it’s a few basic things like defining the attack damage type when calculating combat algorithms- it helps. These are things that, when I return to them, or develop them, they will at least exist so there is something for me to work off of. Rather than having to find a way to implement all of that later which may or may not work and cause me any number of headaches, bursts of profanity, and such. As that would just be really unpleasant for all within earshot of my cloud of profanity.

Namely the two cats. One of which is far too young to hear words like that.

I’ve also started developing the basic UI for the game which I am currently using the “new” Unity GUI tools for. Some of which is a little more difficult than I would have given it credit for, but, well, what about this project so far has been really easy? None of it! Which is why it has been so fun!

Have a nice weekend, all!

Moggie

Developing with Unity (Pt. 1)

I have a beach, a skeleton, and three tents. Well worth the week of coding. Really.

I don’t really know why, nor do I question it, but I am fascinated about game design and development. Which is why when I knew I could mod Legend of Grimrock I immediately dived into that engine to create something. I’ve always wanted to create something that I can share and that people can enjoy.

It’s partly the reason I enjoy doing creative things so much.

So, early in January, I decided to pick up Unity and give it a go. For those who are unaware what Unity is- it’s awesome. It’s a development studio that features a few different coding languages in which, well, if you can code it- you can make it. But best of all (if you’re still unsure whether you want to use it) it comes with a free version.

One great thing about Unity (considering it has a Free and Pro license) is that the free version comes with all of the tools you will need to actually begin developing your first project. Of course, it depends on what you’re aiming for, as higher quality functions are restricted to Pro, but it’s not like the free versions are all horribly grainy nasty textures and poor quality lighting. They’re really nice for free. Plus you can always import your own if you’re looking for something even higher quality. But the free version is pretty much usable from the first moment you open it up. Textures, terrain modelling, lighting, collision detection, character movement, camera control- it’s all there.

The other great thing about Unity is the Asset Store. There you can pick up any number of assets or example projects. Some are available for free (just be sure to check the license fits your needs) while you can also peruse the paid assets for high quality, ready to use, commercial use resources. That said, there are some really great assets available for free (with the only requirement that you credit them) so it’s not a case you have to spend a lot of money to get nice resources.

The addition of the Asset Store is a massive bonus as these assets can be instantly imported into your project (after downloading of course) to add working resources to your project with ease.

You can also find a number of free assets (which I do believe are developed by the Unity team themselves) for free on the Asset store. They’re varied and limited but there are some really nice additions like carts, tents, and other fantasy type models. Not to mention a lot of foliage and modern day assets too. It’s a wonderful thing.

Thus, over the course of two weeks, give or take, I disappeared from most places as I went to learn C# by which I mean I broke a lot of functions and poked them until they worked again. I haven’t got a great deal to show for it but I have something. Plus, I am currently going back over my old code and scripts and removing all of the unnecessary bits and pieces. So hopefully I will actually have an encounter system and you’ll actually be able to fight enemies and use magic and such.

It’s an interesting journey if nothing else.

Maybe one day I’ll have something I can share with you all that is actually playable. Which, if nothing else, would be further than I’ve ever got in any kind of game development prior to this.

Have a nice week, all!

Moggie