Archive for the ‘code’ Tag

Allar’s Dev Diary #13: Day 2, Tower Defense Side Project   Leave a comment

If you don’t know about my Tower Defense Side Project, please read Day 1 here.

Day 2 (11/20/2010)

5. Creating The Camera

I’ve done a few third person cameras before so I was able to implement this system within a half hour. I did research some examples of isometric cameras beforehand however, and I ended up starting with this tutorial here (at X9 Productions) by Christian Roy. His provided code was simple and elegant so it would serve as a perfect slate to base my camera logic on. After implementing his tutorial code however, I found that my ‘isometric’ camera was only being properly shown if I typed behindview in console, but this is because I implemented it as a child of UTGame and not GameInfo. Normally I don’t derive from UTGame but in the case of this project I did not want to have to deal with creating a new code base, but this also causes small issues like these. My solution was to simply force a SetBehindView call on the Pawn during its PostBeginPlay function and that remedied things for the most part. I also had to edit the CameraOffset and the CameraScaleMax variables to get the angle I wanted the camera to be at. Roy’s tutorial implementation does not support camera zooming (however the source code he provides for download does, but I chose to implement it differently). I wanted it so the camera would stay locked and you can’t zoom or rotate it unless you held down the middle mouse button and then moved the mouse or scrolled. In order to accomplish this, the first thing I had to do was to edit DefaultInput.ini and add the following bindings:

//DefaultInput.ini
.Bindings=(Name="MiddleMouseButton",Command="AllowCameraMovement true | onrelease AllowCameraMovement false")
.Bindings=(Name="MouseScrollUp",Command="HandleMouseScroll true")
.Bindings=(Name="MouseScrollDown",Command="HandleMouseScroll false")

This way two functions would be called, one when the MiddleMouseButton was pressed or released, and one when the scroll wheel was scrolled. AllowCameraMovement(bool bEnable) toggles whether or not the camera should rotate or zoom with the mouse, and HandleMouseScroll(bool bUp) handles what to do when the mouse is scrolled up or down.
Read the rest of this entry »

Migrating From February to March   4 comments

Video Version

Subject: Migrating From February to March
Skill Level: Beginner
Run-Time: 30 Minutes
Author: Michael Allar
Notes: Migrating our code base from Feb. to March.

Streaming:     720×480 1920×1080

Download:     Low-Res (117MB) Hi-Res (167MB)

Written Version

Subject: Migrating From February to March
Skill Level: Beginner
Author: Michael Allar
Notes: Migrating our code base from Feb. to March.

See video for an in-depth explanation. Sorry about the indentation, it seems like my indentation will not survive copy paste… D: I will create a written tutorial soon.

Read the rest of this entry »

Posted March 16, 2010 by Allar in Unreal

Tagged with , , , , , ,

Beginning Your Game Part 4   15 comments

Video Version

Subject: Beginning Your Game Part 4
Skill Level: Beginner
Run-Time: 54 Minutes
Author: Michael Allar
Notes: Setting up HTInventoryManager, HTInventory, HTWeapon

Streaming:     720×480 1920×1080

Download:     Low-Res (32MB) Hi-Res (200MB)

Written Version

Subject: Beginning Your Game Part 4
Skill Level: Beginner
Author: Michael Allar
Notes: Setting up HTInventoryManager, HTInventory, HTWeapon

See the video for an in-depth explanation.

Read the rest of this entry »

Posted March 9, 2010 by Allar in Unreal

Tagged with , , , , , , , ,

Beginning Your Game Part 3   31 comments

IMPORTANT

This tutorial was created with the March build of UDK, as opposed to the February build.

This is a big -MY BAD- on my part.

The rest of the tutorials flow nicely after this. I promise.

Here is what you do:

You download the March build.

You install it.

You set up the config files just like you have been doing in Part 1 and Part 2.

YOU THEN DOWNLOAD THIS .ZIP which has the code finished from Part 3. Don’t worry about what you are missing out, if you read through the tutorial you’ll get the important stuff.

Open UTGameConfigDefaultGame.ini

Replace the Engine.GameInfo block with the following:

[Engine.GameInfo]
DefaultGame=UDKGame.UDKGame
DefaultServerGame=UDKGame.UDKGame
PlayerControllerClassName=UDKGame.HTPlayerController
GameDifficulty=+1.0
MaxPlayers=32
DefaultMapPrefixes=(Prefix="HT",GameType="UDKGame.TheHuntGame")

What we did there was move the DefaultMapPrefixes from DefaultProperties to this .ini file, as thats where the March build put it. You will learn how to do stuff like this later on as well.

When you compile, you will get a warning about HTInventoryManager. This will fix itself when you complete step 4.

Then continue to Step 4.

Also, skip Migrating From Feb. To March. since you are now using the March build. <_<

Sorry. These were my first tutorials I’ve made and I was bound to mess up somewhere. All the future tutorials after this will go smoothly. I will try to redo these first three later when I have some spare time.

Read the rest of this entry »

Posted March 8, 2010 by Allar in Unreal

Tagged with , , , , , , , ,

Beginning Your Game Part 2   15 comments

Video Version

Subject: Beginning Your Game Parts 1 and 2
Skill Level: Beginner
Run-Time: 1 Hour
Author: Michael Allar
Notes: This is really incredibly long but goes over how to create a blank slate for your game. Also goes somewhat in-depth on a line-by-line basis.

Streaming:     720×480 1920×1080

Download:     Low-Res (66MB) Hi-Res (200MB)

Written Version

Subject: Beginning Your Game Part 1
Skill Level: Beginner
Author: Michael Allar
Notes: Gets your UDK set up so that you can start coding into your own game class!

You will have needed to have done Beginning Your Game Part 1 if you are sticking to the written series of these tutorials. The video tutorial on both tutorials covers both parts.

Why Is There A Part 2?

So, we now have an empty game mode that we can now start coding into. Great! Why don’t we start going over UnrealScript and start adding our own things?

Well simply put, we aren’t done yet. While we have our own game mode set up now, we still are using Epic’s player logic instead of a blank slate for us to use. The way the Unreal Engine handles player interaction is pretty important to understand:

Read the rest of this entry »

Posted January 15, 2010 by Allar in Unreal

Tagged with , , , , , , , ,

Beginning Your Game Part 1   29 comments

IMPORTANT: Use the March build of UDK

These beginning 4 tutorials got screwed over in a Feb/March mixup. These first two used Feb while the rest of this entire site uses March.

You will get a few warnings when following the first two parts, but there isn’t too much code here. It will begin working fully after parts 3 and 4.

If you can make it past 4, these tutorials are pretty solid and will be a hell of a lot easier.

I’ll try to remake these first tutorials soon.

Video Version

Subject: Beginning Your Game Parts 1 and 2
Skill Level: Beginner
Run-Time: 1 Hour
Author: Michael Allar
Notes: This is really incredibly long but goes over how to create a blank slate for your game. Also goes somewhat in-depth on a line-by-line basis.

Streaming:     720×480 1920×1080

Download:     Low-Res (66MB) Hi-Res (200MB)

Written Version

Subject: Beginning Your Game Part 1
Skill Level: Beginner
Author: Michael Allar
Notes: Gets your UDK set up so that you can start coding into your own game class!

If you haven’t already, you need to install a fresh copy of Epic’s Unreal Development Kit (UDK). Without it, you can’t really build anything.

You also need a way to edit .ini and .uc files. Notepad will work, but I strongly recommend setting up nFringe or Notepad++.

It is highly recommended that you also set up UnCodeX.

At the time of this writing, the UDK version used is UDK-2009-12.

Setting Up Your Code Package

In order to begin coding your new game, you first have to put your code somewhere where the Unreal Engine can find it. This is where the DevelopmentSrc folder comes into play. All the code for your game belongs in the DevelopmentSrc folder, and your code that you will create will be in a folder with a meaningful name that represents your game. Each folder in DevelopmentSrc is a script package, so we call GameFramework, UTGame, UTGameContent, etc “script packages”. In each script package there is a folder within labeled “Classes” where all your UnrealScript classes will go. UnrealScript Classes are how you extend functionality to your game, making it your own. There lies a folder upon installation in Src named MyMod, you may use this folder to place your code in but I highly recommend naming it similar to your game name but keep in mind that you shouldn’t use spaces or weird characters in your package name as it will have to be referenced in code many times. You will see that for this tutorial, I have used “UDKGame” as my script package name. Inside this MyModClasses folder you will find a DO_NOT_DELETE.txt, but feel free to delete this. It seems that this file was only needed for Epic to package the installer correctly. Right now this script package is empty, so lets get ready to add to it!

Read the rest of this entry »

Posted January 15, 2010 by Allar in Unreal

Tagged with , , , , , , , ,

Static Multidimensional Array!?   Leave a comment

This is the first time I made a static multidimensional array, moreso, one with 3 dimensions. I’m still experimenting to find out how efficient this is, but so far it is proving to be extremely efficient as its structured so indexing it uses enum’s that correspond to the right data you want. There were some comments and stuff describing which block did what but I’m not allowed to discuss the project this is for so I had to remove them. Its also indented nicely but WordPress owned my indentation.

static Vector2[][][] StaticData=
{
new Vector2[][]
{
new Vector2[]
{
new Vector2(500,534),
new Vector2(582,534),
new Vector2(663,533),
new Vector2(746,534),
},
new Vector2[]
{
new Vector2(500,87),
new Vector2(582,87),
new Vector2(663,86),
new Vector2(746,87),
},
},
new Vector2[][]
{
new Vector2[]
{
new Vector2(582,445),
new Vector2(663,445),
new Vector2(582,561),
new Vector2(663,561),
},
new Vector2[]
{
new Vector2(582,50),
new Vector2(663,50),
new Vector2(582,165),
new Vector2(663,165),
},
}, Read the rest of this entry »

Posted September 30, 2009 by Allar in XNA

Tagged with , , , ,

Been forever since my last update…   Leave a comment

Over the past month or so I haven’t really had time to update my blog due to lots of stuff that went down that I had to deal with and that I haven’t had time to develop anything regarding Forecourse… but now I’m back. Once again, I will try to remain constant with my updates.

Right now I am focusing on the Forecourse Content Creation Tool, named ForeCreation. It is (will be) a XNA-In-WinForms IDE, allowing the creation of assets that will follow Forecourse standardizations so that they can be used with any Forecourse driven application with ease.

I know its not much of a milestone, but this is my first time really dealing with WinForms, first time dealing with XNA outside of the XNA Game class, and the first time I had to deal with handling the reading/writing of custom data formats for use with an editor, and well, a lot of firsts. It is quite the learning experience and is going quite slow but I am getting there. My little ‘yay I did it’ milestone at the moment (which is pretty inferior code that could be done by a real programmer with utmost ease…) is the ability to programatically create tab pages that contain XNA renderers within. My first implementation of this is a ‘texture preview’ of textures inside the GameDataTextures folder of your project. It is more detailed in this video:

Video of Current Status as of July 25

Posted July 25, 2009 by Allar in Forecourse, Site, XNA

Tagged with , , , , , ,

Refactoring Forecourse   1 comment

I will post all the info I can about Project Forecourse as soon as this is done.

Currently I am in the process of refactoring my Project Forecourse’s code so that, well, a bunch of things could happen.

The first and main reason is so that all my code is more readable and programmer-friendly. Also, I have decided to break down main components into C# .NET .DLL’s, which will allow me or anyone to use a certain component of Forecourse without having to disable/modify a lot of code, and so that anyone who just wants to start making stuff with XNA can have all the base grunt work already done for them. My main focus on Forecourse at the moment is all code dealing with UI, as it is really hard to make a functionable game without some UI present. I am making this code (ForeGUI.dll) not dependent on XNA at all, so that the UI logic can be used with other projects without rewritting. To use this .DLL though, you must shell out basic functions to wrap a few of my GUI functions, but that is it. I will also be providing working example wrapper code so that you may rewrap the dll to best fit with your project. And the last major reason is so that I can get people working with me in XNA sooner and easier than before, as my previous code was pretty daunting.

Posted May 28, 2009 by Allar in Forecourse

Tagged with , , , , , , ,