Friday, November 21, 2014
Surface Pro 3 and Unity for Windows Store
So far I spent a lot of time getting Unity and Visual Studio connected together using UnityVS. Not that I don't think Mono Develop isn't good enough, I do like that, but for some reason I'm drawn to Windows Store app development and need to use VS to build Unity apps for Windows Store.
It isn't well documented, but don't try to use Visual Studio Express with UnityVS. It won't give you an error, but will only have a message that it can't find Visual Studio. You have to install Visual Studio Pro to work with UnityVS. I'm now running a 90 day trial and everything is working, but will have to write quick and decide if I want to upgrade my older version of Visual Studio Pro. I spent a lot of time uninstalling and reinstalling UnityVS to get this to work. Many messages from Visual Studio that the project type wasn't recognized. Once I installed Visual Studio Pro it still had the same message and I reinstalled UnityVS and everything worked well.
Another thing that led me in this direcetion was trying to figure out how to debug the touch screen interface in my Unity game. This seems like it will work well. In Unity, you have to Build the solution for the Windows Store application which will create a new folder with a Visual Studio Windows Store project. This has the C# scripts linked in it so you can debug and change those directly and debug your Windows Store application directly. I could have done something similar and connected my Android tablet directly to Unity and ADB debugged on hardware, but this seems like a better way and I will be using that.
Tuesday, May 27, 2014
Datacap Documentation
It took a while to get used to Datacap and I highly recommend getting some training as the learning curve will go a lot faster. Here are the best places to find Datacap documentation.
First, don't think this is clever. Simply do a google search for Datacap Documentation.
The publication library is the first stop.
http://www-01.ibm.com/support/docview.wss?uid=swg27035774
Scroll down to the PDF documentation. The best place to start for building Datacap applications is the Application Development using IBM Datacap Taskmaster. I still spend a lot of time in that document.
The second place is the official infocenter documentation.
http://pic.dhe.ibm.com/infocenter/datacap/v8r1m0/index.jsp
The third place is the Proof Of Technology. There is a lab book that goes with the Proof Of Technology the sales teams use. This has great walk-throughs of the various tasks and can be very helpful to see how to do different tasks.
The fourth place is Developer Works. There are great samples on many Datacap capabilities.
http://www.ibm.com/developerworks/data/library/techarticle/dm-ind-datacap-taskmaster/
Friday, May 24, 2013
Unity Ray debugging
Oh, this is a cool one I just noticed that again shows me the developer of Unity knows what they were doing.
function Update () {
var ray : Ray = camera.ScreenPointToRay (Vector3(200,200,0));
Debug.DrawRay (ray.origin, ray.direction * 10, Color.yellow);
}
How many times have I struggled to see where a ray or vector is doing in my game and written a ton of debug code (yes I did this with XNA) to draw a line where a ray was. Unity gives me this as a simple Debug call. Thank you thank you thank you.
Thursday, May 23, 2013
Learning Unity
Yeah, just what I need is another technology to learn. After a few years of teaching XNA (before that Torque, before that Java, before that J2ME and somewhere in there a quick detour for Second Life/LSL) it seems like the world is shifting around me again. I did some quick Android apps last year, but still wanted another layer above me to allow me to release on multiple platforms. Unity keeps coming up in conversation and after a few quick tutorials and calls with a good friend who already climbed the learning curve I seem to be picking it up quickly. I had to drop it again for a few months as I got busy, but found some time recently to dig in again. So far pure joy. I've found a tool that was programmed by someone who understands.
A couple of really small things have made me really appreciate the person who created Unity. Meaning it's really well designed.
This guy gets it.
http://docs.unity3d.com/Documentation/ScriptReference/Mathf.Deg2Rad.html
This guy was an intern (as was most of the DirectX/XNA code base in my opinion).
http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.mathhelper.toradians.aspx
float deg = MathHelper.ToRadians((float) 1.0);
When this most definitely doesn't have any extra over head. (there might be an offset instruction for the Mathf. part, but not a (possibly) full stack frame creation).
float deg = 1.0 * Mathf.DegToRad;
This and a couple of other small things, like the ability to create/change a model in Blender (free) and have it automatically be updated in my game is a huge bonus. I love Blender and have struggled to use it with every game engine and with unity it's automatic. That's huge. I can use 3ds max fairly well, but that expensive license every year for the simple stuff I build just isn't affordable.Anyway, loving Unity after a few weeks of working with it. Have a fun little game mechanic coming along.
Wednesday, September 5, 2012
Android - Full Screen
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
Tuesday, September 4, 2012
Learning Android - Audio Volume Control
The first app I built had an issue that the audio controls on the device wouldn't work unless a sound was actually playing. Found a really simple work around.
Add this call to the onCreate method in the activity.
setVolumeControlStream(AudioManager.STREAM_MUSIC);
Wednesday, September 1, 2010
Second Life Game Tile Testing

This is the code in the init script in the table.
default
{
state_entry()
{
//list bb = llGetBoundingBox(llGetKey()); // get my bounding box
vector sz = llList2Vector(llGetPrimitiveParams([PRIM_SIZE]),0);
llMessageLinked(LINK_ALL_OTHERS,1,(string)sz,NULL_KEY);
}
touch_start(integer total_number)
{
//llSay(0, "Touched.");
llSay(1024,"move");
}
}
You might as why did I comment out llGetBoundingBox. The reason is it works great when the table is by itself, but once the piece is on the table, the piece's location is included in the bounding box. This makes the box larger than expected.
So, the script get's the actual prim size from the table top and passes it to all the other linked objects (in this case the "disc" using a linked message. The identifier of the message is the number "1" which in this case means "table size", and the size (vector) is passed as a string.
You can also see that when the table is touched, it says "move" on channel 1024 which you can guess that the "disc" is listening for. Why not use llMessageLinked for both communications? We'll I should, but the "move" message was added early on and I started using linked messages later and have to get back to change to use llMessageLinked.
This is the code for the disc
vector mysize;
vector mysizediv2;
vector tablesize;
vector min;
vector max;
integer posMinOrMax;
default
{
state_entry()
{
//list bb = llGetBoundingBox(llGetLinkKey(1)); // get the bounding box of the table
//max = llList2Vector(bb, 1); // max corner
//min = llList2Vector(bb, 0); // min corner
//min = >min.x,min.y,max.z<;
//llWhisper(0,(string)min+" "+(string)max);
posMinOrMax = 0;
llListen(1024,"",llGetLinkKey(1),"move");
}
listen( integer channel, string name, key id, string message )
{
if (channel==1024)
{
if (posMinOrMax==0)
{
llSetPos(max);
//llWhisper( 0, "max" );
}
else
{
llSetPos(min);
//llWhisper( 0, "min" );
}
posMinOrMax = 1 - posMinOrMax;
}
}
link_message(integer sender_num, integer num, string str, key id)
{
if (num==1)
{
mysize = llList2Vector(llGetPrimitiveParams([PRIM_SIZE]),0);
mysizediv2 = mysize / 2;
mysizediv2.z = 0.0;
tablesize = (vector) str;
llWhisper(0,"got size = "+(string)tablesize);
vector sz = tablesize / 2;
min = >-sz.x,-sz.y,sz.z*2< + mysizediv2;
max = >sz.x,sz.y,sz.z*2< - mysizediv2;
}
}
}
You can see that early on I calculated the min and max positions based on the bounding box which I have already said is wrong. On the listen channel when I hear "move" I toggle the position between the min and max. That should be pretty straight forward.
The interesting stuff is in the link_message function. I first get the size of the "disc" using the llGetPrimitiveParams call. All positioning is done from the center of the object, so if I use the absolute min and max sizes of the table then the disc will hang off the edge. I divide the size by two because that is how far I have to inset the position from the table's min and max.
I then convert the table size vector from the string that was passed on the link message back to a vector and calculate the min and max positions using the inset of half the disc size. The min adds half the disc size and the max subtracts. The other thing is that the table's origin is at the center, and positioning the disc has to take that into account. So the min is the table position (center) subtracting half the size of the table. The max is the table position (center) and adding half the table size.
Wednesday, August 25, 2010
So I did some testing with llSetTextureAnim and I couldn't get the same results. When you use ROTATE in llSetTextureAnim then you can't specify the texture offset, only which portion of the texture you want to use. It seems like it is used to have a tiled texture where each section of the tile can be used as an individual tile. In my case, I used a half transparent texture and am rotating that around the sphere. Using llSetTextureAnim I don't see a way to get the same effect. I'm a little slow most of the time so I may be missing something. Here is a screen shot of using
default
{ state_entry()
{
llSetTextureAnim(ANIM_ON | LOOP | SMOOTH | ROTATE,ALL_SIDES, 1,1, 0, TWO_PI, TWO_PI/360);
}
}

I also tried using a non-ROTATE texture animation which only cause the texture to turn on and off when the "tile" reached the non-transparent section.
I really like the idea of reducing bandwidth by having the texture changes run on each client, but don't see a way to get this to work for this sculpture. llSetTextureAnim is definitely a good tool for the tool belt and I'll have to consider some sort of sculpture using a tiled texture. That would mean that each client would see something different on their machine so there couldn't be a discussion about the "current" look of the sculpture between two people, but I'm not sure that's a real problem.
Wednesday, August 18, 2010
Sensor land detection
sensor( integer number_detected )
{
integer i;
for( i = 0; i < detpos =" llDetectedPos(" k =" llGetLandOwnerAt(detpos);" k ="="" k = "+(string)k); // } //} if ( (llDetectedKey( i ) != llGetOwner()) && (k != ">
Tuesday, August 17, 2010
Moon Phase Second Life Sculpture

Monday, August 16, 2010
Beyond Facebook - designing outside the box
Wednesday, August 11, 2010
lsl - Giving a notecard
default
{
state_entry()
{
}
touch_start(integer total_number)
{
llGiveInventory(llDetectedKey(0), "Light Hand Sculpture - notecard");
}
}

Tuesday, August 10, 2010
Traded land
Monday, August 17, 2009
Class preparation
I'm a blender fan, but I really need to train people on 3dsMax. I purchased an edu copy a year ago (still way to expensive) and I'm finally forcing myself to use it. I've been going through the tutorials and think it will be a good way to learn max. I also need to get through all the skeleton animation stuff so I know how to do it in Max. I've done it with Blender, but for this class I really need to use the tools that we have on the computers in class.
It starts in two weeks. I have a ton of material so far, but there is still a lot to go over.
I also went back and looked at the pinball game in second life and I have been itching to do some more work on it. I finally think I know how to fix the bumper mechanic and add a little skill to the game. Too much going on at this point, but hopefully the idea can slowly rise to the top of the queue and I can do some more work in SL since I enjoy that environment.
Tuesday, July 21, 2009
GameDev360 website updated
I also had to pick a book for the class. This is the book I'm going to use. I doesn't have anything to do on engine development, so I'll be teaching that part without a book.
Monday, July 20, 2009
CPSC340 Game Development
The class is on Game Engine Development. My plan so far is to use XNA and C#. I had wanted to use Torque/C++, but the XNA/C# stuff has made some sense and we have been going in that direction. I still want to get in some C++ work and I'm trying to figure out how to do that at this point.
The open source engine is going to be called Panther Game Engine. I've already setup a source forge project for it and have been slowly configuring the group. I still have about 6 weeks, but that doesn't feel like much time.
I've completed all the SVN setup and have my lecture for that planned. I still want to create a screen cast of the process so it will be even clearer.
The term "Game Engine" is heavlily loaded and not well defined. For me, it's all about tools to make building games easier. So, I've been creating the shell of a level editor for xna. The toughest part was integrating XNA and Windows Forms. I have that working and ended up using a piece of Microsoft sample code and have tried to segment it from the open source project as best I could. This really should be part of the XNA release and not some separate set of code, but at least there is a sample of how to do this.
Next up is working on a terrain system, then I want to get the animation work flow down. Lots to do.
Monday, June 29, 2009
Project 2015
We need to create a development plan to use on any grant requests so we can show what any grant money would be used for. This is also necessary in developing the game. I have started on this and a business plan for the game. My regular work is coming into a dead line so I think the next month will be insane so I don't think I will get very far on this. I'll continue to work on it when I have extra time.
Wednesday, June 10, 2009
Imagine Cup Results
My goal is to somehow continue development on it and finish creating a training tool for people planning on working in impoverished communities. I'm not sure how to get that done, but I've planned a couple of meetings with some of my contacts in the game industry to see what people have to say.
Monday, May 18, 2009
Imagine Cup
My work got really busy and I've been mentoring a team creating a game for the Imagine Cup. Never expected it, but all those trips to Africa doing community development have been helpful in building a game that is designed to help work on the United Nations Millennium Development Goals.
The team is in the final week (two days) of development and everything is coming along. I think this is one of the most interesting projects I have worked on in years and really follows closely the work in Africa I (my wife and a lot of good friends) have been involved with over the past five years. When we started the team we were looking at a different contest and the Imagine Cup came along after that contest was delayed. Very cool to see the fruits of many years of labor multiplying into completely new avenues of opportunity.
The game is called Project 2015. The Project 2015 website is currently a month and a half old and used for the first submission. I expect it to be updated in the next week. Stay tuned.
Friday, April 10, 2009
Testing some shading options
(http://store.payloadz.com/go?id=254377).
I’ve been testing some shading options and working on the 3D aspects of XNA that I have been needing to learn. One of the problems is that I have 3DStudioMax, but it is only on a machine I don’t use as much. I’ve been contemplating moving the license, but that has issues. I’ve used Blender in the past and have enough knowledge to be dangerous to myself, but went back to it as I have not been able to use Max when I need it. So, this was as much a Blender session as an XNA lighting session.
I’m using Reimer Grootjan’s book XNA 2.0 Game Programming Recipes
The section I used was on directional lighting on page 514. It shows how to get the BasicEffect to work with a directional light.
My code looked like this when I was done.
effect.LightingEnabled = true;With, specPower and light0Pos set at the top of the class definition.
effect.DirectionalLight0.Direction = light0Pos;
effect.DirectionalLight0.DiffuseColor = Color.White.ToVector3();
effect.DirectionalLight0.Enabled = true;
effect.PreferPerPixelLighting = false;
effect.DirectionalLight0.SpecularColor = Color.White.ToVector3();
effect.SpecularPower = specPower;
Vector3 light0Pos = new Vector3(-0.5f, -1.0f, 0.0f);After weeks of procrastination and thinking I was going to have to create a custom shader it was nice to find out that adding a directional light was very simple. One of the games I was going to do requires a spotlight and I do think that will require a custom shader so it's off the list until I get some extra time.
float specPower = 64;
So, first up with Blender. I’m trying to display a gemstone. I created a isosphere then scaled and stretched it to look like a gem stone. Then I added a red texture. You can see that I set the Col (Color), Spe (Specular Color) and the Mir (Mirror Color) for the gem.
This was fine, except that the gem came out all smooth.
I know from experience that this is caused by the rendering system using vertex normals to draw the individual triangles of the gem as smoothly as possible. This is almost always the case. But for a gemstone, you want it to have facets. I spent a ton of time trying to figure out how to get blender to remove the vertex normals and only use surface normals.
This ended up being easy inside of blender, but took a while to figure out how to get this information into the direct X file. To do this in blender, you select the object in edit mode, then click the Set Smooth button to use vertex normals for rendering and Set Solid to use surface normals for rendering.Easy and you can see the two rendered versions here.
That’s all well and good in Blender rendering, but XNA kept displaying the gem as a smooth surface. After tons of fiddling, I noticed one of the options on the Blender DirectX exporter was “no smooth”. The tool tip says exactly what I wanted to hear “Every vertex has the face normal, no smoothing”.
Once I exported with that setting everything worked.

Getting back to Blender, I found it really hard to learn, and hard to relearn, but for the price (Free) it really is an amazing tool. I have a book on it that I've barely touched called Introducing Character Animation with Blender by Tony Mullen
My real problem with Blender came in the classes I was teaching on Torque last year and the fact that we could never get the bone systems to work properly. It seemed that 3DSMax was the only real way to do modeling for Torque. Maybe that has changed?
I did find this great reference image on the Blender hotkeys (http://en.wikibooks.org/wiki/File:BlenderHotkeysObjectMode.png. If you are going to use Blender, you are going to want to learn as many as possible. It really is a fast fast tool once you get to know the UI. Mostly I only use Space Bar, B (box select), A (select/deselect all), S (scale), R (rotate X,Y,Z).
(http://store.payloadz.com/go?id=254377).
Wednesday, April 1, 2009
Balance Air Game
The game is called Balance Air. You have a hair dryer at the bottom of the screen and you need to balance the ball on air and force it into the goal. You move the blower left or right to change the direction of the ball. There are 7 levels which are basically just different locations for the goal. The score for each goal is dropping over time.
As I did last time you can download a free executable of the game. It is available here: http://www.woodsgoods.com/gawxna/02balanceair.
The complete source and Visual Studio project is available for $5 at http://store.payloadz.com/go?id=246205 .
Enjoy and please give me some feedback.
Wednesday, March 25, 2009
Skeet Slider game
The game is called Skeet Slider. Not my best by far, but much better than the past few weeks while I've been learning the XNA framework. You slide a puck across the bottom of the screen trying to avoid bouncing blocks. It's all about timing. I wanted to add a feature to change the velocity of the puck, but I'm out of time. Here is a screen shot of the game on level 4, the highest level. I spent a little time at the end to add better art for the game so it is cleaner that what I've written in XNA so far.
I also messed with the publish system in XNA Game Studio 3.0 and created an installer you can use to run the game. It is available here: http://www.woodsgoods.com/gawxna/01skeetslider.
I have also been considering offering the source code to some of these games to try and cover some of my time. It's a minimal $5 to purchase the C# source code to the Skeet Slider XNA Game. Please tell me if you think this is reasonable or not? I could really use some feedback.
Wednesday, March 18, 2009
SpinMag game
This is a screen shot of the game.

This is the map image. Each pixel represents the location of one of the 3d spheres.
Here is the code that reads the map image and converts it to 3d objects.
protected void LoadMap(String mapname)
{
// the map is just an image file with pixels of various colors
// red = barrier
// black = open space
// cyan = closed space
// green = starting point
Texture2D map1 = content.Load<Texture2D>(mapname);
mapwid = map1.Width;
maphei = map1.Height;
int numpix = mapwid*maphei;
if ((map == null) (map.Length < numpix))
{
map = new byte[numpix];
}
// want this map to fit over the circle, so calculate the size of each ball
// scale of the ball
mapballsz = (int)(maxballdist*2) / mapwid;
mapxstart = -(mapwid / 2-1) * mapballsz;
mapystart = -(maphei / 2-1) * mapballsz;
/*
* the sample I used to write this method
* ms-help://MS.VSCC.v90/MS.VSIPCC.v90/MS.XNAGS30.1033/XNA/GetData``1_B8CC1053 */
Rectangle sourceRectangle = new Rectangle(0, 0, mapwid, maphei);
Color[] retrievedColor = new Color[numpix];
map1.GetData<Color>(
0,
sourceRectangle,
retrievedColor,
0,
numpix);
goalcount = 0;
int i;
for (i = 0; i < numpix; i++)
{
if (retrievedColor[i] == Color.Cyan)
{
map[i] = MAP_CLOSED;
}
else if (retrievedColor[i] == Color.Red)
{
map[i] = MAP_BAR;
}
else if (retrievedColor[i] == Color.Blue)
{
map[i] = MAP_GOAL;
goalcount++;
}
else
{
map[i] = MAP_OPEN;
}
}
}
Wednesday, March 11, 2009
SpinDart
It isn't what I started out to make and I may make a different game with this same mechanic next week. Locking the z axis and making this a 2d game helped the time constraints some, but I would like to be able to get that third axis in a week long game cycle.
The game is a "gravity" style game which is one of my favorites. Impossible to control which means the mechanic doesn't really work, but I'm not 100% sure it is impossible to control. Given a shared high score system I think I would see some different approaches to making points, but alas I haven't written the shared high score system yet...

Here is a code snipet that does the collision checking. I didn't use the XNA system which I looked into a little and decided it was easier to write this simplified code.
private void checkCollision()
{
// check the position of the ball with that of the spinner
Vector3 vspin; // = Vector3.Backward; // pointed up
Matrix m = Matrix.CreateRotationY(spinnerRot);
vspin = Vector3.Transform(Vector3.Forward, m);
// I know the spinner is 7.2 units before scaling (looking in milkshape)
vspin = vspin * 7.42f * scaleXY;
// now check the position of the ball in z space
if ((ballPos.Length()>vspin.Length()+ballradius) && (distToOriginLineXZ(ballPos, vspin) < ballradius))
{
// collision
// wwh score or death?
score = score + 1;
}
// check if we are inside the center of the spinner
// spinner sphere radius = 2
if (ballPos.Length() < 2 * scaleXY + ballradius)
{
// wwh score or death?
mode = STATE_OVER;
if (score > highscore)
score = highscore;
//score = score + 1;
}
}
private float distToOriginLineXZ(Vector3 pt, Vector3 oline)
{
// used this reference
// http://local.wasp.uwa.edu.au/~pbourke/geometry/pointline/
// p1 = 0.0,0.0
// p2 = oline.x,oline.z
// p3 = pt.x,pt.z
// oline is a line from the origin
Vector3 vi = Vector3.Zero;
float u = ((pt.X - 0.0f) * (oline.X - 0.0f) + (pt.Z - 0.0f) * (oline.Z - 0.0f)) / (oline.Length()*oline.Length());
vi.X = u * (oline.X);
vi.Z = u * (oline.Z);
pt = pt - vi;
return pt.Length();
}
Wednesday, March 4, 2009
Sphere Pong

// move the paddle using the upVector (true) or the cross product of the origin and up (false)
// direction is a + or - 1 for up, down, left or right
private void movePaddle(bool usingUpVector, float dir)
{
if (!usingUpVector)
{
// need to take the cross between the up and the origin
Vector3 vp = paddlePos;
vp.Normalize();
// vector change
Vector3 vc = Vector3.Cross(vp, paddleUp) * dir;
vc.Normalize();
vc = vc * paddleSpeed;
// find the new location, will be outside the sphere
vp = paddlePos + vc;
// fix up the distance ot the sphere
vp.Normalize();
vp = vp * radius;
paddlePos = vp;
// the up vector should not have changed, right?
// move the camera behind the puck
fixupCamera();
}
else
{
// for this case, take the cross product
// move in the direction of the up vector (+ or -)
// position against the spehere
// use the cross product to calculate the new up vector
}
}