Thursday, December 03, 2009

greetings again

Well it's been a lifetime... but this blog still remains one of my most looked at things.
I thought it was looking pretty sad with its last update like 3 years ago... so here's one for the hell of it.

If you're interested in UnrealArt this blog was used during the development of the project. Since the last post on here its been shown in many an exhibition and is still being talked about. Which is pretty awesome :)

I've been busying myself with one thing or another since the MA, I taught for a while, I was an artist for a while, I was a programmer for a while, now I err... well. Well, I suppose I am trying to make games for a living while reading lots of comics (think more of comics like 'Blankets' less of ones like 'X-Men').

Tuesday, July 11, 2006

Okay, there are 4 pieces of Unreal script required to make everything work...
I want to:-

1. monitor which keys are pressed in unreal
2. make an object move based on the keypress
3. constantly be sending the positions of the players out via udp

okay, lets start with send the positions of the players out via udp.
a class is needed Ive called it "udptest".

---------------------------------------

class udptest extends UdpLink;

event prebeginplay()
{
local UdpLink.ipaddr dest;

Log("ullo charlie");
BindPort(9001, true);
StringToIpAddr("192.168.2.8", dest);
dest.port = 9000;

SendText(dest , "imtext"); //this is the first message to be sent via UDP
}

defaultproperties {}


---------------------------------------

Then we need a mutator to actually do stuff... its called "watcher"

---------------------------------------

class Watcher extends mutator;

var() int counter;
var UdpLink myudp;

event PreBeginPlay()
{
SetTimer(1.0,true);
myudp=Spawn(class'udptest'); //ensure the class we just made runs
}


function Timer()
{

local UdpLink.ipaddr dest;
local Controller C;

myudp.StringtoIpAddr("192.168.2.8",dest);
dest.port=9000;

for (C = Level.ControllerList; C != None; C = C.NextController)
{
if(C.Pawn != None) {
myudp.SendText(dest , "nextthree");
myudp.SendText(dest , C.Pawn.Location.X);
myudp.SendText(dest , C.Pawn.Location.Y);
myudp.SendText(dest , C.Pawn.Location.Z);
}
}
}

DefaultProperties
{
FriendlyName="Watcher"
Description="I log the positions of the players every second and send this informaton to ip:192.168.2.8 , port:9000"
}


---------------------------------------

Now then, monitoring keypresses... a mutator which starts an interaction, the mutator is called "keyinteract_mut"
note: I dont understand most of this code, I pretty much copied it off the wiki other than the bit that refrences keyinteract_inter, which is my final class

---------------------------------------

class keyinteract_mut extends Mutator;

var bool bAffectSpectators; // If this is set to true, an interaction will be created for spectators
var bool bAffectPlayers; // If this is set to true, an interaction will be created for players
var bool bHasInteraction;

function PreBeginPlay()
{
Log("key interact Mutator Started");
}

simulated function Tick(float DeltaTime)
{
local PlayerController PC;

// If the player has an interaction already, exit function.
if (bHasInteraction)
Return;
PC = Level.GetLocalPlayerController();

// Run a check to see whether this mutator should create an interaction for the player
if ( PC != None && ((PC.PlayerReplicationInfo.bIsSpectator && bAffectSpectators) || (bAffectPlayers && !PC.PlayerReplicationInfo.bIsSpectator)) )
{
PC.Player.InteractionMaster.AddInteraction("keyinteract_inter.keyinteract_inter", PC.Player); // Create the interaction/ run my class
bHasInteraction = True; // Set the variable so this lot isn't called again
}
}

DefaultProperties
{
FriendlyName="interaction creator"
Description="I do something that starts let interactions happen, apparently im needed if you want triggers to go off with key presses"
bAffectSpectators=false
bAffectPlayers=true
RemoteRole=ROLE_SimulatedProxy
bAlwaysRelevant=true
}


---------------------------------------

and finally what to do with keypresses, a class called "keyinteract_inter"
note: for this I have a series of movers in my map waiting to certain triggers eg.
a mover with the tag "move1" will activate (accordin to the code) when Numpad0 is pressed.

---------------------------------------

Class keyinteract_inter extends Interaction;

Function Initialize()
{
Log("Interaction Initialized");

}


function bool KeyEvent(EInputKey Key, EInputAction Action, FLOAT Delta )
{

if ((Action == IST_Press) && (Key == IK_NumPad0))
{
ViewportOwner.Actor.TriggerEvent('move1',ViewportOwner.Actor,None);
}

if ((Action == IST_Press) && (Key == IK_NumPad1))
{
ViewportOwner.Actor.TriggerEvent('move2',ViewportOwner.Actor,None);
}

if ((Action == IST_Press) && (Key == IK_NumPad2))
{
ViewportOwner.Actor.TriggerEvent('move3',ViewportOwner.Actor,None);
}
if ((Action == IST_Press) && (Key == IK_Y))
{
ViewportOwner.Actor.TriggerEvent('move35',ViewportOwner.Actor,None);
}

if ((Action == IST_Press) && (Key == IK_Z))
{
ViewportOwner.Actor.TriggerEvent('move36',ViewportOwner.Actor,None);
}

return false;
}


DefaultProperties
{
bActive=True
}


---------------------------------------

Thursday, June 15, 2006

just to prove this UDP thing works...
One computer playing UT is sending info to my computer. (this processing script is printing everything the computer is recieving)



The thing is this all wont work on one computer... if I run unreal and processing on the same computer it dosnt work?
I think it has something to do with UDP and having to travel over a network, and not working locally...

p.s. It look like Im going to be doing a workshop in Manchester for the Futuresonic festival. The workshop is about game modding (and in theory will be using this whole UDP thing). Handily I wont be doing it alone, it will be a joint thing with Tom Betts.
Out of interest it will be a 3 day thing,
1st day - UnrealEditor, and creating your own maps
2nd day - Getting game data out of Unreal and to PD (maby processing too)
3rd day - Making something with it (something noisy)

Tuesday, May 30, 2006

Well, Im getting there now.

UT2004 sends x, y's and z's to another computer via UDP on port 9000.
Processing recieves the packet communication and converts them into lovely useful floats, whilst ignoring any packets that arent relevant (there are quite a few!).

Heres the processing code that accepts communication and converts to floats.
I used the Carnivore library in the end.


// Uses Carnivore
// Note: requires Carnivore Library for Processing v1.3 (http://rhizome.org/carnivore) (needs winpcap)


import rsg.carnivore.*;
int count3 = 0;
float tempx;
float tempy;
float tempz;
String packettext;
String look = "nextthree";

void setup(){
size(625, 625);
background(255);
Carnivore c = new Carnivore(this);
}

void draw(){

}


void packetEvent(CarniPacket packet){ // Called each time a new packet arrives

packettext = packet.ascii;
int stringlength = packettext.length();

if (stringlength < 19){

String list[] = split(packettext);
//println(list[0]);

if(list[0].equals(look) == true) { //wait for the first signal...
println("here");
count3 = 1;
}else{
if (count3 == 1){
tempx = float(list[0]);
count3 = 2;
println("x = " + tempx);
}else{
if (count3 == 2){
tempy = float(list[0]);
count3 = 3;
println("y = " + tempy);
}else{
if (count3 == 3){
tempz = float(list[0]);
count3 = 0;
println("z = " + tempz);
}
}
}
} //end if else madness

}//end if string length

}//end packetevent

Monday, May 22, 2006

much has happened since my last posts.

Firstly I have fully decided on what Im going to do for FACT.
UT will be played by the bots as usual, their positions will be logged and sent to a "dance floor" a real life one. 6 by 6 (cuz I cant afford more).

This is the processing pic of essentially the top down view of the dancefloor.



So yeah, people will be able to walk over the floor and where they walk the bots beneath them will die.
Its kinda like a really advanced version of whack attack (or similar games)



To make the cull in Unreal I had to write a new mutator that would accept 36 different (6 by 6) keypresses and drop a kill volume on top of anyones head in the correct vacinity.





okay, so I know I havent explained this well. But it will all make sense soon...

Here is a link to the processing code (its overly complex at the mo because Im going to need to do some madness to it a little later on... the live reading of the game)

Here is a link to me asking for help on the Unreal script forums... (Ill include the actual finished mutator and stuff in good time)

Tuesday, May 16, 2006

A few things I have learnt today about Unreals AI and bots.

They sound obvious but are very important to me:
"In general, a bot will choose the shortest route to his destination, except for sometimes choosing to go through an alternate path in CTF, or avoiding paths were many bots have died."

It was as I suspected. However what if the bot has no destination, will it then choose the shortest path to nowhere?

I did a quick experiment today and discovered 2 important things. Heres a little pic of the map my poor guinea pig ran through. (there was no escaping death... at the end of each path it would die and respawn again in the middle)



With no obvious destination the bot will choose a random direction to run in regardless of path length.

After roughly 65 deaths the bot "wises up" and "hesitates" about which way to go, it will wait where it spawned for a time then it will fall into a repeating pattern, according to the last 3 deaths that occured before the wait.
r=right
l=left
u=up

eg. u,u,l,r,u,r,r,u,r,l,Wait,u,r,l,Wait,u,r,l,Wait,u,r,l,Wait ... etc.

So, why do I care? I dont know yet, but I have a feeling this is going to be important.

Im going to have to write all this down or I will forget all of it.

I was working today on a way for UT to accept input from processing.
I completely failed when I was thinking about it like that, but obviously the keyboard will send information to whoevers listening (both processing and unreal).

So what I had to do was to make UT understand that a certain key had been pressed and do something about it.
This was difficult, I found numerous things online to help, me but it took forever for me to get it all together.

So for the benefit of anyone whos interested.
Here is a link to the files, drop them in your UT2004 system folder and you will be able to access the mutator from within the game its called "interaction creator"

When the mutator is running it will tell you via the text chat area which key youve just pressed and released.

It was made by following these very clever (but hard to follow for a beginner) semi-tutorial thingys.
So thank you someone called Will for helping me inadvertantly.

I am now working on making UT act upon certain key presses and make things move.

Monday, May 15, 2006

A pleasent wee bit o code. To change the grid size easily.


int gridsize=15; ///////////////////change this number to change the grid size

float stage= 625.0;
float gridadd=stage/gridsize;
float currenty = 0.0;
float currentx =0.0;

size(int(stage),int(stage));
background(255);
stroke(0);

for(int i=0;i<=gridsize;i++){
currentx=currentx+gridadd;
line(0,currentx,stage,currentx);
}

for(int i=0;i<=gridsize;i++){
currenty=currenty+gridadd;
line(currenty,0,currenty,stage);
}


flickr pic has a pic of how the grid was used... its going to make a physical thing move... arduino is now ordered

Wednesday, May 03, 2006

scuse the absence Ive been busy.

Im currently writing a paper for the people at Ylem.
About my project (but secretly about "art games" and what I think about the whole thing).
Im also working on some physical computing stuff with processing (for those crazy FACT people)... which should be on here at some point.

I also have to properly think about this whole mphil/phd thing... as in Im doing one and I need supervisors.
so if any of you happen to be in the field of AI, games, art, or copyright law then feel free to contact me and be my supervisor (or even just advisor!). There might be a free trip to Huddersfield in it for you.

What else am I up to... thats about it. oh yeah, got to go to the tip and finally be rid of my old desk.

Sunday, April 02, 2006



The end has come... pictures of my bit of the show are here. At some point Iman will put up pictures of all the other parts of the exhibition.