May 05

Comet Turret and Transium

Tried to simulate the rover hugging of PV.

Added Transium. I’m planning to design a 1mx1m box collider around it that when entered, causes a hit to happen on the transium that sees if the unit can pick it up or not. What if a rover with a ghost driving it picks it up? My plan: Not let it add TU. Only as an avatar or a mule/leech.

Also added Comet Turret. I still have some inheritance challenges I’d love to resolve, however networking has been that ugly interface I still want to incorporate properly. As my artist gives me models, I can’t resist the urge to put it in, since it gives the appearance the project is progressing more (since code is hard to track).

May 04

Behemoth

added behemoth. Still doing lots of internal (less easy to show) code.

The hard part about the behemoth is that it’s our first walker, so I need to sit down and get it animated.

We used this for conceptualizing.

Apr 30

Project Visitor catch up post.

Originally I was posting my updates here, and I still plan to, but they have an image limit and I tend to spam it so I’m going to use this for progress updates too!

Here’s my past updates:
4/14

4/15

4/16
Added Tain/Jitter (it makes sounds and animates all cool like.

and MASC, and got some textures in.

4/17
Mainly networking stuff, got basic client/server interactions, movement. Got MASC textured. HOD was also textured, but had some importing issues, so here’s a fast render in maya.:)

4/18
Spent more time with networking, but took a break to muck with HOD.. put efforts in recreating the original HOD.. I think it looks pretty decent!

4/19
Bumpmapping/specular shaders, real basic prototype.

4/20
Worked more on multiplayer, positioning, rotation. (Never done Unity/Windows Networking before, so a lot of learning)

4/21
Here’s the first network attempt, Visiter was nice enough to try it out with me.

Guns shooting, corp respect, respawning, network sync, etc.

Added basic login UI

4/22
Did some more networking testing, and R&D for extrapolating solutions

4/23
Did some avatar physics tweaks, added ridigbodies instead of character colliders.
Also started writing a rover calculator in php to help me understand internal values better (and be helpful to others)

4/30
Added Dreadnaught/Maelstrom

First building: Added Rover Yard (not skinned yet, and not scaled properly)

Sep 21

Code-Based Perlin Terrain Generator (with List container) Inside Unity

This is pretty special case, but I needed to generate 2 randomly generated textures with same seed inside unity, this took me about 2 hours to fetch all the silly notations since this is terribly documented.

If you use this script, feel free to reply in thanks.


//in your public declaration class
	public List terrainObject = new List(); //This is the terrainObject Entity
	public List terrain = new List(); 

//in your function:

		//Generate 2 Terrain objects
                int lastIndex; //track last created instance
		Terrain tmpTerrain; //temporary terrain script controller
		TerrainData tmpTerrainData; //temporary terrain data
		SplatPrototype[] tmpSplat; //temporary splat for texture data
		for (int i = 0; i < 2; i++) {
			terrainObject.Add (new GameObject()); //Create a new empty object.
			lastIndex = terrainObject.Count-1; //Last index
			terrainObject[lastIndex].AddComponent(typeof(Terrain)); //add terrain component
			tmpTerrain = terrainObject[lastIndex].GetComponent("Terrain") as Terrain; //set component to tmpTerrain
			tmpTerrainData = new TerrainData(); //create new terraindata
			tmpTerrainData.size = new Vector3(100,1000,100); //set up size of data
			tmpTerrainData.heightmapResolution = 1025; //set up resolution
							
			tmpTerrain.terrainData = tmpTerrainData; //set terraindata to terrain
			tmpSplat = new SplatPrototype[1]; //set from 1 to number of splat/textures you use
			tmpSplat[0] = new SplatPrototype(); //set  up new splat and texture details etc
			tmpSplat[0].texture =  (Texture2D) Resources.Load ("Grass", typeof(Texture2D));
			tmpSplat[0].tileSize = new Vector2(15,15);
			tmpSplat[0].tileOffset = new Vector2(0, 0);
			tmpTerrainData.splatPrototypes = tmpSplat; //set splat to terraindata
			tmpTerrainData.alphamapResolution = 1025;  //set resolutions
			tmpTerrainData.baseMapResolution = 1025;
			
			terrainObject[lastIndex].AddComponent(typeof(TerrainCollider)); //create collider
			((Terrain)terrainObject[lastIndex].GetComponent(typeof(Terrain))).terrainData = tmpTerrainData; //set terrain to terraindata
			((Terrain)terrainObject[lastIndex].GetComponent(typeof(Terrain))).heightmapPixelError = 10; //error handling stuffs
			
			terrainObject[lastIndex].AddComponent(typeof(TerrainToolkit)); //optional: use toolkit for perlin generation
			terrainObject[lastIndex].name = "Terrain"+lastIndex; //name terrain with index noted
			
			terrain.Add (terrainObject[lastIndex].GetComponent("TerrainToolkit") as TerrainToolkit); //track terraintoolkit for later calls
			lastIndex = terrain.Count-1; //set index for script
			terrain[lastIndex].PerlinGenerator(4, 1.0f, 8, 0.8f); //set attributes (on api)
		}
		terrainObject[1].transform.position = new Vector3(2000,0,0); //relocate second terrain to a new location
Jul 01

Quick Reference Flash Messages From Any Controller Inside Yii

For more documentation, please see Documentation about Flash Messages

 /* Shortcut functions to setting flash messages */
  public function flash_success($msg) {return $this->setFlash('success', $msg);}
  public function flash_notice($msg)  {return $this->setFlash('notice', $msg);}
  public function flash_error($msg)   {return $this->setFlash('error', $msg);}
  
  /* Magic flash message handling function */
  public function setFlash($type, $msg)
  {
    if (Yii::app()->user->hasFlash($type))
      $msg = Yii::app()->user->getFlash($type) . '
' . $msg; return Yii::app()->user->setFlash($type, $msg); }
Jun 30

Adding model relations to CGridView

In my example, I’m adding the ability to search and sort cgridview of data accessed via a relationship between Skills and SkillEffects. My additions are in bold. They have a relationship defined like so in protected/models/SkillEffects.php:

class SkillEffects extends CActiveRecord
{
[...]
	public function relations()
	{
[...]
			'skill' => array(self::BELONGS_TO, 'Skills', 'skill_id'),
[...]

Step 1: Add a public variable

Short and simple. I called it skillName since this is the data being accessed, the name is not forced.

class SkillEffects extends CActiveRecord
{   
    public $skillName; //added to create searchable skillName.
[...]


Step 2: Add the new variable to the rules function.

This is as simple as adding to the last array defined with 'on'=>'search' on the very end, putting our variable in the list.
	public function rules()
	{
			array('id, skill_id, skillName, effectType_id, effectValue, case_id, caseValue,  cooldown', 'safe', 'on'=>'search'),
[...]

Step 3: Add some code to the search function.

Note that this code is ADDED to the $criteria variable, you are not making a separate search result function.

	public function search()
	{
[...]
		$criteria=new CDbCriteria;
        $criteria->with = array('skill');
        $criteria->compare('skill.name', $this->skillName, true);
		$criteria->compare('id',$this->id,true);
		//$criteria->compare('name',$this->name,true);
		$criteria->compare('skill_id',$this->skill_id,true);        
		$criteria->compare('effectType_id',$this->effectType_id,true);
		$criteria->compare('effectValue',$this->effectValue,true);
		$criteria->compare('case_id',$this->case_id,true);
		$criteria->compare('caseValue',$this->caseValue,true);
		$criteria->compare('cooldown',$this->cooldown,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
			'sort'=>array(
			     'attributes'=>array(			     
                    'skillName'=>array(
                        'asc'=>'skill.name',
                        'desc'=>'skill.name DESC',
                    ),
                '*',
                ),
            ),
       ));

Step 4: Add the variable to CGridView

For the next portion, we open up the CGridView file, in my example I'm opening /protected/views/skillEffects/admin.php:

widget('zii.widgets.grid.CGridView', array(
[...]
	'columns'=>array(
		'id',
		'skill_id',
		array(
            'name'=>'skill',
            'value' => '$data->skill->name'
        ),

and that's it! You will be able to search/sort results in a cgridview.

Apr 21

Transcend 32 GB JetFlash TS32GJF500 (Black) Review

I am an active subscriber to Geeks are Sexy and saw a Deal of the Day (link here).
Here’s the product link:

It was on sell for $19.99, so figured, why not?
Trascend Jet 32gb Package
So it arrives in these funky envelopes, and as per the other side:
Certified Hassle Free
Certified to be frustration free! Woohoo! Can you believe they actually label stuff this way?
Layed out
I do have to admit it wasn’t much frustration, here is the warranty details and the product laid out.
Plugged in
Plugged it into my Win7 machine and it came up FAT32 (standard) and rounded to 30.2 GB. Crappy software on it. Deleted that.
Benchmark on transcend write speed
To start, I tested the transfer rates to write casper (An Ubuntu LiveCD folder) and see it’s I/O rate. It was roughly 11 MB/s.

Next, I tested the transfer rates to read casper to my RAID1. But it was cheating and super quick copying. I’ll add this in later.
SSD Benchmark Transcend
So I moved on to a SSD Benchmark tool I got. I normally would not have weighed heavily on it’s results since it is designed for SSD specifically, but the flash technology seems to be accurate at least in the read/write sequencial spectrum (which is what the majority of my needs are). 33 MB/s is acceptable for read rate, comparable to marketed high burst flash drives.

I went ahead and ran my handy dandy syslinux bootloader on it to make it a bootable 32 GB drive. (This is a hacked up copy of slax’s usb installer)

Plopped it in another machine and it booted fine to my built in stuff.

Next I needed to find some sort of ISO mounting tool, since my 32gb is going to contain a lot of image ISO’s for going around and using.
I’m going to try out this product: http://www.isodisk.com/ and see how it does. There’s a chance it’ll fail miserably, as most of these require reboots to mount an ISO.

I’ll update this post with news on what I think of the product and if I have any complaints for my uses.

Apr 20

Enabling RDP Remotely

RegEdit Connect Remote

Log in to your local computer as administrator.
WinKey+R
regedit
ALT+F, C
Type in Hostname of the remote computer.
click Advanced button to search for the remote computers.
Navigate to reg key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server

Edit value: fDenyTSConnection and change value from 1 to 0.

Done!