Categories
Uncategorized

Unity3D: replace Uma.dll with source code

If you want to replace the UMA.dll with the source code from https://github.com/huika/UMA, Unity3d will loose references to essential scripts such as SlotData.cs, OverlayData.cs …

The following script will replace the corrupted references.
1. remove UMA.dll from your project
2. add source code of the dll to the project (https://github.com/huika/UMA)
3. press the menu “UMA/Replace UMA DLL”

Some reasons to replace the dll with source code:
– remove UMA.dll and LitJson.dll from your build project
– debug UMA to find bugs or learn how it works (I have a bug in my case, but I’m not sure if its UMA or something else)

[code language=”csharp”]
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;

/// <summary>
/// If you want to replace the UMA.dll with the source code from https://github.com/huika/UMA, Unity3d will loose references to essential scripts such as SlotData.cs, OverlayData.cs …
/// 1. remove UMA.dll from your project
/// 2. add source code of the dll to the project (https://github.com/huika/UMA)
/// 3. press the menu "UMA/Replace UMA DLL"
///
/// Good read how fileID and guid work with DLLs:
/// http://forum.unity3d.com/threads/reducing-script-compile-time-or-a-better-workflow-to-reduce-excessive-recompiling.148078/#post-1026639
///
/// Hint: This is script is not optimized for performance, because you only run it onces 😉
/// </summary>
public class ReplaceUmaDll
{
[MenuItem("UMA/Replace UMA DLL")]
static void Replace()
{
List<UnityReference> r = new List<UnityReference>();
r.Add(new UnityReference("e20699a64490c4e4284b27a8aeb05666", "1772484567", "e20699a64490c4e4284b27a8aeb05666", "11500000")); // OverlayData.cs
r.Add(new UnityReference("e20699a64490c4e4284b27a8aeb05666", "-1278852528", "73c8549c3cf080440a73c4e2ccd18008", "11500000")); // SlotData.cs
r.Add(new UnityReference("e20699a64490c4e4284b27a8aeb05666", "-335686737", "0255b874991cce440bf9d7aeb881d411", "11500000")); // RaceData.cs
r.Add(new UnityReference("e20699a64490c4e4284b27a8aeb05666", "-1571472132", "e7c16015bfeffbf46a4f40de1f687493", "11500000")); // UMADefaultMeshCombiner.cs
r.Add(new UnityReference("e20699a64490c4e4284b27a8aeb05666", "-946187639", "fd3c35f1684963b4c8693ace7a4e9751", "11500000")); // UMALegacyMeshCombiner.cs
r.Add(new UnityReference("e20699a64490c4e4284b27a8aeb05666", "-1550055707", "8c8e9aa6f57f2fb4ab4808b7dd814787", "11500000")); // UMAData.cs
r.Add(new UnityReference("e20699a64490c4e4284b27a8aeb05666", "-1708169498", "ca64bee1dd859ab498a3045e0e682a1a", "11500000")); // UmaTPose.cs
r.Add(new UnityReference("e20699a64490c4e4284b27a8aeb05666", "-1175167296", "a4beb7632b1d45f44b433df8b2d28f9a", "11500000")); // TextureMerge.cs

ReplaceReferences(Application.dataPath, r);
}

static void ReplaceReferences(string assetFolder, List<UnityReference> r)
{
string[] files = Directory.GetFiles(assetFolder, "*", SearchOption.AllDirectories);
for (int i = 0; i < files.Length; i++)
{
string file = files[i];

if (EditorUtility.DisplayCancelableProgressBar("Replace UMA DLL", file, i/(float)files.Length))
{
EditorUtility.ClearProgressBar();
return;
}

if (file.EndsWith(".asset") || file.EndsWith(".prefab") || file.EndsWith(".unity"))
{
ReplaceFile(file, r);
FindNotReplacedFiles(file, "e20699a64490c4e4284b27a8aeb05666");
}
}

EditorUtility.ClearProgressBar();
}

static void ReplaceFile(string filePath, List<UnityReference> references)
{
var fileContents = System.IO.File.ReadAllText(filePath);

bool match = false;

foreach(UnityReference r in references)
{
Regex regex = new Regex(@"fileID: " + r.srcFileId + ", guid: " + r.srcGuid);
if (regex.IsMatch(fileContents))
{
fileContents = regex.Replace(fileContents, "fileID: " + r.dstFileId + ", guid: " + r.dstGuid);
match = true;
Debug.Log("Replaced: " + filePath);
}
}

if (match)
{
System.IO.File.WriteAllText(filePath, fileContents);
}
}

/// <summary>
/// Just to make sure that all references are replaced.
/// </summary>
static void FindNotReplacedFiles(string filePath, string guid)
{
var fileContents = System.IO.File.ReadAllText(filePath);

// -? number can be negative
// [0-9]+ 1-n numbers
Regex.Replace(fileContents, @"fileID: -?[0-9]+, guid: " + guid,
(match) =>
{
if (match.Value != "fileID: 11500000, guid: " + guid)
{
Debug.LogWarning("NotReplaced: " + match.Value + " " + filePath);
}
return match.Value;
});
}

class UnityReference
{
public UnityReference(string srcGuid, string srcFileId, string dstGuid, string dstFileId)
{
this.srcGuid = srcGuid;
this.srcFileId = srcFileId;
this.dstGuid = dstGuid;
this.dstFileId = dstFileId;
}

public string srcGuid;
public string srcFileId;
public string dstGuid;
public string dstFileId;
}
}
[/code]

Categories
Uncategorized

Battlefall: Character System and Account System

Tower Lords wasn’t as fun as I hoped, so I changed the gameplay and name. The new name is Battlefall and I work on for a few month.
The latest update is about the character system and account system. You can read the details here:
http://battlefall.com/character-system-and-account-system

https://www.youtube.com/watch?v=Rb9py6PqLP4&feature=youtu.be

Categories
Uncategorized

Global Game Jam 2014

I  participated at the Global Game Jam this year. It was in Karlsruhe at HfG Karlsruhe. I had a lot fun and met at lot of nice people. The theme this year was “We don’t see things as they are, we see them as we are.” It was quite difficult in my view and we had a lot of ideas. 30 minutes of brainstorming ended with the floor full of post-it.
SAMSUNG

After pitching our ideas, I joined Moritz and Till to develop Will to Survive. The story and idea of the game:

You go through a terrible memory of the past. In order to win, carry your will to survive. A shining orb represents it. Beware of your father who just killed your mother. He will try to stab you.

Till made the design and animation of our main character and the vater. Moritz made art for the background and level design. I programmed the game in Unity and put very thing together. The character was controlled by the 2D physic engine that was added with Unity 4.3. The animations were blended with Mecanim.

WillToSurvive_Mecanim

The AI of the father was quite simple. He run with a predefined speed. In front of each obstacle was a trigger, that forced the father to jump with a predefined force and a maximum speed, while he was in the air. With this is place, we were able to trigger small, high and long jumps.

You can find the game and some more details at the Global Game Jam Site

WillToSurviveDSC01634

DSC01616