Into the Unknown: UDK Part 4

I’ve finally reached that breaking point where I am comfortable with the Unreal Engine. I may not have knowledge of every aspect, but I am finally understanding the basic axioms driving the inner workings, which allows me to intuitively understand where to look when I am stumped. The unfixable problems are falling away as my problem-solving abilities increase with respect to the environment. When you are utterly clueless about the engine, it can be difficult to know what kind of help to look for.

So in the past few weeks I began working on the project again. This time, I would build up an easy, lightweight framework from the UDK (rather than UT) packages — that is, I started out with much less pre-built functionality so that I could understand everything that was going on.

I succeeded. So far I’ve built a basic Pawn framework (Pawns are objects controlled by players or AI) with a custom crouch system and an Inventory Manager that better suits my needs. I’m also working on a Weapon system, although I haven’t implemented sounds, particle effects, etc. My HUD system is minimal, but so far that is all I need.

When I need to, I go to the UT packages and look at their implementations. However, the number of times I’ve copied and cut down code has decreased dramatically. Now I can write my own code with confidence that it does everything I want it to (note that although I am perfectly comfortable coding, it is more about knowing which function calls go where in the logic chain, and what to reference).

Note that I don’t have grenades, vehicles, sounds, shields, AI, other characters, or environments yet. However, I’m more comfortable having a small, solid base of functionality that I completely understand, rather than a thin spread of half-implemented, opaque features. Down one road lies abandonment, down the other lies slow but steady plodding to completion.

Advertisements

Programming a 40K Simulator

(further reading)

This has been a pet project of mine for a long time. I’ve taken a couple cracks at making one, but have failed miserably each time. My objective is to create a simulator that allows players to play battles with various armies, allowing them to refine their strategies before actually buying the models. However, I want a fairly flexible and modular rule system that enables alternate rulesets to be introduced (not only other official rule editions, but custom gametypes like racing) and of course custom armies. There are two inherent problems with creating a realistic simulator:

  1. The number of exceptions to the rules is about as large as the number of rules. Many exceptions rely on human understanding of the rules, and get resolved intuitively. This is problematic when going for a procedural approach
  2. The rules change. I started playing with 4th edition rules. My first attempt was during that phase. When I made my second attempt, the rules had moved onto 5th edition. Now they are in 6th edition. It’s a pain in my ass.

The two previous times I attempted to make a simulator, I programmed from the ground up. This time I’m thinking about using Unity3D. This makes sense in at least one regard: Line of Sight is contingent on precise model and terrain geometries. If I want the project to match my objectives, I need some sort of 3D system behind it.

I see a pretty clear path for development. The first step is to breakdown the rules into a clear procedural system. After I can see the possibilities that need to be encountered, I can figure out how to generalize that into as simple an architecture as possible. Then I can figure out how to implement that in Unity3D.

Unfortunately, every step of that is hard. I’m still stuck on that first step. First, I’m unaccustomed to the 6th edition ruleset. Second, the rulebook isn’t laid out optimally for my purposes. It works well for a beginner building up their understanding. The basics of each step is introduced, and then later modified with exceptions and special cases. I need an organizational somewhere between a flowchart and an outline.

So I have two things I need to do: map the rules, and learn C# for later use in Unity3D.

Into the Unknown: UDK Part 3

My exploration has continued to go off the expected tracks. For some unearthly reason I decided that my first goal would be to port a character model from Halo to the UDK. Well, I’ve learned a lot through my experimentation. The first thing, of course, is to get the model. I downloaded a low-poly model of the Halo 3 version of the Master Chief from Halomaps. The great thing about downloading a tagset for Halo: Custom Edition is that the model comes with a bitmap. A lot of the 3D models on that site are better quality, but lack textures.

Easy-Bake MC (broken image)

So, using conversion utilities also downloaded from Halomaps, I converted from the Gearbox formats to 3DS and TARGA formats for models and bitmaps respectively. The models come pre-skinned, so all I have to do is load in the texture. Of course, I also have to do any rigging I need. Thus, I re-learned rigging in 3dsMax this week. Strangely enough, the vocabularly is ambiguous when it comes to this process. To my knowledge, rigging refers to either the creation of the skeleton OR the application of vertex weighting to a mesh. Similarly, skinning can mean vertex weighting OR texturing. Very strange.

I used one of the skeletons that Epic provides, because it means that you can use the animation sets already in the UDK. I got my Master Chief model in-game finally. There is a lot of boilerplate scripting that goes into creating a new player-character. I also had to fix an (apparanetly prevalent) issue in which any character model (even the examples that Epic provided) would float above the ground. According to online forums, all I had to do was move the origin of the mesh down. Well, little did I know that there are actually two “origins” to a skeletal mesh. One is for the bounding box, and one is for the mesh. It took me a good hour to figure out that I was changing the wrong origin.

Ingame MC! (broken image)

Then I moved onto creating a weapon because the MC I imported looked absolutely swell (except for a few errors in the rigging). I found a great tutorial that explains all the steps, and introduces a way of animating the first-person arms separate from the weapons, and then combining the two meshes using scripts. That way you can change the model of the arms or the weapon independently from each other, and don’t have to re-import the first-person arms for each new weapon. The weapon (a MA5C assault rifle) was breeze to rig and import ingame. The arms were a bit more a struggle.

It took me a little while to realize that I don’t have to use the first-person skeleton provided by Epic, because I’m not going to be using any of their animations. By that time, I had already skinned the arms to their skeleton, though. Because of weird transform issues with 3dsMax’s skinning, I kept getting this seemingly-unfixable error when I imported the arms:

FUBAR Arms (broken image)

It didn’t help that the tutorial I was watching used ActorX to export animations rather than FBX. Well, I realized that instead of trying to fix this utter mess (into which I had poured hours of work), I should just hop over to Halomaps and grab a pre-rigged, pre-textured, ready-to-go set of first-person arms. And that’s where I am right now.

Into the Unknown: UDK Part 2

Well, it’s been a while since Part 1. The delay was a combination of final exams and my re-discovery of Unity (the game engine, not the Ubuntu UI – or the Linux distribution for that matter). But I’ve done a little bit of tutorialing, and so far I’ve learned to set up a new gametype, and have been practicing BSP creation. Unfortunately, I’m using my second monitor for the computer I built, so using the Content Browser or reading a tutorial while working is very annoying.

Honestly, the BSP system is slightly vexing. I don’t understand why I have to use the template shape to add and subtract geometry. It would be much easier to create brushes like in the Source SDK, and then apply the boolean modifiers to them. Shapes without modifiers would just be ignored. The visual scaling in the Source SDK is much easier than entering values in the UDK. Another very minor detail is the fact that you can’t use negative wall widths in the UDK. In the Source SDK, negative values indicate an outward expansion, leaving the original volume an empty space. In the UDK, however, it just places the subtraction volume outside of the addition volume, or some other strange behavior, which results in a very strange visual result.

That’s all I have for now. The next step I imagine would be learning to create materials. I have already done this in my previous explorations, but I need to figure out the editor in more depth. I’ll be in California for the next 10 weeks, but I’ll be able to work on my laptop.

Sim State

I’ve been meaning to write this post for a while. This idea really started when I watched Day[9] play the new Sim City, and then picked up Sim City 4 again. I wanted to create a game which brought the ideas of micromanaging infrastructure and government into a larger scale. The player would be able to control education, government type, military, trade, etc. Eventually it grew into a sort of “third-world country simulator”, since that seemed like the most interesting route to people I pitched the general concept to.

The basic premise is that you are the leader of a small country, recently put in power by a violent revolution. This country is located in a faux South or Central America, but there is also the possibility for having multiple templates: African, Southeast Asian, etc. The player can only really see the small land area he controls, plus some of the bordering sovereignties. There is no global map (and this isn’t a game about conquest), but there are references to current global institutions (or fictitious characterizations thereof) like the UN and US, or WHO, etc.

Winning the game means pulling your country out of poverty and onto the world stage. This requires many parts, including building infrastructure, establishing governmental rule, and appeasing the international community. However, the win condition is gaining control over every province in your nation. Control just means being the dominant power faction. Routes to control include stamping out resistance (militarily) and appeasing interest groups. Thus a large part of the game is balancing political control; keep the military leaders on your side, stop workers from striking, and stay elected. The last one may mean establishing a dictatorship, rigging elections, or spending a lot of resources maintaining public image.

At the start of the game, your country is poor and unequipped. There are two forms of currency: money, and international repute. International repute can be spent on relief or treaties; perhaps getting a foreign oil company to leave your country. On the other hand, if you drive out the oil company by force, some factions in your own country may approve, while the international community may impose sanctions. Similarly, if their are pirate along the coast, you could demand tribute or try to exterminate them at a potentially great cost. If the world catches wind that you are allowing pirates to operate, however, you will lose repute.

The other form of currency is money. A little macro-economics comes into play here, since you have to manage your currency (printing money), and real “world dollars”. Rapid inflation can be bad for your industries, but it attracts tourists (but only to good parts – nobody is going to visit the region controlled by drug cartels). Real dollars come from exports, mainly. One way to get a boost in the beginning of the game is to exploit your natural resources: cut down rain forests, strip mine mountains, etc. However, you have to establish a more mature manufacturing industry at some point, otherwise you will exhaust your resources and fall back down into poverty.

In terms of infrastructure the player has to build, the main forms are education and industry. Industry includes transportation networks and resource collection, as well as processing. Industry also means municipal improvements, since nice cities attract high-tech corporations and commercial companies. Another route to improving the quality of your workforce, reducing crime, and eliminating overpopulation is education. Building schools takes a lot of resources for little immediate payoff, but it will start to improve your country greatly. It is also a great way for dictators to indoctrinate the population.

Late-game opportunities may include hosting Olympic Games or researching nuclear technology.

As you can see, there is a lot of room for expansions; this is more of a framework for a game, rather than a fleshed out game idea. I know there are games like this, such as Tropico. I think this would be more political and deep than Tropico, but obviously I would aim to offer a different experience overall were I to build this.

Using Games to Educate

In the last few years we’ve seen the Internet playing a larger and larger role in education. Everyone seems to expect a revolution in education within 20 years. It’s possible, although I don’t think it will come from the direction that everyone thinks it will (see my post on online education). I want to give my two cents about an ancillary approach: videogames. Games don’t have to teach the students anything. In fact, I think they are much more useful as vehicles for the education. Games provide a background, a context, for new knowledge. For example, playing Deus Ex: Human Revolution (play chapters of a game as homework instead of reading chapters of a book?) could help spark discussion about the current situation of computers, implants, artificial intelligence, politics, etc. The experiences within the game outside of the lesson help students stay interested and apply the knowledge, even if subconsciously, beyond the classroom.

I’m going to focus on two games: Kerbal Space Program and Minecraft. Prmrytchr has a whole blog on using Minecraft (as well as other games) in the classroom, so I’m going to focus on the technical aspects.

the KSP splash

Kerbal Space Program (KSP) is an indie game currently under development with an open alpha available for purchase. In the game, you run the space agency of a particularly derpy alien race in their Sol-like system. In sandbox mode, you can throw together rockets, probes, rovers, space stations, planes, and planetary bases from a wide assortment of parts. Then you launch your constructions and control them to the best of your abilities.

KSP Screenshot KSP Screenshot 2

While hard to grasp at first, the game is incredibly fun. You do need a rudimentary understanding of kinematics to play well. This is the first step in its ability to act as an educational tool. While you can strap an engine onto a fuel tank and try to fly it, you quickly realize that doing anything impressive — such as putting an object in orbit — requires a bit of education. While you could watch tutorials, you could also get a lesson about basic kinematics and orbital mechanics from a present teacher. There’s an opportunity for lessons on engineering, as well.

As students become more proficient, more complex opportunities open up to them. Orbital rendezvous and gravitational slingshots get more involved physically. Spacecraft design, between mass conservation, fuel-mass ratio, reaction thruster placement, and properties of engines, is a great opportunity for springboarding into other physics. Other elements of spacecraft design that aren’t simulated in KSP, such as heat management, enter the realm of thermodynamics. Ancillary topics that arise when discussing space exploration can involve relativity and electromagnetic waves.

minecraft splashMinecraft, on the other hand, is about as physically unrealistic as you can get. However, it provides an awesome way to teach logic and economics. Even vanilla Minecraft has a growing arsenal of parts which allow rudimentary (or not so rudimentary) automation. Redstone is a powerful tool for doing any sort of logical manipulation — or teaching it. Watching your toolbox of gates and mechanisms grow out of a few basic ground rules is amazing. Creative minds are pushed to imagining new ways of using redstone, pistons, minecarts, and all the other machines being added in. While I’m not a fan, mods like Technic or Tekkit expand the array of basic parts at your disposal.

Multiplayer in Minecraft is an interesting case study of economic theory. Because the system varies so much from the real world, it provides an outside perspective on traditional economic theory. As you teach the basics of microeconomics, you can analyze why Minecraft’s multiplayer economy and identify how to restrict it. The ultimate goal of the class could be to establish a working economic system on a Minecraft server (perhaps through plugins/mods?).

Redstone Schematic Redstone Screenshot

Whether or not any of these are good ideas, it illuminates how games don’t have to be the primary vehicle of learning to be a useful educational tool. Games can merely be a springboard, a point of reference from which lessons emerge. The game keeps the students interested and grounded in the topic, while providing a useful outlet and vector of fortification for the knowledge they are getting in class.

Into the Unknown: UDK Part 1

I tried this before, but ended up quitting. I believe now that my exit was premature. I refer of course to my adventure into the Unreal Development Kit, a free version of the Unreal Engine that allows developers to create their own games in the Unreal Engine.

My reason for embarking on the adventure was to recreate the gameplay from Halo: Combat Evolved on an updated platform. The bonus is two-fold. For the longest time, I have had a Halo custom campaign in the works, but have never really gotten the Halo Editing Kit tools to work for me. Secondly, I have always felt the need to learn how to use a 3D game development tool. After exploring Unity slightly and having dabbled in CryEngine 2 (and somewhat 3), I decided it would be good to experience the Unreal Engine.

Posting updates on this blog serves two purposes: One, it keeps me from giving up again. Second, it helps me quantify my successes and organize my thoughts. Hopefully I can post an update on this project every two or three weeks, with either video or pictures to show off new milestones.

Without further ado, I want to outline some of my goals for the upcoming project:

  1. Learn how to create:
    • particle effects
    • weapons
    • vehicles
    • characters
    • AI behavior
    • scenery
    • level geometry
  2. Learn what else I need to learn
%d bloggers like this: