|
M31 posted:It's seems like a good fit, but in the real world it doesn't work. You can make an Orc class, but then you get an PlayableOrc and a NonPlayableOrc, and the NonPlayableOrc has a friendly version and a non friendly version, etc.. And C# does not have multiple inheritance. Wouldn't you want to use some combination? An Orc Wizard doesn't need to be split up into Playable and Nonplayable, it'd just have a flag for friendly vs hostile, and it could have a Background object for individual named Orcs with backstories. Ignoring that C# does not have multiple inheritance for a moment And this example doesn't even appear to be using Composition. There aren't hardly any objects inside of this class, it's just a bunch of attributes, methods, and enums QuarkJets fucked around with this message at 10:54 on Sep 22, 2014 |
# ? Sep 22, 2014 10:50 |
|
|
# ? Jun 8, 2024 07:53 |
|
Whoops, I meant component based instead of composition.
|
# ? Sep 22, 2014 10:58 |
|
QuarkJets posted:Ignoring that C# does not have multiple inheritance for a moment This is why you would say fuckit and put all the attributes in one class.
|
# ? Sep 22, 2014 13:01 |
|
Tough times on the road to Starcraft is a great read, and the "game engine architecture" section is relevant to this discussion.
|
# ? Sep 22, 2014 14:13 |
|
Required reading for all game engine programmers: http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy/ It's by one of the people working on the Tony Hawk games. It describes the challenges they faced with big blob objects and how their stuff into components ease the pain.
|
# ? Sep 22, 2014 15:18 |
|
I recently looked through one of my old projects that scraped a game's forums general discussion and ran it through a Markov chain. It was in Python using Django and god some of this crap I wrote is awful. code:
|
# ? Sep 22, 2014 15:47 |
|
Edison was a dick posted:The video http://vimeo.com/9270320 makes a lot of points and actually has researched them. One of the conclusions that lines of code is the best metric that actually works, the more you have, the more bugs you have, and humans can't really manage more than 200 lines of code at once. What can't be more than 200 lines of code? The whole class? A single method? The template that expands repeatedly into the boilerplate for serialization? The total compilation unit with includes? That having more code means having more bugs seems uncontroversial, or does it mean more bugs per KLOC? My spidey sense has learned to prefer clear-but-verbose in terms of reducing bug habitat. (The video has crashed every browser on my phone, but I might try it later.)
|
# ? Sep 22, 2014 16:01 |
|
Subjunctive posted:What can't be more than 200 lines of code? The whole class? A single method? The template that expands repeatedly into the boilerplate for serialization? The total compilation unit with includes i think its 200 loc that the average developer can internalize and think about at the same time.
|
# ? Sep 22, 2014 16:14 |
|
That is bogus, because how easy something to internalize is depends on how complicated it is. Multi-threaded problems vs. single-threaded problems is one example, but really in general, the ability to understand something is related more closely to the size of the state space and not how many lines of code it takes.
|
# ? Sep 22, 2014 16:27 |
|
FamDav posted:i think its 200 loc that the average developer can internalize and think about at the same time. I'm not sure what that means. If I'm working on a block of code that manipulates 20 types, each with 10 fields, do I have zero left for the code itself?
|
# ? Sep 22, 2014 16:33 |
|
Subjunctive posted:I'm not sure what that means. If I'm working on a block of code that manipulates 20 types, each with 10 fields, do I have zero left for the code itself? Well yeah, you've run out of stack space at that point.
|
# ? Sep 22, 2014 16:39 |
|
hobbesmaster posted:Well yeah, you've run out of stack space at that point. Seems unlikely. It's not uncommon for a single line in Java to reference 5 types, through property chaining and so forth. Java code:
|
# ? Sep 22, 2014 16:46 |
|
Shinku ABOOKEN posted:Required reading for all game engine programmers: Blob objects include functionality that's ill-defined and covers large parts of the game that aren't necessarily related in the first place. If the class also controls the lifecycle of the character in the world, their position, scheduling, saving and loading etc. then it's definitely a blob. This includes the stats related to a single character plus derived stats and related methods. It feels disorganized and has a lot of stuff in there, but there is a very defined focus of what the class is and what it does. Giving a concrete alternative rather than saying just "refactor it" makes unexamined assumptions more clear. How expensive is having a separate object per basic character stat in the big scheme of things? How much logic can actually be stuck into such a class? Are some calculations dependent on enough factors that we're just going to end up passing the rest of the object into the supposedly independent functions in the first place? Would pulling backgrounds, classes, races, cultures and the like into separate objects add flexibility that we have the resources to take advantage of?
|
# ? Sep 22, 2014 17:01 |
Subjunctive posted:Seems unlikely. It's not uncommon for a single line in Java to reference 5 types, through property chaining and so forth. No no. ret = ButtBuilder.buttSize(10).buttDepth(DEFAULT_BUTT_DEPTH).buttHeight(10).build();
|
|
# ? Sep 22, 2014 17:07 |
|
The world's first cryptocurrency written in PHP
|
# ? Sep 22, 2014 19:32 |
|
http://dcoinforum.org/index.php?topic=9.0 posted:3rd year My bolding
|
# ? Sep 22, 2014 21:26 |
|
David Wynn: Miner
|
# ? Sep 22, 2014 23:06 |
|
ErIog posted:Most of the ire toward Unity in the game dev community is somewhat recent, though. So I wouldn't really blame anyone for having picked it for their project that's been in development for a long time. If a dude's got time to decompile and bitch about what he finds online then the Unity engine itself a much more target-rich environment for horrors. Honestly it's still great for what it is. It's My First Game Studio, and it does a pretty OK job of balancing user friendliness with capability. Pretty much every product has some rough corners, the question is total time relative to the alternative. My understanding is that building your game on something like Unreal is going to involve a lot more effort and up-front investment. Paul MaudDib fucked around with this message at 23:29 on Sep 22, 2014 |
# ? Sep 22, 2014 23:13 |
|
Paul MaudDib posted:Honestly it's still great for what it is. It's My First Game Studio, and it does a pretty OK job of balancing user friendliness with capability. The reality is there is nothing wrong with a framework, engine, environment, or whatever that makes it easy for people to get started. When you reach the limits of that system, it's a sign that you need to move on to something deeper. I don't think I'd want to tackle Unreal with my first game project.
|
# ? Sep 23, 2014 01:20 |
|
Database horror, also kind of funny. The columns in a Contract_SpecialPricing table. The database has 280+ tables, and is generally normalized, I'm hoping this is just an outlier.code:
|
# ? Sep 23, 2014 06:25 |
|
Edison was a dick posted:The video http://vimeo.com/9270320 makes a lot of points and actually has researched them. One of the conclusions that lines of code is the best metric that actually works, the more you have, the more bugs you have, and humans can't really manage more than 200 lines of code at once. Got any more links to talks you recommend? I put that video on while I was working yesterday and by the time it was over I'd already purchased a copy of the guy's book.
|
# ? Sep 23, 2014 18:09 |
|
How to Multiply in C Programming Looking through his other videos this doesn't actually look like a troll.
|
# ? Sep 24, 2014 07:26 |
|
Aleksei Vasiliev posted:How to Multiply in C Programming
|
# ? Sep 24, 2014 08:42 |
|
Soricidus posted:His name is Butt.
|
# ? Sep 24, 2014 15:45 |
|
Why did his name change to Dave Andrews in the live version of the page
|
# ? Sep 24, 2014 16:04 |
|
php:<? // prints message to page function trace($msg){ echo $msg.'<br />'; } ?>
|
# ? Sep 24, 2014 16:11 |
|
daft punk railroad posted:Why did his name change to Dave Andrews in the live version of the page
|
# ? Sep 24, 2014 16:22 |
|
substitute posted:
I do poo poo like that so I can easily turn tracing off or redirect it or reformat it, though sometimes I find I don't need to and just leave the minimal function in place instead of inlining it everywhere. Unless I'm missing something. Or maybe I'm the horror.
|
# ? Sep 24, 2014 16:42 |
|
I mean I don't PHP, but there really isn't any other way to trace stuff in a file or something? Anything else than dumping in the page?
|
# ? Sep 24, 2014 17:52 |
|
Subjunctive posted:I do poo poo like that so I can easily turn tracing off or redirect it or reformat it, though sometimes I find I don't need to and just leave the minimal function in place instead of inlining it everywhere. If you're gonna be lazy about it at least put them in comment nodes just in case that laziness creeps into production accidentally. HardDisk posted:I mean I don't PHP, but there really isn't any other way to trace stuff in a file or something? Anything else than dumping in the page? Better? Sure. Easier? Nope.
|
# ? Sep 24, 2014 18:18 |
|
So, this looks fun:quote:Stephane Chazelas discovered a vulnerability in bash, related to how http://seclists.org/oss-sec/2014/q3/649
|
# ? Sep 25, 2014 04:04 |
|
See also XSA-108
|
# ? Sep 25, 2014 04:49 |
|
tef posted:See also XSA-108 Is it bash-related? An embargoed Xen vuln I assumed was some escape-to-dom0 shenanigans.
|
# ? Sep 25, 2014 04:52 |
|
Subjunctive posted:Is it bash-related? An embargoed Xen vuln I assumed was some escape-to-dom0 shenanigans. It's not bash related, it's just a high impact vuln coming out soon: I don't have any details beyond a) it's happening, and b) good luck with AWS this weekend
|
# ? Sep 25, 2014 04:54 |
|
What does bash parse functions out of environment variables in the first place?
|
# ? Sep 25, 2014 11:41 |
|
Vanadium posted:What does bash parse functions out of environment variables in the first place? CGI, I believe. Request headers to a CGI program are parsed into environment variables and you can configure a request header to exploit the bash vulnerability. Here's a list of header variables: http://www.cgi101.com/book/ch3/text.html That's my understanding, at least.
|
# ? Sep 25, 2014 13:21 |
|
I think I get how people end up injecting environment variables, but who thought it would be a good idea to interpret random strings found at arbitrary places in the environment as functions at startup?
|
# ? Sep 25, 2014 13:49 |
|
Sometimes you just want to pass a callback to some program. Then your options are: - send a string and have the receiving program eval() it - create a function and send it somehow If it were implemented correctly, being able to pass functions in environment variables wouldn't actually be a problem.
|
# ? Sep 25, 2014 14:04 |
|
So. Robert Penner made the easing functions that pretty much everyone uses when making games, or if they use an easing library it's probably using these equations behind the scenes. The typical lerping equation is, or at least, should be, mathematically this: C# code:
Let's take the easeOutElastic as an example, this is the basic easeOutElastic function (I'm gonna be reducing most of this to C#-y psuedocode/just math) C# code:
t is "Current Time", d is "Duration", b is "Start", c is "Change" Notice how t and d are on the opposite side of the function, yet they're related? Also the horrible naming in general? I'll get to that later. So now we have the one line to resolve at the bottom. What's it doing? Replacing the math that doesn't involve b or c with num1/num2/etc for each equation, we get: C# code:
C# code:
When t is 0, percent is -1. When t is 1, percent is 0. Normally it should be 0 to 1 both ways, because the percent is just a mapping function to map 0 to 1 to a special "bouncing" ease. So we just add 1 to percent to turn it into a 0 to 1 range. Now we have the classic formula! C# code:
C# code:
I was really confused as to why, and even how they were written so bad, so I tweeted at the original author of the equations and got back some real fun answers There's also a secondary reason it's in the coding horrors thread, not just for Robert's code but for actionscript's interpreter: And best for last; my personal favorite reasoning is the parameter order! Edit: vvv Yeah but it's widely used in everything to this day. Also age doesn't mean the math should have been so messed up, it's not like the concept of math is as new as programming. Jewel fucked around with this message at 15:14 on Sep 25, 2014 |
# ? Sep 25, 2014 14:38 |
|
|
# ? Jun 8, 2024 07:53 |
Thing written 13 years ago was written poorly, news at 11
|
|
# ? Sep 25, 2014 15:01 |