• What Are You Working On? April 2015
    1,741 replies, posted
[QUOTE=Sidneys1;47503948]Anyone else doing Google Code Jam? :)[/QUOTE] I am now? Not gotten too far though. EDIT: Pretty sure I should at least qualify now, can anyone explain the penalty time, it is just tie breaking right?
[QUOTE=Fourier;47505384]Learning math.. I don't know what fucking retard decided to use u and v symbols together.[/QUOTE] P, p and ρ is also annoying.
[QUOTE=war_man333;47504970]I recently finally passed a driver-writing course. It was mostly Linux, but holy shit writing kernelspace code is like the most frustrating thing ever save writing Assembly-code.[/QUOTE] Windows is worse [editline]11th April 2015[/editline] [QUOTE=Fourier;47505384]Learning math.. I don't know what fucking retard decided to use u and v symbols together.[/QUOTE] it comes before wxyz
Rant's new function definition model is a hell of a lot nicer than [URL="https://github.com/TheBerkin/Rant/blob/master/Rant/Engine/Functions.cs"]the old mess[/URL]... Instead of defining a method with an argument array that you would have to perform type checks/bounds checks/conversions on, you can specify the parameters (and their types) explicitly and Rant will take care of the rest. The return type can be either void or an enumerator, depending on whether the function needs to run any patterns. You can also add function aliases and descriptions, which will be used later for a documentation generator. [img]http://i.imgur.com/DdtkEiB.png[/img]
Updating Grid entities to use bounding boxes, so your pathfinding can be obstructed by them and such. At the moment you can walk through anything, but depth rendering exists which is nice. I was thinking about adding a little diagram to the API documentation so you can get an idea of how to use it. [img]http://i.imgur.com/z3zJTgf.png[/img] Bounding boxes start at the origin, or your entities' positions, and provide depth space for your players or NPCs to walk around, or perhaps even other entities to be obstructed by. Local positions are render offsets that also start at the origin and allow you to draw entities that aren't confined to the tile grid. The standard player is about 2 tiles high for reference, with a bounding box of 1x1 tile, starting at the feet, the origin for player and non-player characters. Pretty simple I think.
I made a distributed mutex library in PHP that uses memcached as its backing engine. It should be fast enough but I might need to make a dedicated mutex daemon using something like ZeroMQ if it doesn't scale well.
[QUOTE=Map in a box;47505503]Windows is worse[/QUOTE] probably. but we were all running linux virtually on our laptops during class, so development was slow and tedious, especially when you were completely unfamiliar with linux, like I was. So in the end, I failed the course my first time, along with 7 others. [img]http://i.imgur.com/npeFbJW.png[/img] we passed it the second time, and that's right, I'm the left nut on this picture. yup I got a really satisfying grade D.
[QUOTE=cra0kalo;47504229]wrote past the array bounds inside my driver haha not too kind windows kernel :< [t]https://dl.dropboxusercontent.com/u/10798900/Pictures/20150409_194048.jpg[/t] working on driver stuff[/QUOTE] Any kind of tutorials for this kind of stuff available ?
-snip-
made it possible to walk on terrain [t]https://dl.dropboxusercontent.com/u/9580892/walk.png[/t] not sure why the textures look so wonky, probably my OpenGL settings :/ and sorry for the lack of WebMs, I lost the guide to making them :v:
[QUOTE=Fourier;47504084]Those problems are quite hard.. but first one with audience looks easy @Google code jam[/QUOTE] Did you do any of the later problems, I would like to know a better solution (and how it works) to the pancake problem than mine: [url]https://gist.github.com/benpye/58b03cb142729c01daf6[/url] [editline]12th April 2015[/editline] [QUOTE=The Inzuki;47507392]made it possible to walk on terrain [t]https://dl.dropboxusercontent.com/u/9580892/walk.png[/t] not sure why the textures look so wonky, probably my OpenGL settings :/ and sorry for the lack of WebMs, I lost the guide to making them :v:[/QUOTE] No anisotropic filtering?
[QUOTE=ben1066;47508457]No anisotropic filtering?[/QUOTE] [t]https://dl.dropboxusercontent.com/u/9580892/mipmap.png[/t] eh, kinda better
[QUOTE=Fourier;47505384]Learning math.. I don't know what fucking retard decided to use u and v symbols together.[/QUOTE] The worst by far are likely v and &#957;. At least it's clear in my handwritten notes, because there's an extra bit on the v. This is physics though and even then it's unlikely to get both at the same time as scalars.
I'm making good progress on my console software renderer, I implemented directional lightning: [vid]http://dl.dropboxusercontent.com/u/25639311/ShareX/2015/04/2015-04-12_04-42-37.mp4[/vid] I wish I could use more than 16 colors but this doesn't look too bad tbh. Thats a 16 color greyscale palette, it looks like this: [IMG]http://i.imgur.com/2bEDQPJ.png[/IMG] The lightning doesn't look bad but textures AND lightning is pretty much impossible with just 16 colors. Well not impossible, but it just would look pretty bad. I also re-wrote the rasterizer(again), it's not particularly faster, but it is a lot simpler. Next I will work on point lights, sphere generation or whatever else comes to mind. Oh and I've also moved from a 4x8 (4x4 halfblock) Consolas font to a 4x6 (4x3 halfblock), anything other than Raster Fonts will cause bugs when different colored chars are drawn in different calls, lines will appear between the halfblocks. This new font and size is a bit off, but I can live with 1 pixel error value. With other fonts I can set the size to what ever I want (even 1x1) but face the bugs, with Raster Fonts the lowest I can go is 4x6, but no bugs.
[QUOTE=Berkin;47502133]*holy fucking shit* I have just paid a visit to the depths of reflection hell and emerged, triumphant, with this delightfully skin-melting masterpiece: What you are witnessing before you is a set of classes designed to generate delegates from reflected Rant methods, allowing them to be invoked with an object array that provides the necessary arguments. The horrific torrent of generic classes spurting forth from this page of code is instantiated purely through reflection, extracting the parameter types from the MethodInfo instances themselves and applying them to the type arguments on the classes. No generics are used by hand. This model is much faster than MethodInfo.Invoke, and prevents spontaneous human combustion by casting the boxed invocation arguments to their proper types before invoking the delegate. Unfortunately, it also means that I have to write two new classes for every parameter count possibility. But I went crazy long ago, so I don't mind. Thanks to Tamschi for sharing his vast expertise on [del]the ritual[/del] reflection.[/QUOTE] While Func and Action are implemented this way, how much of a speed advantage do generics even provide? I imagine a Witchcraft constructor that accepts an array of types isn't much different from instantiating generic versions of Witchcraft via reflection. I believe there are even ways to dynamically create new generic types, not instances of types, using Reflection.Emit or CodeDom.
I'm considering removing a cool feature from Grid to decrease internal code complexity. In builds up to Grid build 747, you can do stuff like this: [lua]class "rat" ( "npc" ) function rat:rat() npc.npc( self ) self:networkNumber( "aggressiveness", 0 ) end [/lua] That network number generates a set of network variable helper methods. You can then do stuff like: [lua]function rat:update() local aggressiveness = self:getAggressiveness() if ( aggressiveness == 0 ) then -- Occasionally make rat sounds elseif ( aggressiveness >= 1 ) then -- Occasionally attack nearby players, when they die, call self:setAggressiveness( 0 ) end if ( aggressiveness == 2 ) then -- Emit particles from eyes end end [/lua] Due to the way classes are rewritten with real-time scripting enabled, these helper methods have to be regenerated when the class is redefined. This is a hairy process, and the code involved adds complexity that doesn't need to be there. It's annoying internally, and Grid is suppose to be super lightweight and fast. Having these helper methods around to begin with causes an additional function to be pushed onto the stack before you can even retrieve the network variable value you want. When I remove this feature, it'll decrease various entity-related parts of the engine in LOC. Unfortunately the code above will have to change into something like this instead: [lua]function rat:update() local aggressiveness = self:getNetworkVar( "aggressiveness" ) if ( aggressiveness == 0 ) then -- Occasionally make rat sounds elseif ( aggressiveness >= 1 ) then -- Occasionally attack nearby players, when they die, call self:setNetworkVar( "aggressiveness", 0 ) end if ( aggressiveness == 2 ) then -- Emit particles from eyes end end [/lua] On the plus side, you'll always know what variables are networked after this change. Does this seem like that big of a deal? I'm hoping not, but I was wondering what you guys thought.
[QUOTE=Pappschachtel;47506094]Any kind of tutorials for this kind of stuff available ?[/QUOTE] MSDN is where I started and also got help from a few friends. Heres the Halo Online DAT tool v1.0 working on that atm [IMG]https://halowiki.llf.to/images/0/0d/HDAT.png[/IMG] [url]https://github.com/cra0kalo/eldorado_dat[/url] [url]https://halowiki.llf.to/index.php?title=DatExtractor[/url]
I didn't really post about this before, so here's how to use ScanT to parse a binary file: [code]var largeBytes = from _ in (IPattern<IScanner<long, byte>, Nothing>)Template.SkipFew<long>() from x in Template.One<byte>(@byte => @byte >= 200) select x; Console.WriteLine("Parsing a file: "); foreach (var match in largeBytes.MatchOn(File.OpenRead(@"C:\Programmierkram\Detection.pdf").GetScanner())) { Console.Write(match); Console.Write(' '); }[/code][code]Parsing a file: 226 227 207 211 202 222 242 238 218 255 226 254 207 202 201 203 [...][/code] It's annoying that I have to use that manual cast to [I]IPattern<IScanner<long, byte>, Nothing>[/I]. [I]IPattern<,>[/I] is contravariant on the first type parameter and [I]IScanner<long, byte>[/I] is the closest common derived type of [I]IScanner<long>[/I] and [I]IEnumerator<byte>[/I], but it seems type inference isn't quite smart enough to notice that yet. Overall there are extension methods to get a scanner from a [I]Stream[/I], a [I]string[/I] or an [I]IReadOnlyList<>[/I] and to get a tracker from an [I]IEnumerable[/I]([I]<>[/I]). There's also the option to get a very slow scanner from the latter types, but I may change that to a wrapper around any tracker instead. Seeking on it is &#920;(n), so it's really not recommended to use plain forward enumerators as input for a backtracking parser.
Animations and player models [vid]http://files.facepunch.com/layla/2015/April/12/2015-04-12_06-46-30.mp4[/vid]
[QUOTE=elevate;47508958]While Func and Action are implemented this way, how much of a speed advantage do generics even provide? I imagine a Witchcraft constructor that accepts an array of types isn't much different from instantiating generic versions of Witchcraft via reflection. I believe there are even ways to dynamically create new generic types, not instances of types, using Reflection.Emit or CodeDom.[/QUOTE] Witchcraft [I]does[/I] dynamically generate generic types. The reason it does so is because it is impossible to know the necessary types at compile time, as the incoming method's parameter types can't be predicted past the first one, which is a Sandbox object. As for speed advantages, I ran the same obnoxious pattern under both the old and new methods. Here is what I got: [B]Using MethodInfo.Invoke:[/B] [img]http://i.imgur.com/2vDkVR8.png[/img] [B]Using Witchcraft:[/B] [img]http://i.imgur.com/eD3UFIx.png[/img] There is some variation, but I have observed a general trend of the running time being cut in half. Sometimes going to the dark side pays off!
[QUOTE=Berkin;47509516]Witchcraft [I]does[/I] dynamically generate generic types. The reason it does so is because it is impossible to know the necessary types at compile time, as the incoming method's parameter types can't be predicted past the first one, which is a Sandbox object. As for speed advantages, I ran the same obnoxious pattern under both the old and new methods. Here is what I got: [B]Using MethodInfo.Invoke:[/B] [img]http://i.imgur.com/2vDkVR8.png[/img] [B]Using Witchcraft:[/B] [img]http://i.imgur.com/eD3UFIx.png[/img] There is some variation, but I have observed a general trend of the running time being cut in half. Sometimes going to the dark side pays off![/QUOTE] Shouldn't you be using the same seed for all tests?
[QUOTE=ben1066;47508457]Did you do any of the later problems, I would like to know a better solution (and how it works) to the pancake problem than mine: [url]https://gist.github.com/benpye/58b03cb142729c01daf6[/url] [/QUOTE] It was a really tricky one. I had originally assumed that the best tactic is to always take halfs of stacks. Then I would do those halvings at the start and after each one see if it's a better idea to let them eat or to continue halving. That didn't work. What finally did was this: First, we observe each stack separately. Call the current one S (and the number of pancakes on it #S). for every number from i from 1 to #S integer divide #S with i and call that d, but rounding up. This tells you the size of the biggest stack after you split S into i stacks. This would take you i - 1 minutes and then d more to eat them. So for each S we made a list of pairs (i, d). The next step is eliminating the entries that have the same d leaving only the ones with the lowest i. This is because you can split 9 pancakes 5 times or 6 times, your tallest stack will still be 2 high and you don't gain anything. So it's obviously better to get the same result with the lowest number of splits since each takes a minute. Now the key part. We find the greatest #S, call it M. Then for numbers j from 1 to M we see what's the best we can do in terms of splits if we decide to only allow j minutes of eating afterwards. We take the best pair (i, d), where d is less or equal than j, and i is the lowest such, out of every stacks list, add all the 'i's together and add the maximal d out of all of them. This gives us the time in minutes it would take to split up all the stacks to the desired size (less or equal to j) and then eat them all. The final answer is the lowest of those numbers generated by j.
[QUOTE=Berkin;47509516]Witchcraft [I]does[/I] dynamically generate generic types. [...][/QUOTE] It doesn't, it dynamically [I]constructs[/I] them. What elevate means is generating generic types with various amounts of type parameters, which would mean using dynamic methods, which is not supported by Unity on all platforms as far as I know.
[QUOTE=layla;47509233]Animations and player models [/QUOTE] Even some rudimentary multiplayer in this would be amazing. Double amazing if it's doable via web player/webGL... but that's a lot of data I guess.
[QUOTE=Superwafflez;47509675]Even some rudimentary multiplayer in this would be amazing. Double amazing if it's doable via web player/webGL... but that's a lot of data I guess.[/QUOTE] And illegal unless you have the players open all necessary files manually :v: (Dragging the folder into the browser window [I]may[/I] work though.)
Okay that's it. I'm going to write a fucking virus that deletes comic sans from infected computers.
[QUOTE=andrewmcwatters;47508999]I'm considering removing a cool feature from Grid to decrease internal code complexity. In builds up to Grid build 747, you can do stuff like this: [lua]class "rat" ( "npc" ) function rat:rat() npc.npc( self ) self:networkNumber( "aggressiveness", 0 ) end [/lua] That network number generates a set of network variable helper methods. You can then do stuff like: [lua]function rat:update() local aggressiveness = self:getAggressiveness() if ( aggressiveness == 0 ) then -- Occasionally make rat sounds elseif ( aggressiveness >= 1 ) then -- Occasionally attack nearby players, when they die, call self:setAggressiveness( 0 ) end if ( aggressiveness == 2 ) then -- Emit particles from eyes end end [/lua] Due to the way classes are rewritten with real-time scripting enabled, these helper methods have to be regenerated when the class is redefined. This is a hairy process, and the code involved adds complexity that doesn't need to be there. It's annoying internally, and Grid is suppose to be super lightweight and fast. Having these helper methods around to begin with causes an additional function to be pushed onto the stack before you can even retrieve the network variable value you want. When I remove this feature, it'll decrease various entity-related parts of the engine in LOC. Unfortunately the code above will have to change into something like this instead: [lua]function rat:update() local aggressiveness = self:getNetworkVar( "aggressiveness" ) if ( aggressiveness == 0 ) then -- Occasionally make rat sounds elseif ( aggressiveness >= 1 ) then -- Occasionally attack nearby players, when they die, call self:setNetworkVar( "aggressiveness", 0 ) end if ( aggressiveness == 2 ) then -- Emit particles from eyes end end [/lua] On the plus side, you'll always know what variables are networked after this change. Does this seem like that big of a deal? I'm hoping not, but I was wondering what you guys thought.[/QUOTE] Personally, I think I'd prefer the change. If it makes it far less complex, and all you have to trade in is writing a slightly longer line, then by all means go for it. I also think the second one is easier to follow if you quickly look at the source, as it's immediately clear that it's a networked variable instead of a normal method.
[QUOTE=Tamschi;47508676]The worst by far are likely v and &#957;. At least it's clear in my handwritten notes, because there's an extra bit on the v. This is physics though and even then it's unlikely to get both at the same time as scalars.[/QUOTE] Yes, it's scalars and also integrals [IMG]http://mathworld.wolfram.com/images/equations/IntegrationbyParts/NumberedEquation2.gif[/IMG] And yes your case for physics v=speed and v=frequency is crazy too, I got lost here too. (I have Dyslexia and everything looks same too me)
[QUOTE=Tamschi;47509682]And illegal unless you have the players open all necessary files manually :v: (Dragging the folder into the browser window [I]may[/I] work though.)[/QUOTE] So long as all participants have purchased the base game you should be sweet!
[QUOTE=andrewmcwatters;47508999] [lua]function rat:update() local aggressiveness = self:getNetworkVar( "aggressiveness" ) if ( aggressiveness == 0 ) then -- Occasionally make rat sounds elseif ( aggressiveness >= 1 ) then -- Occasionally attack nearby players, when they die, call self:setNetworkVar( "aggressiveness", 0 ) end if ( aggressiveness == 2 ) then -- Emit particles from eyes end end [/lua] On the plus side, you'll always know what variables are networked after this change. Does this seem like that big of a deal? I'm hoping not, but I was wondering what you guys thought.[/QUOTE] I reckon this way makes much more sense. Look me a second to realize that getAggressiveness was actually a network helper function. But, even if you knew about these helper functions, imagine what it would look like if you had a series of methods on the rat class that were something like: [i]getLegCount[/i], [i]getWhiskerCount[/i], [i]setSqueakNoise[/i] It's not immediately obvious that [i]getWhiskerCount[/i] is a standard method and [i]getAggressiveness[/i] is a network helper I think a little more verbosity is a good thing in this case, and so yeah I'd say it's a good change
Sorry, you need to Log In to post a reply to this thread.