Namek Dev
a developer's log
NamekDev

Working on workflow for Unity and git

August 2, 2014

Unity3D seems to be a great software for rapid prototype development. It certainly is but when properly used. You’re alone with your prototype? It’s OK but I was the other case. When it comes to collaborate there’s a belief that nothing will change during the process of development. Well, the reality is that the teamwork does change a lot. If you dare to work with team using Unity, then you may find my experience useful to you.

→ Continue reading csharp, gamedev, git

Iterative version of Ramer-Douglas-Peucker line-simplification algorithm

June 28, 2014

In one of our games we needed to beautify user mouse or touch input. Actually it isn’t simple task since there can be found many criteria due to point reduce. I have tried several solutions like discovering big angle change between segments (built of last given input points), big distance discovering, Catmul-Rom curve approximation and even joining all of those methods.

Later on I have found Ramer-Douglas-Peucker algorithm which helped to reduce unneeded points in a more visually proper way. In the end I’ve been reducing points by small distance and little angle between segments to put less points into the algorithm. Since it had to be done in realtime that wasn’t enough of optimizations. Next optimization was to make the iterative version of Douglas-Peucker algorithm.

→ Continue reading csharp, gamedev, unity3d

Quick implementation of Network for existing Game

May 15, 2014

There are 2 common choices of architecture for game network implementation:

  1. client-server
  2. peer-to-peer

What I did was some kind of hybrid of those two. I used Remote Procedure Calls (RPCs). In this post I will describe this technique giving some basic examples showing the role of server and actually giving it some tools to do it’s role as a server.

→ Continue reading csharp, gamedev, unity3d

Unity - is this point within a box?

April 19, 2014
I am currently using Unity for two weeks and I have started to implement logic and graphical tweaks into mechanics. It happened that I needed a little math to correct some calculation failures based on user mouse or touch input. A simple check was needed - is a given 3D point contained within a box? I was pretty disappointed that Unity does not have such functions already made. And even more disappointed I couldn’t find ready solution for Unity-specific library code. → Continue reading csharp, gamedev, unity3d

WPF/Silverlight Design Data without XAML

February 19, 2014

Here’s a class for our sample data. That’s where the data should go into.

public class MainViewModelDesignData : MainViewModel {
    public MainViewModelDesignData() {
        // TODO: instantiate your sample data
    }
}

In App.xml define your namespace:

xmlns:models="clr-namespace:YourApp.ViewModels"

and then:

<Application.Resources>
    <models:MainViewModel x:Key="DesignDataContext" />
</Application.Resources>

The last step - instantiate sample data as DesignContext. You can do it in your Window, Page or whatever. I did it in MainPage.xaml in my Windows Phone 7 application:

<phone:PhoneApplicationPage.DataContext>
    <models:MainViewModelDesignData />
</phone:PhoneApplicationPage.DataContext>

Our sample data is bound to whole page. Use it like every other binding.

csharp

Interface with basic implementation in C#

February 2, 2013

Today we have simple question:

How to avoid abstract classes by giving base implementation?

The story

Once in a time I was building animation system which was planned to be used in IGWOCTISI project. It happened that I wanted to created some predefined tweens (animated translations) like ScaleTo, MoveTo, RotateBy and so on.

In the horizon appeared a requirement which was pretty straightforward:

public class MoveTo<T> : Animation<T>
		where T : ITransformable

The fact was that my type T not always was able to be some Transformable object.

→ Continue reading csharp, gamedev

Better Memento

November 4, 2012

Today I asked myself - how to use Memento design pattern to store object state in a more safe and effective way? Of course by automating some things using some base implementation. Read about why I needed better Memento and how did I achieved nice combination of Memento and Command design patterns. Full code is given.

→ Continue reading csharp