Showing posts with label wreckless conduct. Show all posts
Showing posts with label wreckless conduct. Show all posts

Tuesday, August 23, 2011

Flatpack World

The level builder has gotten bit of an upgrade since its last mention. Inicus' Tile Interpret system has been intergrated.


To cut down on processing time, it will only work on cubes that are selected with the level builder.


I have to recheck some code but you can still make non-retangular shaped buildings.


Particular walls on the buildings can now spawn props onto them. It still need some work as some walls have a tendancy to spawn props out of bounds. But media heavy and congested buildings are coming.


I'm working on a level now. It's still at grey box level. I'll be looking for test drivers tommorrow so if you want to give it a spin, come and ask me. (I learnt yesterday that System.IO.FileInfo.Delete is one of .Net features that aren't supported by Unity's web builds.)

Sunday, August 7, 2011

Wreckless Conduct: Copy and Pasting Animations

Copying and pasting animations for the rigs in Wreckless now goes something like this:

For the curious, there are about 54 items in the current rig that are used to animate. With the tool, we only have to copy animations from 9 of these objects.

Open up unanimated rig.

Import the animated rig.

Find and select the animated rig's "Root" node. Then copy the animations from it.

Find and select the unanimated rig's "Root" node. Paste the animations to it.

As the script's not in control of importing the rig, I haven't added any capabilities to find and match names of the 2 rigs. You also have to copy and paste for all the IK handles and rig controls. This does cut down the process to about 1 minute so I can't complain. The best part, most of the work is done in 4 lines of code which look like this:

proc CopyKeys() {
string $sourceRoot[] = `ls -selection`;
copyKey -time ":" -option keys -hierarchy below -controlPoints 1 -shape 1 {$sourceRoot[0]};
}//END CopyKeys

proc PasteKeys() {
string $rootNode[] = `ls -selection`;
pasteKey -option replaceCompletely -copies 1 -connect 0 -timeOffset 0 -floatOffset 0 -valueOffset 0 {$rootNode[0]};
}//END PasteKeys

Wednesday, July 27, 2011

Wreckless Conduct: Debuggery

Unity
It has been a long time between updates but I spent a lot of it debugging my level builder and associated scripts. It contains less bugs than before and few more options.


This a quick tool that I wrote to make using Inicus' Cube Interpret System easier to use.
It snaps cubes (any prefab) to a sizeable "tile grid" (Wreckless uses 3x3x3 metre scale), lets you scale the selected items by the scale (+n in x,y,z) and lets you add a tag to the selected. Which is important so the Cube system knows what to turn cubes into.

Road Intersections can align (it's a little buggy) before they generate roads and there's highways happening. I will be working on getting ramps and barriers on those intersections up.

Prop Zones are little areas that will be scattered around the levels that generate props for you to crash into. It saves me time having to place the props in manually. There are a variety of options for how props are spawned inside the zone. It's still a small work in progress, I have yet to find an elegant way to code it.



Skybox Progression
Although it's not apparent, Wreckless is meant to be full of hive city environments so the skybox should reflect it. I dislike matte painting but it's just how I've decided to get something up.




A shot of an unfinshed 3D version.

If there are any artists around who'd like to do some modelling or matte painting, it would certainly save us some time and look 1000 times better. Feel free to contact me or Inicus if you want to work on a cyberpunk environment.

Mel scripting
I got tired of having to set up all my default scene cameras' near and far clip planes so I wrote a mel script. I could add more functionality to it but this is good enough for me.

I spent a lot of time on the break trying to script a tool that will copy animations from 1 rig to another. So far no dice. But hopefully I can get back into it once I've picked some brains of far more intelligent people than I.

Monday, June 6, 2011

Wreckless Conduct: Level Building Phase 1

While I would love to ammend the above title with "complete", this puppy has got a snowballing effect on it. One day I expect it to implode itself or explode my brain. Any day now.

Here's some progress shots of trying to roads to spawn around intersections:

The Level Builder 'menu':

I found it easier to import my reference image in so I can lay pieces out to fit the map. It's a little buggy but it works enough for me.

Placement of objects/world elements:

I'm going to be working on this for quite some time. There's a big list of bugs to fix and some added extras that would make level building easier. I'm going to take a break and then start making things better.

If anyone needs to construct a litmas test for the 90's, consider the raddest cat.

Monday, May 16, 2011

Wreckless Conduct: The Scent of Failure

Some progress shots of level building toolkit + Unity Editor + beating head on keyboard looks like. Finally got some kind of mouse click system which instantiates a prefab in the scene window.

For those interested, the code looks a little like this:

 //OnScenGUI is how the Editor handles events in the scene window
function OnSceneGUI() {
    //  Handles are like Gizmos
   // Draw cube at 0,0,0 when level builder is on
    Handles.color = Color.red;
    Handles.CubeCap(0, Vector3.zero, Quaternion.identity, 0.5);
  
    if(editMode) {
        if(Event.current.type == EventType.MouseDown) {
            if(Event.current.button == 0) {
              
                var ray = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition);
                var dist : float;
              
                // Cast a ray on a "fake" plane (The Plane class in Unity is a "Representation of planes")
                // If ray hits the plane (grid stand in), use the current mouse position to instantiate our prefab
                if(grid.Raycast(ray, dist)) {
                    var pos : Vector3 = ray.origin + ray.direction.normalized * dist * 0.5;
                    Debug.Log("Placed fab at: " + pos);
                   // Using EditorUtility.InstantiatePrefab does stop me from creating clones of my prefab
                  // I could still use Instantiate(gameObject, pos, Quaternion.identity) here as well
                    var currentPiece : GameObject = EditorUtility.InstantiatePrefab(target.currentFab);
                 // Seems like the line below is causing some problems
                    currentPiece.transform.position = pos;

                }//END grid Raycast
            }//END Mouse Left Click
        }
      
        // Prevent deselection of object while in Edit Mode
         Selection.activeGameObject = target.transform.gameObject;

    }//END In Edit Mode

}//END OnSceneGUI

Failure is listed down below, I'm getting worried about how long this is all taking so any suggestions are most welcome.



Edit: I've sort of resolved the fragmenting of prefabs, it had to do with my invoking of particular functions. I will be working on the functionality of the level builder.


This one is a little old but it does show that I've resolved a strange problem with the math that determined where a collider positioned itself and when you resized buildings.



For funs:
Minecraft - Unity Style. Also has a playable demo.

Tuesday, May 10, 2011

Wreckless Conduct: Streets of Hell

With about 4 weeks to go, I decide to start scripting things that will help with level building. Yes, I have under-estimated the enormity of this task. Here's a look at what I've been working on.

Building scripts for prefabs:


Material randomiser:


To Do:
- City layout
- Roads
- Buildings
- Props

Monday, April 25, 2011

Wreckless Conduct: Prop Export Tool

My Export Tool has hit its final stage of development. I doubt I'm going to do more to it but suggestions are always welcome.

Here's a pictorial outline of how it works:

Important: This works best if you point the tool to a Custom Assets/Assets folder in your Unity project that should have folders for Models and Textures. I may look into adjusting it so you can just choose a project folder but that will depend on time constraints.


If you can see the tool, then you may notice the text boxes for Model and Texture Folders. They are default names but you can edit them as long as you remember to have a "/" at the front. Annoying but it's just the way I've set to code to deal with empty text boxes.






I've got a slight problem with importing to Unity and the generation of materials. If you look at the pictures below, it will generate a material from the imported texture file and import the Maya default lambert1. It's very likely I will need to play with Unity's Editor classes but we'll see how I go.


Fixed:
- Problems with exporting with/without the Collision node
- Hacky fixes for re-exporting and multiple Collision Nodes (you can have mulitiple Collision nodes but it ignore those nodes upon export)
- Collision volume names, it will now stop appending additional tags to the volumes' name

Added:
- Naming of multiple volumes, you can add the same tag to whatever's under your selection
- Folder Names as mentioned before
- Remove collision volumes from the Collision node

Problems:
- You will need to assign another material to your object, Maya has a problem with renaming lambert1.
- It will still build an Export Node even if you haven't selected a mesh or when you exit out of the save dialog box. I may need to find a way to halt the procedure.

To Add:
- File Path refinement
- Extra pivot point options (maybe, I don't really need them but someone else might)

Thursday, April 21, 2011

Wreckless Conduct: Dem Dry Bones

The Wreckless Art Team's had some trouble with importing our animated rigs into the build. Tuesday night, Brie found the solution to our problem.


The solution involves an attribute found on joints known as Scale Compensation (or in Maya Segment Scale Compensate) which isn't supported by Unity. You just uncheck a checkbox found in the Attribute Editor and the rig will import correctly.

To save Brie the hassle of doing this 234 times (that's 39 bones x 6 models), I wrote a MEL script that does it for her. FUU-YEAH, Hadōken's a little hard to do but fixing pipeline issues like this is pretty good.

Monday, April 18, 2011

Wreckless Conduct:: Yellow Boxing

'Lo and behold, it's that time where I do an update. Expect much boring stuff to occur right now. Here's some screenshots of some progress with unwrapping the car to keep your eyeballs entertained.

It's essentially 1 solid mesh of a Lowrider and then over 18 separated parts that will break off when you crash it in game. It's going to take some time to get a nice and smooth UV happening so don't hold your breath. I didn't model it, you may thank the genius behind it by giving him cash.


I've been working on a MEL script/Export tool that's going to help me export props for Wreckless. It's getting close to an alpha stage so I'm going to write about it since it does more things than a half-unwrapped car.

It's a tool that's built to work with Matt's BuildCollisionOnImport for Unity and make exporting props to the Wreckless build simpler. A basic run down for skim readers:
- It will export an FBX to either my current folder or somewhere I choose
- It will rename my mesh and current material to the same name as my Maya scene.
- It will also copy the image file linked to the material into the directory I chose
- It can place collision volumes under a collision node
- I can tag collision volumes using this tool (more about that below)
- It does pivot point placement
- Everything is placed under a node called Export

Here's some shots of what it does and what problems I've come across. Note: This tool only exports as FBX, I could probably make it do other file formats but that's not necessary at the moment.

1. This is our substitute model, it has a clean construction history and an assigned texture. The export tool is that thing on the side, you will get a cleaner shot of it later.

2. Pivot Settings, move the pivot to particular places. It has general placements at the moment but I will be trying to include more expansive options. The pivot offset only works for above and below the model. It doesn't do x or z axes at the moment.
You may ask why not and I would have to explain why trying to move the pivot 0.2 meters below the prop is a little bit tedious. You may read that as "she's a lazy little thing" and you would be right.

3. The export buttons. Quick export will dump your FBX to the same location as your Maya scene. Export will place your FBX into the folder you direct it to. It will also copy the image file you're using to texture it into any folder marked "Texture" in the same directory as the FBX. Placement for lazy people will be coming up.

4. I hit a problem with trying to stick duplicated versions of the model under a Collision Node. In the top picture, you can see it completely missed the collision volume I had put in the scene.
Surprisingly checking where it was calling the function actually fixed it. The bottom shot shows what you're meant to get with the tool. If you have noticed, it will also rename your mesh and current material the same name as your scene. That's a good thing if your scene is "Vending_Machine" but bad if it's "R_204892-492". I might include extra bits that allow the user to set a name for the mesh and material.

Exporting into Unity looks like this:
If you're not familiar with Matt's script, basically it will look for a node called "collision", then look for anything that has an ID tag. Depending on which tag you use, the script will then make a collider where you put a volume and then delete the mesh you used to make that volume.

So in the above case, the "_Box" tag we stuck on our collision volume will make a Box Collider. Feel free to come bug me if you don't get that explanation, stabbing costs you extra.

There are a few things to fix with the current version of the tool.

It can't generate collision volumes, these need to be made by the user. However it does come with some options that make it easier to put collision under the right node. I started putting these in when I remembered that there are props which contain more than 1 type of volume.

It's got a problem with naming volumes, as you can see it'll keep appending the tag to the transform's name. Don't you worry, I will fix it soon.

The current GUI looks like this, most things are explanatory but you can ask questions and I may try to answer them.

To Do:
- Solve problems with the collision tags, and node.
- Refine the export function
- Refine the naming system
- Include additional pivot point options

If you have any suggestions or complaints, please fire them at my head. I'll be sure to get them in a most painful way.