The book of inspiration

April 29, 2009

E_UNEXPECTED

Filed under: life — Tags: , , — zproxy @ 1:49 pm

While trying to access at COM object from .net you can be greeted by this:

Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))

In my case I had to add the COM control to the toolbox and drop it onto the form.

Convert your book to a notebook

Filed under: life — Tags: , , , — zproxy @ 6:04 am

Noteboek (English title: Notebook) consists of 4 short experimental films where I try to confuse the reality.
In these films, illusions and expectations are challenged

How to add vimeo to wordpress?

April 26, 2009

Scenarios for jsc

Filed under: jsc — Tags: , , , , — zproxy @ 8:31 am

This was my first anwser at  Stack Overflow.

The jsc compiler project enables these scenarios:

  • C# to MSIL to JavaScript for browser
  • C# to MSIL to JavaScript for AppJet
  • C# to MSIL to PHP5 for hosting solutions
  • C# to MSIL to Java for browser applets
  • C# to MSIL to Java for applications
  • C# to MSIL to Java for JavaCard
  • C# to MSIL to C99 for native stub applications
  • C# to MSIL to ActionScript3 for Flash 9
  • C# to MSIL to Adobe Alchemy C for Flash 9
  • C# to MSIL to C# 2.0

With some effort Visual Basic could also be used as a source language. The jsc compiler never reads your source code even if GWT and Script# do that. My compiler reads your IL.

jsc compiler is

  • an experimental project
  • one mans effort yet
  • rather useful already.
  • 3 years old.
  • awaiting donations to optimize compilation time and output itself

The latest example is a plasma animation where a single implementation can be used between those platforms:

April 22, 2009

Named Integers in C# aka Typedef

Filed under: life — Tags: , , , — zproxy @ 7:35 am

The other day I was wondering if there was anything like a named integer in C#. Today it struck me. We could define a new enum to function as a good old typedef. An enum can inherit from any integer. See the recent discussion here. While reading this article stateing java enums can define methods for enums I thought C# could use extension methods for that. Enums can reference a value not explicitly defined by the enum itself. In this case I did not define any values for that enum.

Here is a prototype for creating a named integer and defineing a method for it:

    8 public enum NamedInteger
    9 {
   10
   11 }
   12
   13 public static class NamedIntegerExtensions
   14 {
   15   public static void Method1(this NamedInteger e, string text)
   16   {
   17     Console.WriteLine("Method1: " + (int)e + " - " + text);
   18   }
   19 }
   20
   21 class Program
   22 {
   23   static void Main(string[] args)
   24   {
   25     var x = default(NamedInteger);
   26
   27     x.Method1("hello world");
   28   }
   29 }

April 20, 2009

Tombed

Filed under: life — Tags: — zproxy @ 5:57 am

Check this rather cool game out!

[...] tombed was created for ludum dare 14 – a triannual two-day game design challenge. the theme this time round is “advancing wall of doom.” other participants, commendably, are taking that theme in clever directions, but i happen to be fond of the stages in jumping games that inspired the theme: a screen-width hazard chasing the player as she scrambles to make tight escapes. i like close calls, so i made a game about them. – Anna

April 19, 2009

2009 Lang.NET Synposium – Speakers

Filed under: life — Tags: , — zproxy @ 11:37 am

What I will be defenetly watching:

Luke Hoban

Tales from the F# productization (video)

Ted Neward

Objective C# (video)

Jack Tilford

The Visual Studio 2010 Editor (video)

Joshua Goodman

What’s New in CLR 4 for Languages (video)

clr4

April 18, 2009

Design Fundamentals for Developers

Filed under: life — Tags: , , — zproxy @ 11:35 am

While watching this video I saw this cool vision for Uncertain# language. How much must we wait to have the yoda programming language for .net?
desdev

See also:

Audiogalaxy, Napster and ThePirateBay

Filed under: life — Tags: , , — zproxy @ 8:06 am

All those services, soon to be perils of history, do share something in common. Yarr!

Update: TPB sold out!

April 17, 2009

Code Quality

Filed under: life — Tags: , — zproxy @ 6:36 am

Here is a nice list to indicate the intended code quality from Phil Haack:

  • Prototype Code – Code used to hash out an idea to see if it’s feasible or as a means of learning a new technology. Often very ugly throwaway code with little attention paid to good design.
  • Demo Code – Code used to illustrate a concept, especially in a public setting. Like prototype code, solid design is sometimes sacrificed for clarity, but these sacrifices are deliberate and intentional, which is very important. My jQuery Grid demo above is an example of what I mean.
  • Sample Code – Very similar to demo code, the difference being that good design principles should be demonstrated for the code relevant to the concept the sample is demonstrating. Code irrelevant to the core concept might be fine to leave out or have lower quality. For example, if the sample is showing a data access technique, you might still leave out exception handling, caching, etc… since it’s not the goal of the sample to demonstrate those concepts.
  • Production Code – Code you’re running your business on, or selling. Should be as high quality as possible given your constraints. Sometimes, shortcuts are taken in the short run (incurring technical debt) with the intention of paying down the debt ASAP.
  • Reference Code – This is code that is intended to demonstrate the correct way to build an application and should be almost idealized in its embracement of good design practices.

April 8, 2009

Google App Engine SDK for Java

Filed under: life — Tags: , , , , , — zproxy @ 10:05 am

Powered by Google App Engine

App Engine runs Java applications using the Java 6 virtual machine (JVM).

  • CPU Time: 6.5 hours of CPU time per day
  • Bandwidth: 1 gigabyte of data transferred in and out of the application per day
  • Stored Data & Email Recipients: unchanged

I think I will create an example how to write for Google App Engine in C# via my jsc compiler within this month.

Unless ofcourse they will support MSIL natively which I dont think will happen…

You may wonder whatever happened to MS Java or maybe J#

Some feedback from Slashdot on the Google App Engine topic:

[...] It’s not the restrictions, it’s the implementation. Normally, existing Java code could just be compiled on the embedded system, and compiler errors would specifically identify security reasons for specific classes/methods/etc being disabled. Google removed the classes entirely, so the developer will just get IDontKnowWTFThatClassIs exceptions instead, which are less informative.

It also contravenes existing standards, sort of like making “dangerous” files invisible to unprivileged users in *NIX (via some sort of arcane black magic, perhaps a modified (munged) shell or something…) instead of just setting appropriate file permissions.

Did you know that your application will be running on multiple VM’s. So we do actually have threading support, it is just i another form.

[...] It even supports loading bytecode generated at run time. That means that our new Java runtime can support any language with a compiler that targets the JVM

You need to take extra care to enable HTTP sessions to which you could write data. It may look like a vendor lock in solution whether it is or is not remains to be decided…

(more…)

April 7, 2009

Stratus + Nonoba + ? = Massive Multiplayer

Filed under: life — Tags: , , — zproxy @ 8:20 am

Could stratus be used to connect multiple nonoba game instances? Here is the first diagram showing what I am thinking.

stratusnonoba

Every user client could be upgraded to admin client. By upgrading the client will act like a router, so it should be online for a while. Maybe we should give some stimulus to the player for that.

April 6, 2009

C# To ActionScript and Alchemy

Filed under: jsc — Tags: , , , — zproxy @ 7:14 pm

Some years ago I added some minimal C source code generation support to my jsc compiler. This time I decided to polish it up a little bit and see what would it look like to develop a flash application with alchemy in c#.

This example is a port from this Alchemy plasma experiment. I made it in c#, changed the color and added the jsc logo.

Overview

Writing code in c#? That’s plain crazy. To make it easier to comprehend – here is an overview diagram of what is really happening.

flashalchemy1

Hand written C# sourcecode

As you can see, there are multiple compilers doing the hard work so you could have that final flash binary file. The C# code that will be converted by jsc compiler looks like this:

   14 static int width;
   15     static int height;
   16
   17     static uint[] palette;
   18     static uint[] plasma;
   19     static uint[] newPlasma;
   20
   21
   22     static AS3_Val generatePlasma(object self, AS3_Val args)
   23     {
   24       AS3_h.AS3_ArrayValue(args, "IntType, IntType", __arglist(ref width, ref height));
   25
   26       palette = new uint[256];
   27       plasma = new uint[width * height];
   28       newPlasma = new uint[width * height];
   29
   30       for (var x = 0; x < 256; x++)
   31       {
   32         var b = (int)(128.0 + 128 * Math.Sin(Math.PI * x / 16.0));
   33         var g = (int)(128.0 + 128 * Math.Sin(Math.PI * x / 128.0));
   34         var r = 0;
   35
   36         uint color = (uint)(r << 16 | g << 8 | b);
   37
   38         color |= 0xff000000u;
   39
   40         palette[x] = color;
   41       }
   42
   43       int index = 0;
   44
   45       for (var x = 0; x < width; x++)
   46       {
   47         for (var y = 0; y < height; y++)
   48         {
   49           uint color = (uint)((
   50             128.0 + (128.0 * Math.Sin(x / 16.0)) +
   51             128.0 + (128.0 * Math.Sin(y / 8.0)) +
   52             128.0 + (128.0 * Math.Sin((x + y) / 16.0)) +
   53             128.0 + (128.0 * Math.Sin(math_h.sqrt(x * x + y * y) / 8.0))
   54           ) / 4);
   55
   56
   57           color |= 0xff000000u;
   58
   59           plasma[index++] = color;
   60         }
   61       }
   62
   63
   64       return AS3_h.AS3_Ptr(plasma);
   65     }
   66
   67     static AS3_Val shiftPlasma(object self, AS3_Val args)
   68     {
   69       var shift = 0;
   70       var index = 0;
   71
   72       AS3_h.AS3_ArrayValue(args, "IntType", __arglist( ref shift));
   73
   74       for (var x = 0; x < width; x++)
   75       {
   76         for (var y = 0; y < height; y++)
   77         {
   78           var paletteIndex = (int)( (uint)(plasma[index] + shift) % 256);
   79           newPlasma[index] = palette[paletteIndex];
   80           index++;
   81         }
   82       }
   83
   84       return AS3_h.AS3_Ptr(newPlasma);
   85     }

Generated C source code for Alchemy

After jsc compiler has converted it to asni c it will look like this:

   30
   31 int FlashPlasma_Alchemy_Program_width;
   32 int FlashPlasma_Alchemy_Program_height;
   33 unsigned int* FlashPlasma_Alchemy_Program_palette;
   34 unsigned int* FlashPlasma_Alchemy_Program_plasma;
   35 unsigned int* FlashPlasma_Alchemy_Program_newPlasma;
   36
   37 AS3_Val FlashPlasma_Alchemy_Program_generatePlasma(void* self, AS3_Val args)
   38 {
   39     int x;
   40     int b;
   41     int g;
   42     int r;
   43     unsigned int color;
   44     int index;
   45     int y;
   46
   47     AS3_ArrayValue((AS3_Val)args, (char*)"IntType, IntType", &FlashPlasma_Alchemy_Program_width, &FlashPlasma_Alchemy_Program_height);
   48     FlashPlasma_Alchemy_Program_palette = (unsigned int*) malloc(sizeof(unsigned int) * 256);
   49     FlashPlasma_Alchemy_Program_plasma = (unsigned int*) malloc(sizeof(unsigned int) * (FlashPlasma_Alchemy_Program_width * FlashPlasma_Alchemy_Program_height));
   50     FlashPlasma_Alchemy_Program_newPlasma = (unsigned int*) malloc(sizeof(unsigned int) * (FlashPlasma_Alchemy_Program_width * FlashPlasma_Alchemy_Program_height));
   51
   52     for (x = ((int)0); (x < 256); x++)
   53     {
   54         b = ((int)((signed int)((128 + (128 * FlashPlasma_Alchemy_BCLImplementation_System___Math_Sin((double)((3.14159265358979 * ((double)(x))) / 16)))))));
   55         g = ((int)((signed int)((128 + (128 * FlashPlasma_Alchemy_BCLImplementation_System___Math_Sin((double)((3.14159265358979 * ((double)(x))) / 128)))))));
   56         r = ((int)0);
   57         color = ((unsigned int)(((r << 16) | (g << 8)) | b));
   58         color = ((unsigned int)(color | -16777216));
   59         FlashPlasma_Alchemy_Program_palette[x] = color;
   60     }
   61
   62     index = ((int)0);
   63
   64     for (x = ((int)0); (x < FlashPlasma_Alchemy_Program_width); x++)
   65     {
   66
   67         for (y = ((int)0); (y < FlashPlasma_Alchemy_Program_height); y++)
   68         {
   69             color = ((unsigned int)((unsigned int)(((((((((128 + (128 * FlashPlasma_Alchemy_BCLImplementation_System___Math_Sin((double)(((double)(x)) / 16)))) + 128) + (128 * FlashPlasma_Alchemy_BCLImplementation_System___Math_Sin((double)(((double)(y)) / 8)))) + 128) + (128 * FlashPlasma_Alchemy_BCLImplementation_System___Math_Sin((double)(((double)((x + y))) / 16)))) + 128) + (128 * FlashPlasma_Alchemy_BCLImplementation_System___Math_Sin((double)(sqrt((double)((double)(((x * x) + (y * y))))) / 8)))) / 4))));
   70             color = ((unsigned int)(color | -16777216));
   71             FlashPlasma_Alchemy_Program_plasma[index++] = color;
   72         }
   73
   74     }
   75
   76     return  (AS3_Val)AS3_Ptr((void*)FlashPlasma_Alchemy_Program_plasma);
   77 }
   78
   79 AS3_Val FlashPlasma_Alchemy_Program_shiftPlasma(void* self, AS3_Val args)
   80 {
   81     int shift;
   82     int index;
   83     int x;
   84     int y;
   85     int paletteIndex;
   86
   87     shift = ((int)0);
   88     index = ((int)0);
   89     AS3_ArrayValue((AS3_Val)args, (char*)"IntType", &shift);
   90
   91     for (x = ((int)0); (x < FlashPlasma_Alchemy_Program_width); x++)
   92     {
   93
   94         for (y = ((int)0); (y < FlashPlasma_Alchemy_Program_height); y++)
   95         {
   96             paletteIndex = ((int)(((unsigned int)((((unsigned long)(FlashPlasma_Alchemy_Program_plasma[index])) + ((signed long)(shift))))) % 256));
   97             FlashPlasma_Alchemy_Program_newPlasma[index] = FlashPlasma_Alchemy_Program_palette[paletteIndex];
   98             index++;
   99         }
  100
  101     }
  102
  103     return  (AS3_Val)AS3_Ptr((void*)FlashPlasma_Alchemy_Program_newPlasma);
  104 }

Generated ActionScript by Alchemy

Now that was the basic ansi C source code. Alchemy will convert it to special actionscript which will look like good old assambler:

 9002 i0 =  ((__xasm<int>(push((mstate.ebp+8)), op(0x37))))
 9003 i1 =  ((__xasm<int>(push((mstate.ebp+12)), op(0x37))))
 9004 i2 =  ((__xasm<int>(push((i0+16)), op(0x37))))
 9005 i3 =  ((__xasm<int>(push((i1+16)), op(0x37))))

Summary

At this time it is quite hard to set up such an environment due to cygwin quirks, but it does enable some interesting scenarios. If you would like to know more about writing for flash alchemy in C# just let me know.

a visit to id software, 1993

Filed under: games — Tags: , , — zproxy @ 7:06 am

[...] he found a VHS tape that had some DOOM footage on it before its release

via rome.ro

Read about the making of doom.

[...] I want a game where you control a group of four marines from an isometric perspective. One of them should have a device which allows you to mind-control the demons. – sneetch

[...] A Doom II remake with a built-in map editor, mod downloader and community features would keep me entertained for the next 10 years or so. Think Trackmania, but with demons. – yehat

[...] I want it all procedurally generated. Infinite Doom!

See also:

April 3, 2009

Awesomium

Filed under: life — Tags: , , , , — zproxy @ 12:28 pm

Today I learned, that there is a 3D internet explorer renderer out there.

This is what it looks like if you would be playing my treasure hunt multiplayer flash game.

What did I do to make it work?

  • Download Awesomium v1.0 demo
  • Add a link to the game in media\demo.html
  • Select Direct3D9 renderer

I guess there is room for more 3d browsers… and don’t forget Cooliris.

April 1, 2009

zmovies.tk

Filed under: life — Tags: , , , , , , — zproxy @ 7:16 pm

Ever wanted to see the trailers and posters for downloadable movies? I proudly present you zmovies.tk.

Firefox Google Chrome Safari

Disclaimer: Downloading some content may not be as legal as you might think. And to be clear my service does not host any media – it merely references it via URLs. The web page itself is built independently directly on your computer.

Achron – timetravel is coming to rts

Filed under: games — Tags: , — zproxy @ 5:33 pm

Q. Dude, paradoxes?! You know, grandfather paradox, units fighting side by side?
A. Paradoxes can exist, but since the window of time is limited (e.g., an 8 minute window) all events eventually fall off. A paradox will oscillate between its different states until one of the states reaches the edge of the time window, leaving the players locked into one of the two states. Example: in the case of the grandfather paradox (where you use a factory to build a tank, have the tank time travel to before it was built, and then use it to destroy the factory) you will play with the paradox until it ‘falls off’ the time window, at which point there is a 50/50 chance of either the tank lives and the factory is destroyed (because the tank destroyed the factory), or the factory remains and the tank goes back in time and is lost. All paradoxes are nicely resolved with time.

This will be rather interesting!

If this concept proves itself, it could be implemented on every game. Portal, cnc and wolf3d comes to my mind :) And speaking of time travel – do not forget to watch Lost .

Via Offworld.

Via New Media.

Update:

Theme: Shocking Blue Green. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.