Always snap to grid

Legacy:Kungfu Hampster/Developer Journal

From Unreal Wiki, The Unreal Engine Documentation Site
< Legacy:Kungfu Hampster
Revision as of 17:31, 14 February 2008 by (Talk) (reverted)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Kungfu Hampster Developer Journal

Man with Keyboard Prints on forehead

Okay, so I'm going to use this page as a way to list the issues I come up wiht every day working with unrealscript. I will post code upon request, but I'm not going to post huge blocks of code. Well, maybe I harm in lending a helping had to y'all! ;)

It should go as a given, but if you use any of my code, please give me some kinda credit! Also, feel free to add comments but please don't edit my journal text unless you feel like adding a helpful link!

  • A brief overview of what I'm trying ta do:
    • Use a HUD interaction to create an interface that will limit user control to the mouse and still allow interactivity
    • Create my own radar map outside of Onslaught's
    • Develop interactivity with BSPs and Static Meshes within my environment with the mouse
    • Track player movement and be able to output information and images and such


The Onslaught map is working fine for now. I'm going to have to develop some kind of code outside of it in order to separate out mod from looking too much like UT. The only think making it look like UT for now is the cursor. I know there's a way to create a textrotator, but I haven't looked into it too much yet. The volumes and capturepoints are working fine, althought I have noticed a small problem, something that happened earlier in the process.

When you use custom scripts in your levels to make volume, capture points, whatever, the level you're working on becomes linked to those scripts. So, for example, if you decide to do revisions on a compiled file, or change the name of a group of classes, the level will not open. It will give you a bad name index or something similar. The linked compiled package you loaded in muse be in the system folder period. I have not found a way at the present time to remove this link other than placing backups of the compiled files back where they belong.

I have also come across a strange error that occurs about every two weeks or so. After a few revisions and compilations, I will develop a type mismatch in my interaction class. I'm not sure where this is coming from, but I've found the only way to deal with this is to find an older version of the code and re-write it. (That how I consistently come across the bad name index I stated above!)

  1. event Initialized()
  2. {
  5. 	if((pOwner == none) && (myPlayer(ViewportOwner.Actor) != none))
  6. 		pOwner = myPlayer(ViewportOwner.Actor);
  8. }

Always in the Initialization part of the interaction class. Still trying to figure out this one.

Also, I'm having a weird error pop up from my level editors. They'll create a texture package with a level, bring it over to me and when I get it, sometimes a certain texture will dissapear or go missing. I've even gone so far as to open the exact same package (same time and everything in details via windows), checked that the texture was there, ported is over via a network, worked with it for a while....then boom! The texture is gone fter about two or three saves. Hmmm....maybe I wasn't wrong about those corrupt texture packs...

Final issue I'm trying to iron out is how to make a HUD interaction visible and invisible. The problem we're running into is using a manitee sequence in the level. Since I'm using a hud interaction, the textures on the hud aren't disappearing when you roll over the trigger point. I've tried using the variable of bHideHud to control whether the HUD is or is not diplayed, but it dosen't seem to have worked so far.

Tip of the day

If you're having a variable of none appearing all over your log, make sure you set a clause before the script executes! Something like...

    if (cv != none)
          ...your code here


    I had some inital problems getting things running today, but eventually I found out that it was becuase I had commented piece of code out.  

That's what happens when u get sick an ddon't touch your code for almost a week! My main issue today was getting the HUD to disappear during a Manitee sequence, something we had problems with becuase I was using an interaction.

The solution was not so obvious, but turns out to be very simple. In the interaction class, add this bit of code to your initalized()

	if (pOwner.bViewingMatineeCinematic == true)
	   pOwner.myHud.bHideHud = true;
    if (pOwner.myHUD.bHideHUD != true)

pOwner is a variable of my custom class which extends xPlayer. With this small bit o' code, the interaction will respons to the hidehud command. My next order of buisness to creating splash screens as well as working on the interactivity of the mod.

The spash screen s look pretty straighforeward. Gettign them to work within the mod in it's own directory structiure might be a little difficult. All the files I see out there have you replacing the text in the 2004.ini or User.ini...or even replacing the actual files from the install. That's not going to work in my opinion. I need this mod to sit on top of the engine and that's that!

The major problem we're having at this time is recording realtime movies using the engine. I have seen fan films that have been done using demorec to make a file, then render it out to an avi. The problem is that when I do that, the interaction dissapears! (Figures it woul be the opposite problem I had before) There must be something that the demorec function is calling that hides certain parts of the hud.

Looking at normal game renderings and other fan films, the gun arm tends to dissapear when recorded. So, there's got to be a way to make this visible. As for recording the mouse cursor I made, that might be impossible. I'm going to give myself until tomorrow to figure it out.

Tip o' the day

Before you even start writing code, sit down and write out the class names you're going to use. While it's fun to just start digging in ode, not establishing your class names will really bite you in the end.


Started looking into interactivity. I have to figure out whether it's even possible to change the textures on the BSP's on the fly. I blieve there is some way to do it, since i have experiemented with a materialtrigger and have found that it works fairly smoothly.

  • Tricky stuff
    • Getting the trigger to work with a keypress
    • Tracking player movment and view position
    • Selecting which part of the BSP is being accessed.

Tracking player position shouldn't be too hard since I'm already doing that with the volumes and the capture points. Linking the triggers is goig to be a pin, since I might need four of them for each room and i have to be able to access them separately. I'm considering implementing soem kind of menu system with the right mouse button that will be room specific. So, you go in a room, right click and you get options for the floor, walls, ect...

Later That day

I've tried building my own materialTrigger but don't seem to be having any luck so far. I figured that if I could somehow link the enteredvolume() unction to the material trigger, just like you do with a regular trigger. By doing this I could track where the player is and activate triggers depending on their location. I might get stuck using regular triggers at this point, but I think that might really slow the ocmputer down...

Tip o' the day

If you get a bad name index and you've been working with custom volumes, trigers,'s probably becuase you removed or deleted the .u & .ucl file from the System folder. Maps for some reason develop a dependence to these files, even if the items wihtin the level have been deleted. Always keep this in mind, so don't start placing these things in your evel unless the design of your map is close to being finished.


Still working on gettign those textures to change. I'm trying to find an appropriate way to link the triggers to a keypress without having to walk up to it and press the use button (i'm using the usetrigger right now). I wrote a custom usetrigger and am trying to mess with that, but I can't seem to find any way to limit whether the player can access it or not. I've tried using the volume trick I used to track player position, but that dosen't seem to be working either.

I think the code to control it should probably go in here:

function Touch( Actor Other )
	if ( Pawn(Other) != None )
	    // Send a string message to the toucher.
	    if( Message != "" )
		if ( AIController(Pawn(Other).Controller) != None)

I'm trying to use a boolean to start, something simple. I'll keep you posted.

Tip o' the day

This is kinda silly, but learn the windows hotkeys cause they really make stuff simpler. Especially stuff that works with the windows key. Win + D minimizes everything, Win + E opens a windows explorer and Win + R will open the Run utility from the start menu.


I was able to map the use function to the right mouse button by using a keypress interaction and putting in pOwner.Use() where pOwner is derived from xPlayer. It's nice to have the use function mapped, but I need to try to figure out a way to control the triggers depending on the orientation of the player. I know there's a trigger that fires depending on whether a person is looking at it, but after one fire is destroys itself (i think...)

The tracking volume trick dosen't seem to be working, so I decided a simpler route would be to place all the triggers in the room and make teir radius the size of the room or however big I need, then turn the triggers on or off depending on where the playeris facing. Still I can see a problem with this becuase the walls are coming up empty whenever I use the worldToScreen command.

Right now my path of action is: useKey => UseTrigger => Material Switch

I just need to figure out how to turn the use key on and off by player orientation...or by cursor position...

Tip o' the day

WOTgreal and UDE are your best friends. In my opinion, the only way to edit unrealscript. If you're not using them already, you're really limiting the speed in which you can accomplish things.


I'm going to have to step away from UT for a while. I've got some other things to take care of...mainly moving out to San Francisco! I'll post my developments when they happen ;)

Tip o' the day

Use the dfault properties as much as possible. If you have a lot of variables which have the same number, set a default prop equaling a variable hat u place where the numbers went. Then, you can adjust all your values in one place! Very helpful when doing HUD mods...

Foogod: So you're comin' over to the ol' SF bay area, huh? Cool to see a local (or soon to be local) fellow! We'll have to get together or something.. :)

KungFu Hampster: Man...a new city and I already got a stalker. What're the odds? ;) I'm actually moving there to go to grad school at the San Fran Academy of Art. My current school just ain't cuttin it. So, I get to stay in school a few years, work on computer stuff, and go deeper in debt. Horray for me!


Found some time to poke around the engine. I'm working on making custom menus right now. Best resource I've found so far was at Also try looking at Daemonica/Previous Problems and GUIPage. I'm going to try to put soem music in there too.

I tried using the UModWizard a few days ago and found it to be good and bad. For one thing, I can't figure out how to stick a shortcut on the desktop when the mod installs. I know there's a way ta do this becuase Red Orchestra did it. Also, I'm finding that the program dosen't seem to install certain components correctly. I'm not sure if this is because of the fact that I'm using my own directory or what, but it's kind of annoying. Right now the best way I've found is to use the installer, then futz with it till it works. Not the best solution, right? Is anyone has any advice on how to make the UModWizard work correctly, please help me out ;)

I'm also having a hell of a problem getting my interaction to work correctly. I keep gettign these weird class mismatch errors in my interaction class. If you know anything about interactions, please go to the Help Desk and look at my code ta help me out!

I've also found an issue with a lot of the examples I'm looking at. Many of them have been written for UT2003 or earlier...and since there were significant changes to the UT interface (namley the edition of UT2K4 GUI's) I'm finding a lot of errors and crap. So, I gotta work through that and hope I can get something to work. Many of my midgame menus are definetly not working, but I'm trying to piece through the Unreal2Runtime to use as an example of what I should be doing....


I was able to get a main menu class to get up and running form my mod hierarchy. I'm still working on the midgame menu though. I suspect that I'm not putting it in the .ini's correctly, but everything looks solid right now. There's also the issue of getting all the bots to stop spawing in my map, since this is to be a single player immersive kinda project. Also, I really gotta get uMod working. We'll just have ta see what I can do...

Batch files are the bane of my existance. Also the joy. They really piss me off when they don't work but when they do I don't mind people looking at me from across the room. Makes me feel like a hot shot programmer. *pushes up glasses* He he!


Hope you had a happy holiday. I'm going full force today on making the menu sysytem work as well as the installer. Over t Atari Forums, Ron Presterback (I believe that's how u spell his name) reccomeded I check out some of the test code that was included with the UT2004 disc when shipped. THey start with My...and are called stuff like MyTestPanel and such. I'm going to check them out today as well as trying to tear apart the pieces of UT2Runtime to stt when I can find. It seems that the runtime uses some kind of tab system...but I think it's still organized the same way...

Later That Day...

The midgamemenu class turns out to be a class called UT2K4PlayerLoginMenu.u. CHanging that in the ini fixed the problem ;)


Still working on the GUI. THe GUI for 2003 and 2004 are very different, so this is presenting some problems when I look at web sites with people's examples and such. The interactive GUI designer has been helpful, but exporting the items still presents problems when it comes to deleting stuff. It would be nice to be able to put in my own fonts of my own colors for these items, but it dosen't seem to be a possibility. I'll just have to see if I can figure something out.

The backgrounds and the startup icon were easy to do. I'm getting soem weird stretching in the background however, which I believe is resolution dependent. Since the computer I'm using to do this is kinda crummy, I have to keep the rez fairly low. The result are black bars across the sides of my screen. I'm tried stretching the image out but it dosen't seem to solve the problem. Looking the the UT files I noticed they declared their backgrounds differently than me...

	Begin Object Class=BackgroundImage Name=PageBackground
	End Object

Trying to use this method proved to be pretty stinky. My own method was simpler...

   Background=Texture'rscGUI.background2'  //  mmbgnd

I think this is the "old" method of doing it. But seeing as how I can't get the new one to work...:(

Tip o' The Day

If u want a custom startup logo for you mod, title the logo the same title as your mod, followed by logo...For example, if my mod as titled "TestMod" my logo would be: TestModLogo.bmp. Make sure your bmp as 256 colors too, or else it won't work.


Happy new year!

Spending more time working on the menus. It seems to me that the buttons timeselves are defined through the sty_* classes. The grapics are are defined themselves through code. Like, when you say what the text it, it automatically spaces itself . In the packaged texture files there are these little 64x64 ticks which are the rollovers, down states, and all that crap. I'm goignt o try making some of my own in photoshop and see what happens...

I had a problem previously where bots would just spawn randomly, even if I specified it was an sp game. The way I found around this is to extend my main DM class from Deathmatch instead of XDeathmatch. Why does this work? I HAVE NO IDEA! But it works nontheless! Horray!


I feel like the project is very close to completion. However, I'm having a problem with dissapearing textures again. Here's a copy of a post I put on Atari Forums....

I will try forcing the whole package to save next time, but for now I found a temporary fix, but it's pretty sloppy.

I have my own Mod folder with it's own texture/map/staticmesh/ect. folders. So, the texture pack has been residing in there. I took the texture pack (after the shader and two textures had dissapeared again), placed the textures and shader back in, saved it within my mod folder, then placed an exact duplicate in the UT2004/Textures folder.

For some reason, now that I did this, the map works and the textures always show up in the map. (For now!)

I've had my maps develop "dependencies" like this in the past. When I was creating a custom hud, I scripted a custom volume as a test, then tried to remove that class from the folder. I kept getting bad name indexes until I placed the class back in. Even thought an instance of the custom volume didn't even exist anywhere on the map and the written class had no variables or functions in it, the dependency was still there.

I can't help but think this texture error could be the same type of thing, although I do think it's weird that it always deletes the same two textures and shader!

Like I said above, these dependencies I've found to be the most annoying part of Unreal. I'm not sure why it happens and a lot of the time there's nothing u can do about it. Grrr.....c'mon Epic!

Other than that, the menus are looking good and the installer for the most part seems to be working okay. We'll just have to see when I try putting it on other people's machines!


The installer is working fairly well now. I did havesoem problems on machines that had the installer put in previously, I think because of residual stuff left over from previous attempts. The load screens were easily inserted as well. The midgamemenus seem to be working fine as well. Helpers have been i just have to put the popups back in and place them in the latest version of the map. Then, it's on to optimization!

Tip of the day

Make sure that when you save your texture packages, you force the loading of the entire package before you save! If you on't textures will begin to mysteriously dissapear! There's a white button in the texture_browser of UnrealEd that does this.


For soem reason, after i placed everything in the installer, the fading icons have stopped working. I think this might be due to me changing the class of the customDM to Deathmatch as opposed to xDeathmatch. However, I don't know what I'm goignt o do about the bots if I switch it back to xDeathmatch, so I might have to find another way around that.

What I really suspect is it has something to do with the tick equasion I wrote.

event Tick(float DeltaTime)
       if (cv != none)
//checking the glow and doing the fade...
    if (fadeout == true)
          if (Delay > 0.0)
                    Delay = FMax(0.0, Delay - DeltaTime);
          Fade = FMin(255, Fade + SpeedFade * DeltaTime);
          if (fade >= 255)
                   fade = 255;

I think the problem might lie here. I placed in some logs within this function just to see if I could get some kind of huge output, but nothing came out. I'm going to start by looking back through my old backups to the fading icons that worked and see if I can piece through what went wrong.

Leaving for San Fran on Saturday!

On a side note, those of you who know about the MarZer's DWeather project, I have agreed that after I finish up this an get settled in Cali that I'm gooing to get started on helping him to finalize that project.


My menu classes are giving me a headache.

For some reason, my fades, which I worked so long on, are not working on my new finalized level, nor are they working when I put the menu classes in. I'm going to go through the classes and try to find out why, but I think the menuclasses are blocking the PRI from being assigned. The log I keep getting back says that the PRI is failing to be assigned, ususally being set to none.

Also, the problem I was having before about the interaction and player classes not being valid to eachother has reared it's ugly head again. I thought I had finally figured out why I got this error, but I'm just not sure anymore. I'll just have to keep moving things around until I figure it out.


Back from the dead, eh?

About to get started working with this project again. I'll keep u posted...

MythOpus: About the textures mysteriously disapearing, you should always just load the entire texture package on startup :D