• What Are You Working On? - December 2014
    1,204 replies, posted
[QUOTE=Mega1mpact;46692552]Often I comment blocks containing magic code written by unix elders on top of mnt C with stuff threatening the reader not to touch the code or else.[/QUOTE] [CODE] /** * For the brave souls who get this far: You are the chosen ones, * the valiant knights of programming who toil away, without rest, * fixing our most awful code. To you, true saviors, kings of men, * I say this: never gonna give you up, never gonna let you down, * never gonna run around and desert you. Never gonna make you cry, * never gonna say goodbye. Never gonna tell a lie and hurt you. */[/CODE] [URL="http://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered"]worth a read[/URL]... I can't find it right now because I removed it, but there was a comment on a try/catch that basically stated "don't throw errors or the user's know it failed"
[QUOTE=Banandana;46674003]I'd honestly not waste your time with XNA. [editline]8th December 2014[/editline] I comment my code :/ Mini Poll: [img]http://www.facepunch.com/fp/ratings/tick.png[/img] You comment your code. [img]http://www.facepunch.com/fp/ratings/cross.png[/img] You don't comment your code.[/QUOTE] I comment some of my code, [url]https://github.com/benpye/Scissors/blob/94ebbfdbad386080debce3105666ea0dc05b2265/Scissors/Engine.cs#L133[/url] for example I have quite a lot of comments because there are similarly named variables and interaction with Duktape's stack.
I'm releasing a version of the dungeon crawler I'm working on here so I can get feedback before I start to prepare it for a release on the android market (this is a pc version though). Here's a screenshot to whet your appetites: [img]http://i.imgur.com/5G2kcqY.png[/img] Please let me know what you think if you try it out! It's still a big work in progress but the main features are mostly in and complete. [url="https://fs04n1.sendspace.com/dl/42d1672e8799472d3c4b619b6b9eb597/548a17c24272fcb4/ofg9jj/EndofTheLine.exe"] Download here.[/url]
[QUOTE=chaz13;46693447]I'm releasing a version of the dungeon crawler I'm working on here so I can get feedback before I start to prepare it for a release on the android market (this is a pc version though). Here's a screenshot to whet your appetites: [img]http://i.imgur.com/5G2kcqY.png[/img] Please let me know what you think if you try it out! It's still a big work in progress but the main features are mostly in and complete. [url="https://fs04n1.sendspace.com/dl/42d1672e8799472d3c4b619b6b9eb597/548a17c24272fcb4/ofg9jj/EndofTheLine.exe"] Download here.[/url][/QUOTE] Cool game, the atmosphere & sounds give it a nice setting. The only thing I didn't really like was trying to target enemies, they moved around so often and fast I ended up clicking the ground and moving somewhere unintended just as often as I attacked. It does add a level of difficulty and might be easier to handle on a touchscreen, so it's not a bad thing, but might feel smoother if enemies didn't move so randomly & often. I've been trying to come up with a Fog of War algorithm since last night. I did some Googling and found a common method is to place a layer/texture between the camera & level, then alter transparency based on where the player has explored. Just curious, is this similar to how you achieved your FoW?
Guys Rant got promoted by [B][URL="https://twitter.com/msdev/status/543118017790746624"]fucking Microsoft[/URL][/B]. [U][I]HOLY CRAP[/I][/U]
I wonder why a pattern matching statement hasn't been added to C# yet. It has so many other functional features. I'd like something like this, though I'm not sure on the syntax, I Was thinking something like a switch statement. [code] match(x) { with 1 | 2 | 3 : () => Console.WriteLine("123"), with x > 3 : () => Console.WriteLine(">3"), with x < 1 : () => { Console.WriteLine("less than 1"); Foo(); }, default : () => return } [/code] You can do this now with a switch(with nested if statements) or linq but some syntactic sugar would be nice.
[QUOTE=Rocket;46695379]Get a quest in Skyrim. "I lost my dirty kumquat in a morgue of victorious peacocks. Can you find it for me?"[/QUOTE] I would play the hell out of such a quest.
[QUOTE=reevezy67;46695388]I wonder why a pattern matching statement hasn't been added to C# yet.[/QUOTE] There's [url=https://roslyn.codeplex.com/discussions/560339]a draft for it[/url], but it didn't make it into C# 6. Maybe next time.
Looks good, enabling the pattern matching on a switch statement is probably a better idea.
[QUOTE=reevezy67;46695701]Looks good, enabling the pattern matching on a switch statement is probably a better idea.[/QUOTE] The thing is, pattern matching without discriminated unions/sum types sucks. Normal objects don't really work well under structural examination since they all look the same so you're more or less only left with examples like yours. Also worth noting that you can't just use any boolean expression as a pattern since you can't check exhaustiveness, though I'm sure many wouldn't care about that. The spec Rohans linked includes record types, but it really doesn't look that good to me. Everything it way to wordy to be used effectively. You need a keyword for every action you want to do, you need a brace for every bit of code... I don't know man. C# is great at what it is, but it isn't a functional language. There's more to it than having lambdas. And while I would appreciate some fancy features added, I'd rather not have another C++. There has to be a point where you need to ask your self why you're not using F# instead.
[QUOTE=Crayz;46682277]... My subclass setup is pretty slick, so creating various unit types or buildings should be cake as soon as I have the core all coded in. ...[/QUOTE] My structure wasn't as slick as I once thought. Ended up re-arranging my class structure/object orientation for the ~fourth time. I'm pretty happy with where its at now. Even added some new unit mechanics. Patrolling, line of sight, aggro, and some gizmos to help with debugging. The spheres display line of sight, which differs from attack range. White line = unit has an active target to chase/attack. If the target gets too far away he'll lose focus and run to the targets last known position. Near the middle of the clip the chasing unit sets his target to the blue building, it looks like he chose the new target because its easier/closer but he just lost focus on the previous target, scanned for a new one and found the building. [url]https://dl.dropboxusercontent.com/u/96502721/S/unitmechanic.mp4[/url]
[QUOTE=Crayz;46696361]My structure wasn't as slick as I once thought. Ended up re-arranging my class structure/object orientation for the ~fourth time. I'm pretty happy with where its at now. Even added some new unit mechanics. Patrolling, line of sight, aggro, and some gizmos to help with debugging. The spheres display line of sight, which differs from attack range. White line = unit has an active target to chase/attack. If the target gets too far away he'll lose focus and run to the targets last known position. Near the middle of the clip the chasing unit sets his target to the blue building, it looks like he chose the new target because its easier/closer but he just lost focus on the previous target, scanned for a new one and found the building. [URL]https://dl.dropboxusercontent.com/u/96502721/S/unitmechanic.mp4[/URL][/QUOTE] That's how it usually goes. OOP works when you know EXACTLY what you want but it's rarely extensible enough. I suspect that's why it's great for business stuff where you know the exact specification for what you're doing. Take a look at component systems for an example of a more flexible solution. (Unity uses that design, right?)
[QUOTE=2sp00ky;46691644]Im working on a game inspired by smash bros and shovel knights. -snip-[/QUOTE] Suggestion: try giving the camera a "dead zone", like a box around the character where the camera will not follow the character until he tries to get out of the box. That might make the movement look smoother.
[QUOTE=Darwin226;46696261]There has to be a point where you need to ask your self why you're not using F# instead.[/QUOTE] I've seen F# code in the hundreds of lines compile slower than code that uses Boost.Fusion in the thousands. C# is nice because of its incremental development. F# doesn't really have this, and attempts to force the compiler to work faster is a quick descent into madness.
[QUOTE=Chandler;46696522]I've seen F# code in the hundreds of lines compile slower than code that uses Boost.Fusion in the thousands. C# is nice because of its incremental development. F# doesn't really have this, and attempts to force the compiler to work faster is a quick descent into madness.[/QUOTE] F# doesn't have some intrinsic quality that makes compiling it slow. Much more complex languages manage to compile much faster so I can only conclude that it's an implementation issue. In any case, if F# is the functional-for-.NET language, then it doesn't really make sense to try and bring C# closer to it by introducing features that, like it or not, simply don't fit with the way the rest of the language is designed. I realize that F# isn't strictly a MS language, but I don't think that really matters. If any efforts are taken, it would be better to direct them towards making F# more usable instead of stapling on out-of-place features on a language that doesn't fit them. As it currently stands, the whole .NET-VS combo makes it very easy to combine C# and F# so you're free to only use F# for parts of your solution that benefit from it while always having an escape route if compile times really become a problem. Slightly less on topic: Compile times are probably due to a slow type inference engine. The fact that it's not an established standard to include type annotations for top-level functions probably doesn't help. I've implemented type level naturals and couldn't even build the solution when I tried to add 3 + 3 when the same thing in Haskell is instant.
[QUOTE=Darwin226;46696261]The thing is, pattern matching without discriminated unions/sum types sucks. Normal objects don't really work well under structural examination since they all look the same so you're more or less only left with examples like yours. Also worth noting that you can't just use any boolean expression as a pattern since you can't check exhaustiveness, though I'm sure many wouldn't care about that. The spec Rohans linked includes record types, but it really doesn't look that good to me. Everything it way to wordy to be used effectively. You need a keyword for every action you want to do, you need a brace for every bit of code... I don't know man. C# is great at what it is, but it isn't a functional language. There's more to it than having lambdas. And while I would appreciate some fancy features added, I'd rather not have another C++. There has to be a point where you need to ask your self why you're not using F# instead.[/QUOTE] I think you are right but I would like to see extended capabilities for switch statements allowing boolean expressions other than equals.
[QUOTE=reevezy67;46696612]I think you are right but I would like to see extended capabilities for switch statements allowing boolean expressions other than equals.[/QUOTE] Yeah. I've wondered why those weren't included before. I think it's probably because the internal implementation of switches doesn't have to follow the same order you have in code and might even be implemented as a jump table. This can't be done with non-constant expressions.
[QUOTE=reevezy67;46695388]I wonder why a pattern matching statement hasn't been added to C# yet. It has so many other functional features. I'd like something like this, though I'm not sure on the syntax, I Was thinking something like a switch statement. [code] match(x) { with 1 | 2 | 3 : () => Console.WriteLine("123"), with x > 3 : () => Console.WriteLine(">3"), with x < 1 : () => { Console.WriteLine("less than 1"); Foo(); }, default : () => return } [/code] You can do this now with a switch(with nested if statements) or linq but some syntactic sugar would be nice.[/QUOTE] Actually, Visual Basic already lets you do something like this: [code] Select Case x Case 1 To 3 Console.WriteLine("123") Case Is > 3 Console.WriteLine(">3") Case Is < 1 Console.WriteLine("less than 1") Foo Case Else Return End Select [/code]
[QUOTE=Crayz;46695054]Cool game, the atmosphere & sounds give it a nice setting. The only thing I didn't really like was trying to target enemies, they moved around so often and fast I ended up clicking the ground and moving somewhere unintended just as often as I attacked. It does add a level of difficulty and might be easier to handle on a touchscreen, so it's not a bad thing, but might feel smoother if enemies didn't move so randomly & often. [/QUOTE] Thanks for the feedback! The little button in the bottom right which shows the enemy and a percentage can be clicked to attack them without clicking directly on them - already noticed that being a massive problem on my phone so I figured that was a fairly good solution! Thanks for trying it out :smile:
Well these are just assets but oh well: [t]http://i.imgur.com/yliOIas.png[/t] [t]http://i.imgur.com/d2IyYdt.png[/t] We've also been implementing a way to store what we call "patterns" which are handmade sequences/patterns for the game objecs to appear (e.g. monsters, obstacles, powerups and so on) and who knew Hashtables are not serializable in C#..
[QUOTE=horsedrowner;46696784]Actually, Visual Basic already lets you do something like this: [code] Select Case x Case 1 To 3 Console.WriteLine("123") Case Is > 3 Console.WriteLine(">3") Case Is < 1 Console.WriteLine("less than 1") Foo Case Else Return End Select [/code][/QUOTE] I believe you can use case 1..3: in C#
You can't.
I don't understand people using case; isn't it for predictable jumps without the need of comparing two things? If you're using case for those things, how is that any different to an if/elseif/else chain, apart from a slightly different syntax?
Music from BIT.TRIP Runner Messing around with art styles and whatnot. [vid]http://a.pomf.se/guxhrs.mp4[/vid]
[QUOTE=COBRAa;46697169]I don't understand people using case; isn't it for predictable jumps without the need of comparing two things? If you're using case for those things, how is that any different to an if/elseif/else chain, apart from a slightly different syntax?[/QUOTE] if/else chains are ugly, it would just help to make code more clear and concise.
Working on a linear algebra thing. Nothing much so far. Only dot products, determinants, zipping and multiplication. But it does have pretty printing! [code]*Linear> let a = fromMapping 3 3 (\i j -> i ^ j) *Linear> prettyPrint a &#9484; &#9488; &#9474; 1 0 0 &#9474; &#9474; 1 1 1 &#9474; &#9474; 1 2 4 &#9474; &#9492; &#9496; *Linear> let b = Linear.transpose a *Linear> prettyPrint b &#9484; &#9488; &#9474; 1 1 1 &#9474; &#9474; 0 1 2 &#9474; &#9474; 0 1 4 &#9474; &#9492; &#9496; *Linear> prettyPrint $ a `mult` b &#9484; &#9488; &#9474; 1 1 1 &#9474; &#9474; 1 3 7 &#9474; &#9474; 1 7 21 &#9474; &#9492; &#9496;[/code]
[video=youtube;t1yZANn6jv0]http://www.youtube.com/watch?v=t1yZANn6jv0&feature=youtu.be[/video] Oops :pwn:
[QUOTE=Berkin;46695165]Guys Rant got promoted by [B][URL="https://twitter.com/msdev/status/543118017790746624"]fucking Microsoft[/URL][/B]. [U][I]HOLY CRAP[/I][/U][/QUOTE] Congrats dude. What could this exactly mean for you? Is it something you could throw on a resume? like "I'm the dude who made rant" and hopefully if the hiring manager knows a thing or two about actual coding they'll recognize what that is? I would start recording every bit of recognition it gets so that you can throw that on a resume
Just found out you can define classes in matlab. That would've made the last two years of my life much easier :v:
[QUOTE=AtomiCal;46697208]Music from BIT.TRIP Runner Messing around with art styles and whatnot. [vid]http://a.pomf.se/guxhrs.mp4[/vid][/QUOTE] Very clearly inspired from [url=https://www.youtube.com/watch?v=gs8PpRTGs0Y]Edge[/url], which is a (great) game that has [url=https://www.youtube.com/watch?v=7FTnMVOuNKM]really great music[/url].
Sorry, you need to Log In to post a reply to this thread.