Website may be up and down over next few months. I'm currently doing a complete overhaul of everything. Going back to simple individual .htm pages, new overall site theme, sanitizing and cleaning up html of all pages and blog posts, attempting to implement a new tooling and publishing system etc etc.

Today I was writing some C# code where I needed to manage a multidimensional array. Specifically I needed to store a items using Column, Row, & Depth as indexers. Instead I wrote a Array3D class that used generics to store any type and internally it uses a single dimensional array and a little bit of math to select the right index.

Not long after I started writing it Déjà vu set in. You know I could have swore I’ve written this class some time ago. Searching through hundreds of projects and tens of thousands of files dating back to 2001 ala .NET 1.0 I came up with nothing. I even went a little nuts and searched back further into my old Turbo Pascal and QBasic code but still found nothing.

Google, DuckDuckGo, & Bing searches were no help either. I could not shake the feeling I have written or have come across this code before. Maybe not in C# but in some other language. I’m sure I have …

This is not the first time I have started to write code and had a strong sense that I have written this code before as I’m sure many programmers do. Maybe it’s just me but with all our modern fancy IDE’s and add-ons archiving code for long periods of time, as in decades, does not seem to be something that has been readily addressed. If there is one thing I absolutely hate is having to repeat my self to the computer when it comes to coding. it’s also why I have visual studio set to auto save every 60 seconds.

Also hard to believe .NET is pushing 12+ years already. Hard to believe that the so called high tech industry essentially has not changed at all since the early 1960’s. Yes, 1960’s & 70’s that’s the era when the first high level languages were originally developed. And here we are 50+ years later and were still just an endless sea of primates spanking our hands on the keyboard just hoping for the best. But that is a rant for another time. :P

So to try and address the issue of code loss I have decided to start a “Code Snippets” series to archive various code snippets in an effort to make searching for them a little bit easier.


If you are submitting packages to the asset store and are including version changes that contain html links, remember to specify target="_blank" in your link attributes. Failure to do so can result in the asset store window being replaced by the web page that your link was pointing to. In some occasions it can also cause unity to crash.

Unity101Tip52


I have been thinking that because texture atlases are so common Unity should have some build in support for generating them. Turns out it already does! Check out the Texture2D.PackTextures method.


Legacy of Kain: Soul Reaver Reduex

Published 2/3/2013 by createdbyx in News | Games
Tags:

Just finished playing Legacy of Kain: Soul Reaver last night and even after all these years it’s still an EPIC game. I purchased the Steam bundle that includes Legacy of Kain: Soul Reaver, Legacy of Kain: Soul Reaver 2 & Legacy of Kain: Defiance.

This game was a pain at times to get running and crashed about 20 times during my play through, Sound would glitch and sound FX would stop playing and I’d worry if I was missing any dialog. Had to use a hacked ATI driver and run the game in software mode just to play it. Can't imagine how hard it will be trying to run it in another 10+ years from now.

YouTube user user DonKain has posted a 32 part video walkthrough from beginning to end if you don’t want to buy the game but still want to see what it’s all about.

Before playing soul reaver I first tried to play Blood Omen: Legacy of Kain. What a nightmare that was. Took days of messing around trying to install windows 95/98 & XP in various virtual machines to no avail. Finally gave up and tried running a PSX iso image with a PSX emulator but after hours of frigging around trying to get it to render properly under the emulator I gave up. After a week of trying to get the game running I decided to see if YouTube had a video of it and found a 27 part play through by user Tiff0202.

Blood Omen: Legacy of Kain is a 2D game and it was remarkably difficult to get running under modern technology, and times when I did get it running it was not really playable due to rendering glitches even under an emulator. This does not bode well for all those amazing games of late 80’s & 90’s. Only 15 years later and they are getting progressively harder and harder to get up and running without having a dedicated computer hardware & software from that era to run them.


If your Unity code requires conditional compilation symbols to be present this bit of code may come in handy. After unity compiles your scripts it executes any classes that have the InitializeOnLoad attribute. You can call the SetupConditionalCompilation method provided in the code snippet below to ensure that the conditional compilation symbols persist in your unity project. If a symbol was not present and was added it will write out a notification in the unity console.

ConditionalStartup

[InitializeOnLoad]
public class GridMappingSetup
{
    static GridMappingSetup()
    {
        var types = new[] { BuildTargetGroup.Standalone, BuildTargetGroup.WebPlayer };
        var toInclude = new[] { "CBXControls", "GridMapping", "QuickTools", "ToolService", "TileMaterialCreation" };

        SetupConditionalCompilation(types, toInclude);
    }
}

public static void SetupConditionalCompilation(BuildTargetGroup[] platformTargets, string[] symbolsToInclude)
{
    foreach (var type in platformTargets)
    {
        var hasEntry = new bool[symbolsToInclude.Length];
        var conditionals = PlayerSettings.GetScriptingDefineSymbolsForGroup(type).Trim();
        var parts = conditionals.Split(';');
        var changed = false;

        foreach (var part in parts)
        {
            for (int i = 0; i < symbolsToInclude.Length; i++)
            {
                if (part.Trim() == symbolsToInclude[i].Trim())
                {
                    hasEntry[i] = true;
                    break;
                }
            }
        }

        for (int i = 0; i < hasEntry.Length; i++)
        {
            if (!hasEntry[i])
            {
                conditionals += (String.IsNullOrEmpty(conditionals) ? String.Empty : ";") + symbolsToInclude[i];
                changed = true;
            }
        }

        PlayerSettings.SetScriptingDefineSymbolsForGroup(type, conditionals);

        if (changed)
        {
            Debug.Log(String.Format("Updated player conditional compilation symbols for {0}: {1}", type, conditionals));
        }
    }
}

Created by: X

Just another personal website in this crazy online world

Name of author Dean Lunz (aka Created by: X)
Computer programming nerd, and tech geek.
About Me -- Resume