Monday, January 19, 2015

Unity 2D Tutorials

These tutorials on the new Unity 2D features have been very helpful.

http://unity3d.com/learn/tutorials/modules/beginner/2d/2d-overview

http://unity3d.com/learn/tutorials/modules/beginner/2d/2d-overview

Thursday, January 15, 2015

Bing rewards

I've recently switched to Bing as my search engine.  I tried it because they have a rewards program and after a few months I really don't see any difference.

Try Bing rewards, it makes search just a little more fun.

Bing rewards is running a 1,000,000 reward points give away. Sign up here.

Wednesday, January 14, 2015

Unity script referencing



I wanted my keyboard input script to retrieve a value from a grid generator script so it knew how far to move one of my game objects. It took me a while to figure it out even though it's simple so I figure it's best to leave myself a bread crumb so I don't have to search so much next time.

//this is how you get a reference and value out of another script
scriptholder = GameObject.Find("EmptyScriptHolder");
GridManager script = scriptholder.GetComponent<GridManager>();
print("Grid gap =" + script.stepsize);


This shows how to get a reference to the actual script, in this case it's my EmptyObject I use to hold scripts that are not associated with actual GameObjects.  I call it EmptyScriptHolder.  I then get the reference to the GridManager script.  This is the actual type name of the script.  Within that script is a method variable called stepsize.  Overall it's very simple to get a value out of another script once you know how to do it.

This site was very helpful even though it's documentation from a few versions back.
http://docs.unity3d.com/412/Documentation/ScriptReference/index.Accessing_Other_Game_Objects.html

Tuesday, January 13, 2015

Hexagon grids

I'm not building a game that uses a hexagond grid right now, but have done it before and thinking about what it takes and found this great hexagon algorithm resource.

http://www.redblobgames.com/grids/hexagons/

Thursday, November 27, 2014

Unity touch debugging

I mentioned this in an earlier post, but thought I would go into more detail. I think this is  a great solution for testing touch input with Unity.

http://docs.unity3d.com/ScriptReference/Input.GetTouch.html

I'm using Visual Studio Pro 2013 to do this and I don't see a way to do it with Mono.  The only other way I've found is to use an actual device and connect a debugger to the device. This way I've found allows me to simply run a Visual Studio project directly on my touch device/development environment and test my touch code.

The first thing is to Build the project using File/Build and Run

 

 Select Windows Store app and then click Build or Build and Run.

 
The default location is to use the winout directory in the current Unity project. This worked well for me so I just used the default.
 
 
This creates a .sln file in that winout directory with all the necessary Visual Studio project files. Simply double click on the .sln file to launch Visual Studio Pro 2013.
 
 
 
I tested the project and one really nice thing is that the .cs files associated with behaviors in my project are actually linked back to the same files in my Unity project. So after making changes, they are already in my Unity project and I don't have to copy them back.
 
 
 
One thing to note is that this is only for script debugging. If I want to make changes to my layout or the models I've laid out in my Scene I will have to close Visual Studio, return to Unity to make the changes, then rebuild the winout project to work on my scripts again.  It's a small thing and this is still a much easier way to debug touch input than anything I've had to do before.

 

 

 

Wednesday, November 26, 2014

Surface Pro3 Print Screen Button

I usually use SnagIt to great effect and it is a primary tool for me.  I haven't installed it on my Surface yet and I was trying to figure out how to do a screen capture without it.  There isn't a Print Screen button.  The trick is pretty easy though. Press Fn-Space bar to capture the screen and Fn-Alt-Space to capture the active window.

http://answers.microsoft.com/en-us/surface/forum/surfpro-surfusingpro/print-screen/1aa98224-dacb-4770-863e-7e1fc77f9ac1

Tuesday, November 25, 2014

Blender UV Mapping

I have a love hate relationship with Blender.  Love that it's free and super powerful. Hate that I have to relearn how to do simple stuff every time I step away from it for a few months.  I will say that this time, the tenth that I've created a UV map on a mesh has been the easiest.

This site documentation really helped and even though I'm using 2.72b, and the documentation is for 2.6 it didn't seem to matter.

http://wiki.blender.org/index.php/Doc:2.6/Manual/Textures/Mapping/UV/Unwrapping

It might not seem like a lot, but this will be a good test model for the game mechanic I'm building.

 
This is the actual texture.

Friday, November 21, 2014

Surface Pro 3 and Unity for Windows Store

Recently received a Surface Pro 3 as a gift and really love it.  Was using a 5 year old Toshiba that was limping along even with the 128GB SSD. The SSD made it viable for quite a while, but it was really getting behind. Enjoying the new Surface. First loaded Unity and Visual Studio Express 2013.  It seems like I can finally develop on an airplane even if the seat in front of me is reclined and I'm next to a 300 pounded.  The laptop was just too bulky to use when someone was sitting next to me.

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

I know this blog has been all about game development for many years, but my day job at IBM has been to create applications with Datacap so I'm going to add some Datacap posts.

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

This will cause some arguments, but why create a function/method (XNA),

float deg = MathHelper.ToRadians((float) 1.0);

and I don't know for sure that C# does create a stack frame or not for this call, but why even chance it.  I know it's only a few extra instructions and one extra push onto the stack (if that's what it does), but if I run that a lot it's bound to do a little extra processing that I might not want to have on a slower/older device. I grew up with limited memory and CPU so I still know that every instruction is still a percentage of your maximum throughput. The less you use, the more you can do. For short, every single instruction still counts.

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

I was putting some finishing touches onto a new little ap for my 2 year old and needed to make it full screen. This is what I ended up using.  Edit the AndroidManifest.xml file and change the android:theme line to this.

        android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

Tuesday, September 4, 2012

Learning Android - Audio Volume Control

I've been spending some time learning to program using Android.  It's been on my list for a long time and I'm going slow and building fun little things for my 2 year old. Nothing commercial, just something for him to enjoy.

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);

Pretty simple little fix.

Wednesday, September 1, 2010

Second Life Game Tile Testing


I've been messing around with game tile systems again using second life. Looking at the rudiments of a table top game like checkers, chess or even something as complex as monopoly. Trying to figure out how to develop something that doesn't use physics, but uses a tile based movement system.

I started by building a blank table top and adding a piece to it. Right now, the piece simply moves from corner to corner when someone clicks on the table. Under the hood there is a lot more going on than you might first think.



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


I had a discussion with another developer about the moonphase virtual sculpture. They mentioned a technique that might improve bandwidth usage by using llSetTextureAnim instead of setting the offset of the texture directly. The idea being that llSetTextureAnim would be running on the actual client which doesn't require any bandwidth, while llOffsetTexture is run on the server and all the clients viewing that object need to receive a message that the object change.

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

I recently moved lands and my new neighbor asked if I could turn of my sensor that greeted visitors. I guess it was going off when people were visiting their land.

I first detected the location of the Agent who tripped the sensor. Then get the land owner key at that location. It's hard to tell what that key is so I wrote code to print that out if the sensor detected me, then went into my neighbor's land. Then took that number and hard coded it into the welcome message. Now the sensor will only greet someone if they are on a different land than my neighbors.

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

I've been working on an art gallery for an internal company sim and also building a couple of small sculptures for it as well. I built this one in the internal sim, then recreated it and improved it in SecondLife. It is a number of concentric rotating half-spheres that also change color.


"moon phase"
Virtual Second Life Sculpture

Monday, August 16, 2010

Beyond Facebook - designing outside the box

Beyond Facebook. - Design Outside The Box.

This is a great presentation on a huge transition that is happening in the game industry and gives a peak on how you can use psychological gaming techniques in everyday interfaces to improve the user experience. The presenter is Jesse Schnell from Carnegie Mellon University. I played this for my class last semester and recently watched it again. There is definitely a lot of good information in here.

Wednesday, August 11, 2010

lsl - Giving a notecard


I was wading back into the Second Life waters after volunteering to help build an art gallery for a group at work. I was also working on a couple of sculptures.

One of the things I wanted to add was to have my object give a notecard to someone who clicked on it.

This was simple.
First. Create a new notecard in your inventory.
Drag it into the content of the object you want to give that notecard.
Let's say it's called "Light Hand Sculpture - notecard"

Add this script and it will give the notecard to someone who clicks on your object.

default
{
state_entry()
{
}
touch_start(integer total_number)
{
llGiveInventory(llDetectedKey(0), "Light Hand Sculpture - notecard");

}
}


Here is the sculpture I was working on. It is on a private sim so I can't give you a link to see it. Sorry.


"Light Hand"

Tuesday, August 10, 2010

Traded land

The land I was using had all the land around it purchased by one person who was trying to create a cohesive sim. I was the last hold out and not because I was being stubborn, I just haven't logged on for a long time because I've been focused on XNA. I agreed to trade the land for something comparable. It turned out this was pretty simple for her to find and I traded my land.

New location:

Monday, August 17, 2009

Class preparation

I've been putting all my extra time into a class I will be teaching at Chapman University next semester. We'll be using XNA and C# to build an open source game engine. I have the project all setup, the training and managment of subversion is ready and I have a pretty good outline and a good direction for the engine. I've done a few games using XNA, but for the tool side needed to figure out the WinForms integration and found these microsoft sites on WinForms/XNA to be very helpful.

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've updated the GameDev360 website for the class. I have it on local disk so not much to show. I'm planning on mostly using the open source project on source forge for the class, but I still needed some place for the syllabus and class overview.

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.



I also like these books a lot and will be using them as a resource. The second one doesn't have anything to do with XNA, but it has a lot of good ideas about game engines.


  

Monday, July 20, 2009

CPSC340 Game Development

I've been working on both Project2015 and a class I am teaching this fall. The Project2015 stuff is going very slow and has seemingly lost a ton of momentum. Work has had a tough deadline and this looming class I'm teaching is starting to consume my extra time as I prepare.

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

I've had a few meetings about the Imagine Cup game. It seems like the best option would be to develop the game under some sort of non-profit. We would finish the game by trying to get grants or just using free time, then launch it on something like Xbox live or as a pure PC game. Take the "profits" and turn them back seed funding to continue the work on the game and to build other humanitarian interest games. That is the plan.

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

We learned that we did not make the finals for the Imagine Cup. Most of the games that were selected seemed to whitewash the Millenium goals and I do think that our game, given more development, could help make a big difference in people's lives.

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.