• What Are You Working On? April 2015
    1,741 replies, posted
[t]http://i.imgur.com/ZnXw3Dx.png[/t] Playing around with Android again, managed to figure out the Google Places API and add an autocomplete text field that will suggest nearby locations as the user types them in. Super important and glad I got it sorted out, was a bit of a hassle at first.
Remember back in Half-Life Won, you could change game in the launcher? I recreated [U]Custom GameUI[/U] part for the game, check it out: [video=youtube;lha6jY40uRA]http://www.youtube.com/watch?v=lha6jY40uRA[/video] If people love this, I might make it so you can even edit GameUI layout...
Generic pathfinding: [code]//C# using System; using System.Collections.Generic; using System.Linq; using Wegmacher; namespace Wegmacher_Test { struct I : IInterface<N> { public override string ToString() { return "(" + Origin + ", " + Target + ")"; } public N Origin { get; set; } public N Target { get; set; } } class N : INode<I> { public string Name { get; set; } public override string ToString() { return Name; } public IEnumerable<N> From { get; set; } public IEnumerable<N> To { get; set; } public IEnumerable<I> Incoming { get { return From.Select(n => new I { Origin = n, Target = this }); } } public IEnumerable<I> Outgoing { get { return To.Select(n => new I { Origin = this, Target = n }); } } public bool Equals(INode<I> other) { return ReferenceEquals(this, other); } } static class Program { static void Main(string[] args) { var a = new N { Name = "a" }; var b = new N { Name = "b" }; var c = new N { Name = "c" }; var d = new N { Name = "d" }; a.From = new[] { c }; a.To = new[] { b }; b.From = new[] { a }; b.To = new[] { c }; c.From = new[] { b }; c.To = new[] { a, d }; d.From = new[] { c }; d.To = new N[] { }; Console.WriteLine("aa: " + Pathfinder.BidirectionalFillSearch<N, I>(a, a).ToResultString()); Console.WriteLine("ab: " + Pathfinder.BidirectionalFillSearch<N, I>(a, b).ToResultString()); Console.WriteLine("ac: " + Pathfinder.BidirectionalFillSearch<N, I>(a, c).ToResultString()); Console.WriteLine("ba: " + Pathfinder.BidirectionalFillSearch<N, I>(b, a).ToResultString()); Console.WriteLine("bb: " + Pathfinder.BidirectionalFillSearch<N, I>(b, b).ToResultString()); Console.WriteLine("bc: " + Pathfinder.BidirectionalFillSearch<N, I>(b, c).ToResultString()); Console.WriteLine("ca: " + Pathfinder.BidirectionalFillSearch<N, I>(c, a).ToResultString()); Console.WriteLine("cb: " + Pathfinder.BidirectionalFillSearch<N, I>(c, b).ToResultString()); Console.WriteLine("cc: " + Pathfinder.BidirectionalFillSearch<N, I>(c, c).ToResultString()); Console.WriteLine(); Console.WriteLine("ad: " + Pathfinder.BidirectionalFillSearch<N, I>(a, d).ToResultString()); Console.WriteLine("da: " + Pathfinder.BidirectionalFillSearch<N, I>(d, a).ToResultString()); } static string ToResultString<TItem>(this IEnumerable<TItem> path) { return "[" + path.Select(i => i.ToString()).DefaultIfEmpty("").Aggregate((a, b) => a + ", " + b) + "]"; } } }[/code][code]aa: [] ab: [(a, b)] ac: [(a, b), (b, c)] ba: [(b, c), (c, a)] bb: [] bc: [(b, c)] ca: [(c, a)] cb: [(c, a), (a, b)] cc: [] ad: [(a, b), (b, c), (c, d)] Unbehandelte Ausnahme: System.ArgumentException: Path not found.[/code] The search algorithm result construction code is pretty terrible (and will cause a stack overflow if the path is too long), but otherwise I think I've found a solid foundation. Due to the generics it should still be fairly efficient if you use structs as nodes for pathing through a grid (so you don't have to keep the whole mesh in memory as such) compared to an equally optimised direct implementation... though I should do something about the [I]IEnumerable<T>[/I] boxing in that regard. All implemented algorithms will just as well run on higher-dimensional foams too, since there's no real difference in the interfaces.
[QUOTE=andrewmcwatters;47559386]I forgot to share this in here, but yesterday when I was streaming, I fleshed out more of the [url=http://www.andrewmcwatters.com/grid/tutorials/Getting_Started]Getting Started[/url] and [url=http://www.andrewmcwatters.com/grid/tutorials/Callbacks]Callbacks[/url] articles on the Grid engine's site. [img_thumb]http://i.imgur.com/rvcwsqE.png[/img_thumb] [img_thumb]http://i.imgur.com/FwCzpHO.png[/img_thumb] It's still pretty rough; there's a lot more for me to add, but it's some progress.[/QUOTE] Andrew, I think you might have a grid fetish.
[QUOTE=FacepunchAd;47560405]Bit more progress! Bed now. [vid]https://s3-eu-west-1.amazonaws.com/files.facepunch.com/adam/2015/April/20/killer_moves.mp4[/vid][/QUOTE] Looking superiorly awesome! What's the song, by the way?
D is pure evil [img]https://hostr.co/file/970/EEMUsIfYPVAw/Screenshoton2015-04-20at15.53.40.png[/img] no wonder my models don't load completely (different data in clojure but somehow results in same clojure context -> same data gets processed twice)
[QUOTE=Hentie;47562120]Andrew, I think you might have a grid fetish.[/QUOTE] i can't go to bed unless all of the axes lines on my bedsheets are aligned how can you begin the next day if you don't know where you came from where your origin is
Me using unity for the first time after years of developing in C++ [img]http://d.justpo.st/images/2013/06/315509fe6673efc21ad27021e5a74c36.jpg[/img]
I made a custom Pawn that can bunnyhop in the Unreal Engine. I used the Quake 3 Arena source code to do this. (I may have also accidently recorded my Steam notification sounds too...) [video=youtube;BxGJ_CxKJsk]http://www.youtube.com/watch?v=BxGJ_CxKJsk[/video]
Here's something really curious I found while trying to optimise my (terrible) pathing algorithm: [code]using System; using System.Collections.Generic; using System.Linq; namespace Wegmacher { public static class Pathfinder { public static IEnumerable<TInterface> BidirectionalFillSearch<TNode, TInterface, TEnumerable, TEnumerator>(TNode origin, TNode target) where TNode : INode<TInterface, TEnumerable>, IEquatable<TNode> // Declares TEnumerable Incoming and TEnumerable Outgoing (where TEnumerable : IEnumerable<TInterface, TEnumerator>). where TInterface : IInterface<TNode> where TEnumerable : IEnumerable<TInterface, TEnumerator> // Declares TEnumerator GetEnumerator( where TEnumerator : IEnumerator<TInterface> { if (origin.Equals(target)) { return Enumerable.Empty<TInterface>(); } var originQueue = new Queue<TNode>(); var targetQueue = new Queue<TNode>(); // Irrelevant. // First inner loop (including the GetEnumerator() call and try/finally): var outgoingEnumerator = origin.Outgoing.GetEnumerator(); try { while (outgoingEnumerator.MoveNext()) { var @interface = outgoingEnumerator.Current; // Irrelevant. } } finally { outgoingEnumerator.Dispose(); } // Irrelevant. // Second inner loop: foreach (var @interface in target.Incoming) { // Irrelevant. } // Irrelevant. } } }[/code] The first inner loop never makes a heap allocation. The second inner loop [I]may[/I] make exactly one heap allocation [I]depending only on the type parameters[/I]. Can you guess when and why it does that?
[QUOTE=Hentie;47562120]Andrew, I think you might have a grid fetish.[/QUOTE] Also, come back and have fun with me again.
So yeah, I've been roped into make my uni's union an android app because I thought it would look swanky. Here's the progress I have so far, nothing too complicated. I spent most of my time on it just wrestling with java and the android environment to get it looking half decent (NEVER AGAIN WILL I EVER DESIGN ANDROID CRAP). Landing page: [thumb]http://richardbamford.io/dmp/landing.jpg[/thumb] News page: [thumb]http://richardbamford.io/dmp/news.jpg[/thumb] Some more features include a radio page which streams it live from their servers (slowest connection 2015 by the way).
First time using a third party lib [IMG]http://i.imgur.com/KTe1F8z.jpg[/IMG] [sp]Why rant...Why![/sp]
[QUOTE=gonzalolog;47563069]First time using a third party lib [IMG]http://i.imgur.com/KTe1F8z.jpg[/IMG] [sp]Why rant...Why![/sp][/QUOTE] You are compiling C# 6 in a C# 5 compiler.
Hmmmm... [img]http://i.imgur.com/VhZwjWq.png[/img]
[QUOTE=Sidneys1;47563085]Hmmmm... [img]http://i.imgur.com/VhZwjWq.png[/img][/QUOTE] i see your text-to-machine-gun-sound engine is coming along nicely [editline]20th April 2015[/editline] oh, there's some AAAA's in there, too very convincing victim cries
That's not even the time consuming part, I also have to enumerate victims. [img]http://imgur.com/7SKJN81.png[/img] [editline]xx[/editline] Got the A's done! Any guesses as to what I'm working on? [img]http://imgur.com/JxEoKCF.png[/img]
[QUOTE=Sidneys1;47563173]That's not even the time consuming part, I also have to enumerate victims. [img]http://imgur.com/7SKJN81.png[/img] [editline]xx[/editline] Got the A's done! Any guesses as to what I'm working on? [img]http://imgur.com/JxEoKCF.png[/img][/QUOTE] Some kind of encoding using ATGC (like DNA i believe)?
[QUOTE=RoflKawpter;47563505]Some kind of encoding using ATGC (like DNA i believe)?[/QUOTE] DNA-like encoding is a function of it, yes. :) But the whole project is broader than that. The list of countries will not be encoded, for example. Here's a hint: [img]http://imgur.com/yRB33rR.png[/img]
machine guns, victims, dna i got it! it's a master race calculator
The Genotype database of the whole world? [editline]20th April 2015[/editline] Or the next pandemic game with serious complex gameplay rather than arcade?
[QUOTE=Dostoyevsky;47563532]Or the next pandemic game with serious complex gameplay rather than arcade?[/QUOTE] You got it :) There will be two gamemodes: virus and researcher. In Virus mode you'll have to evolve your DNA sequence to infect then kill the world. Infection rates in a country depend on population density and GDP per capita (which I'm using to roughly estimate their pandemic reaction ability). In Researcher mode you play against the virus trying to cure it, and you can paste in DNA sequences from other players to play against. All very rough, but I think it could be fun to play a more 'realistic' pandemic game. Suggestions are welcome :) Still trying to figure out how to make Researcher mode fun, like what kind of game mechanics would work there.
[QUOTE=Tamschi;47562903][...] The first inner loop never makes a heap allocation. The second inner loop [I]may[/I] make exactly one heap allocation [I]depending only on the type parameters[/I]. Can you guess when and why it does that?[/QUOTE] [URL="https://github.com/dotnet/roslyn/issues/2111"]Here's the solution[/URL], since we talked in FPP about this and found out it's a compiler bug. The C# 5 compiler in VS 2013 at least only makes the mistake once, but the new Roslyn compiler in VS 2015 CTP 6 emits two [I]box !!TEnumerator[/I] instructions. I assume it happens because the conditional choosing the disposal mode doesn't recognise the implicit conversion from [I]TEnumerator[/I] to its constraint [I]IDisposable[/I] (which would at the very least remove the null check, most likely a result of optimising out an [I]as IDisposable[/I]). [editline]edit[/editline] The exact same problem also occurs with [I]using[/I] blocks, at least in VS 2013.
[QUOTE=Sidneys1;47563591]You got it :) There will be two gamemodes: virus and researcher. In Virus mode you'll have to evolve your DNA sequence to infect then kill the world. Infection rates in a country depend on population density and GDP per capita (which I'm using to roughly estimate their pandemic reaction ability). In Researcher mode you play against the virus trying to cure it, and you can paste in DNA sequences from other players to play against. All very rough, but I think it could be fun to play a more 'realistic' pandemic game. Suggestions are welcome :) Still trying to figure out how to make Researcher mode fun, like what kind of game mechanics would work there.[/QUOTE] Color me surprised, I was just kidding. It seems really interesting! I had some ideas about medical games but currently I'm learning "How to set up eclipse" or "What is an interface class" so it'll be waiting a while. I don't think sim-like Researcher mode would be fine, or even real gene sequences. I mean, while even scientists aren't really concluded on how precisely genomes translate into functionality, you are trying to make a game about it. Maybe "Blocks of genes" or something similar, arcadish at UI but complex at heart, would be more fun. P.S.: It is not text based, right?
For now it's text based, but it's modular so I can create any frontend I want. The 'DNA sequence' is just a serialization method, each DNA value (AA, TC, etc) is 4 bits, a BasePair makes a byte, and BasePairs are strung together to get a byte array. Every property of your virus is stored somewhere in the genome. In my first screenshot I was demonstrating storing strings in sequences (each char is stored in a Pair).
Aren't proteins stored in threes though?
Possible candidate for most useless error message ever: [code]ERROR 2006 (HY000): MySQL server has gone away[/code] In other words: your query failed, but if you run it again it will work. But we won't run it again automatically because fuck you.
[QUOTE=Ott;47563817]Aren't proteins stored in threes though?[/QUOTE] Yes, though not all active gene sequences are protein blueprints so I'm fairly sure it's not quite as exact in that regard.
Basic car networking, needs some interpolation though: [vid]http://files.facepunch.com/ziks/2015/April/20/2015-04-20-1842-51.mp4[/vid] Road trip [vid]http://files.facepunch.com/ziks/2015/April/20/2015-04-20-1850-12.mp4[/vid]
[QUOTE=Ott;47563817]Aren't proteins stored in threes though?[/QUOTE] Shhh, it's just eye candy.
Sorry, you need to Log In to post a reply to this thread.