Wednesday, February 20, 2013

Level building

In the list of things to learn, here's a pretty good one. Terrains and static meshes are one thing; but how do you build a level?

Introducing the BSP brush! This building brush comes with several preset shapes (primitives like planes, cube, spheres, but also straight stairs, curved stairs...); you just select the different sizes you want (by right-clicking on the shape - that sounds obvious, but I could only figure it out by reading the official doc), and then adding the surface (and since you can add, you can also substract - pretty interesting and offers good creative possibilities).

And that's not it! With this tool, you can also add special volumes: water volumes, physics blocking volumes, but also level streaming volumes, ladder, gravity... Overall a pretty easy to use and very powerful tool.

So far, the only problem I faced when using this tool was the fact that you have to drag the brush around to go where you want your volume/surface to be created. It sounds ok, but when you have a really big volume and you want to align the edges with some other surface, for instance, it gets pretty painful.

After several hours of slow progression, here's a screenshot of my first level with the BSP brush. There are regular surfaces, some with materials on them, a skybox (waaaa) and a water volume with a transparent plane on top featuring an animated water material (so pretty! also kinda inadapted to the scenery I was building but oh well ;)). And some stairs. I like stairs.
My dreamhouse

Monday, February 18, 2013

The editor: terrain, textures, meshes

Big undertaking, big problems, big discoveries.

I realized today (silly me) that in order to build a game with unreal engine, I didn't just need to know how to program it. I also need to know how to properly build it, as in, build the map(s) or level(s).

Grave underestimation.

The UDK editor comes with a huge set of features, each of which requires some learning to be able to use. My first challenge was to understand how to create a terrain and shape it. With the help of a couple of videos found on the official website, I managed to create my first terrain, and to even have different textures on it. Small step for mankind, giant leap for me.




Awesome! Now I can create kick-ass maps!
...and, er, what should I have in them? Next challenge please!

I have to admit, my experience in Unity didn't prepare me for dealing with Unreal. It's not that it's hard, it's just that the learning curve is steeper. But once you know what you need to know, everything's perfectly doable. And figuring out by myself (achievement unlocked!) how to add static meshes from a different package into the current map is a proof to show the world that it is kinda intuitive; once you learned one of the tools, the rest of them are used pretty similarly. I even figured out how to paint colors directly on the meshes. Yea, I painted the roof of the citadel into pink.


And now, what's left? Well... All the rest.

Monday, February 11, 2013

Where I'm at, visually

Just thought I'd share this. Here's what the book helped me do:
The code for generating the weapon upgrades (green cubes that the character picks up) is created through Kismet (you can see Kismet talking on the left). The enemies all have states, and change color when they change states (red for seeking, green for attacking, blue for fleeing). The big one at the end is the boss, in his first phase (10 < HP <= 30) he generates more minions, in his second phase (0 < HP <= 10) he just shoots rockets.

First thing on the to-do list: improve the aiming. Not knowing which way you're facing makes it really hard >_> Second thing, those smaller enemies that go really fast, well, they're really annoying... and sometimes too frequent (right now they have a 25% chance of being spawned). Tweaks to follow.

Sunday, February 10, 2013

Some progress on the book

After a week a furious reading, I finally reached chapter 7 of the book. On the way, I learned a good amount of things.

The first of these things is lots of syntax for  inheritance relationships:

Class CustomActor extends Actor;
self.EatAPancake();
super.ClimbMountEverest();
who refer respectively to declaring an inheritance relationship, getting the reference to the instance calling the code, or calling the superclass' implementation of a function. No big surprises there.

There is also lots of specific syntax for variables themselves:
  • local is used for declaring temporary variables while inside a function; note that you can only declare local variables at the beginning of the function, like in C.
  • config which I previously talked about;
  • const which is for constant variables, unsurprisingly and like many other languages out there

A LOT of specific syntax for functions:
  • event for events (mostly, just functions called from the native C++ code);
  • simulated, client, server, reliable, unreliable are all modifiers that are used for multiplayer functions;
  • const, NoExport, latent, iterator for people who can use native C++ code with the engine (i.e. people who pay for the license. Other people can use the ones already created, but not declare new ones). Out of these, latent means a function only usable while in a state, and iterator is for subroutines.
  • native is pretty straightforward, and obviously subject to the same limitations as before;
  • singular to prevent the function from being recursively called and thus prevent potential crashes from infinite recursion;
  • exec which is for functions that can be called from the console and for player input functions.
There might be more. I'm pretty sure I saw some final (non reeimplementable, I assume) and coerce (??? remember to check the doc for this one) laying around.

Also, there's a pretty cool implementation of states: by using the state keyword inside a function, one can define a set of functions usable only by this state. The state changing is as simple as calling GoToState('StateName'); and there are some useful BeginState and EndState functions. Of course, redefining a Tick function there is the obvious thing to do (it's the update function, same as Update in Unity). Having previously implemented a state machine in C# for the Barreleye project, I'm more than glad this is already there. Oh, and they can be "subclassed" :)

And finally, learning about Kismets has been pretty fun. Kismets are a sequence of events that can be created in the editor itself; it's visual programming for designers. With patience, one could probably write a game entirely in kismets; however, it would get complicated really fast, in addition to the kismets being run on a layer on top of UnrealScript which makes them slower. Also, kismets are valid only for the level they're created on.

Since Kismets only became clear after actually working with them, here's an image of a kismet I made with the book's help (note that it also includes a kismet created from UnrealScript code :)):

There. Only 3.5 chapters to go!

Saturday, February 2, 2013

The theme is out!

...well, one could argue it's more gameplay than theme. Either way, it's going to be pretty interesting:

"No gravity, no friction"

Annnnd...go! Interestingly enough, it's a theme I considered before, because of a Donald Duck comic.
Other news, I'm done with the second chapter of the book. It wasn't much, really, especially if you already know programming languages. The one thing I learned is mostly syntax, and special keywords:

var int numberOfShoes;

is for regular variables, whereas

var() int numberOfShoes;

is for variables that need to be accessible within the editor. Also,

var config int numberOfShoes;

is for variables that are loaded from the config files. Note that the editor value takes precedence over the config value.

Here's the part where I'm wondering whether this blog will turn into a technical blog, to which I answer... I do what I want ;) but I'll definitely post stuff that I find interesting, whether it's programming or design, or anything.

Next time we'll talk about design!