I need some pointers in what people think would be better, performance-wise. (It’s not optimal to use strings as keys, I know)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
public class Trictionary<T> { Dictionary<string, T> values; public Trictionary() { values = new Dictionary<string, T>(); } public byte this[int x, int y, int z] { get { if(values.ContainsKey(x + "|" + y + "|" + z)) return values[x + "|" + y + "|" + z]; return default(T); } } } |
Edit: This is the code I’m using right now. (Takes 2 seconds to fill those 33 million bytes) Although, then I’m limited to setting the max-values, and int.MaxValue in all dimensions doesn’t work (d’uh)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
public class Trictionary<T> { T[,,] val; public Trictionary(int x, int y, int z) { val = new T[x, y, z]; } public T this[long x, long y, long z] { get { if(val[x, y, z] != null) return val[x, y, z]; return default(T); } set { val[x, y, z] = value; } } } |
You can download the remake of the game Ape attack!, once made by Ashen and me.
You can find it here: http://itssimple.se/wp/files/Ape Attack Redux (MultiPlatform).zip
The original game can be found at http://sourceforge.net/projects/apeattack/
Since I saw this post on 9gag:
http://9gag.com/gag/4071400
I made up my mind, so I ordered a SNES, so I can dissassemble it and create my very own version of that SNES Revolution. (Except for the excellent colours of course, I suck at that sort of things)
Will post images when I get each part to the PCSNES.