Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Everything posted by Telastyn

  1. Telastyn

    Criticism of C++

    No, I'm talking about C++ in general, not unique_ptr. "Modern C++" is all well and good, but there is 15+ years of libraries and tutorials written for "not Modern C++" - and all that stuff still works.
  2. Telastyn

    Criticism of C++

      That, more than anything is the biggest criticism I have against C++. It is exceptionally easy to use it "incorrectly". 
  3.   It's blurry, since different people consider OOP different things. Generally though, Object Oriented Programming isn't programming, it is design.   When you go to break your problem into managable chunks, do you think "what parts make this up?" (OO), "what steps do I need to take?" (procedural), or "what operations make this up?" (functional).
  4. One other thing that should be mentioned is that OOP has changed quite a bit over its existence. Inheritance for example is generally seen as something to avoid these days. Mutable state in objects is generally seen as something to avoid these days.   Why? Because programmers used them and found out that in many cases they suck. Some programmers said "let's make this better". Some programmers said "screw it, I'm going back to my cave" and haven't seen the practical improvements made in OOP technique over the decades. If all people know of OO is old style inheritance heavy, side-effect heavy code - they are completely right that it is bad.   Likewise, many of the other commenters are correct that C++ is a pretty terrible language to make OO code in. Java is a pretty terrible language to make pragmatic OO code in. Universities were horrible at teaching OO throughout the 90's and early 00's (and are still largely terrible). If all you see is horrible OO code, it's not a terribly improper leap to assume that it is terrible, or it makes it too hard to write not-terrible code.   Another thing to consider is personal experience. Like others have mentioned, OO is a tool and like any tool is good at some things and bad at others. If my experiences tell me that most problems are these sort (that OO happens to solve well) or that these sorts of things cause me pain (which OO prevents) then I'm going to think OO is awesome. Some people's experience simply tells them that the verbosity of most OO languages provides no benefit, or the object focused approach yields inferior solutions for the sort of problems they commonly encounter.
  5. Enh, up I imagine the runtime modification would screw up your profiling more than simply including it always (in beta) and turning on logging when needed. When done judiciously, it won't substantially impact performance but still give you plenty of instrumentation to identify issues.
  6. You're better off using an aspect oriented programming framework like PostSharp to inject these things during a build step rather than at runtime. I'm not sure how viable ubiquitous runtime modification of a loaded assembly is.
  7. Telastyn

    Having trouble accessing an objects properties.

    The solution is to not need BladeWarrior's methods to fight. Generally that means making common methods available on character, making BladeWarrior an instance of Character (rather than a derivative of it), or by letting the thing that controls the fighting get a BladeWarrior rather than a Character array (though that one depends a lot more on how your game works).
  8. Telastyn

    Code Review - Event Use?

      But it has a single responsibility: to allocate power to a subsystem. It knows how to tie the various other single responsibilities together. Something has to do that after all.   It might be good to separate that responsibility from the power source, but I'm not sure the decoupling benefits (flexibility, testability) here are worth the downsides (more overhead, harder to implement/read/maintain).
  9. Telastyn

    Code Review - Event Use?

      Yes, that seems to be the obvious thing to do.     Just passing things around is the simplest, most straightforward way to code. It should be your default approach until you have some requirement (there may or may not be something passed in, there may be N things passed in at any given time, there may be things in weird plugins we don't know about).   I don't know your requirements but I would approach it like this: public interface Subsystem { bool IsPowered { get; } int MaxPower { get; } int PowerLevel { get; } } public interface PowerSource { int SuppliedPower { get; } IEnumerable<KeyValuePair<Subsystem, int>> PowerAllocation { get; } void AllocatePowerToSubsystem(Subsystem target); } If you can't simply allocate any subsystem to any power source, the Allocate method may need to be in a higher level "Ship" object. Either way, the entire logic for that operation lives in the one method devoted to doing it - not spread across 6 event handlers which provide no benefit.
  10. Telastyn

    Code Review - Event Use?

    Please, please stop using events for logic. They are fragile, a complete pain to debug, a mess for concurrency, and make reading your code way more difficult.
  11. Telastyn

    Am I read to start making games yet?

    I will disagree with some of my colleges here... The old "If you have to ask..." line of idioms comes to mind here. It is (or should be) pretty obvious as you're learning to program how you can apply this thing you learned into making a (ugly, incomplete, stupid, buggy) game. Just take X and make that HP, and take Y and make that some enemy and *poof* you have a game rather than a homework problem. ...if you can't see that, or somehow can't envision how a game would work - then you're not ready. You'll just flounder, or worse, copy-paste some code and have no idea how it works or how to adapt it to your problem. Just keep moving forward. It doesn't really matter where you are (or even where you're going) as long as you keep improving.
  12. Telastyn

    How to get motivated to learn Programming?

    I don't mean to more of a sourpuss than normal, but you don't need a mentor to learn to program, you need to learn how to learn; and learn how to work effectively. Eventually the mentor will leave or the engaging web tutorial will end. What then? You get to the part that is actually hard: slogging through years of unfun debugging and polish to make (statistically) a really bad, ugly game work. All the programming-fu in the world will not help you if you cannot develop the work ethic (or at least stubbornness) to put it to use. Hopefully this advice will help, even if I have no idea how to achieve it. For me, it took a whole lot of trial, error and introspection while failing my way out of college.
  13. Telastyn

    CS Degree - Is it worth it?

    Pssh. It's as good a reason as any. You're only 18-22 once, and if you're off being an adult you'll generally have a very hard time finding friends (and dating partners) around your age - they're all off at college. Learning who you are is a key part of college, and sexuality is an important aspect of adulthood. Beyond that, the social aspects of finding and maintaining relationships are important skills to grow so that you can be successful both professionally and personally. It's certainly not a key reason you should go to college, but seeing "I already know how to program" as the only aspect of improvement at school is absurdly shortsighted.
  14. Telastyn

    Stick with C++ or venture into C#?

    I personally have a lot less aggravation using C# than C++. Games are hard (and frustrating) enough that adding to that is unwise.
  15. Telastyn

    CS Degree - Is it worth it?

      Uninhibited coeds tend to have an inverse financial effect when compared to employment. I have lost somewhere around $25-30k *per year* over the past 15 years by making less than my degree'd peers. And that doesn't include the 15 months I spent unemployed because nobody would hire a non-degree'd computer programmer with no formal experience. Not getting a degree is absurdly more expensive than even today's universities.
  16. Telastyn

    CS Degree - Is it worth it?

    As a skilled programmer without a degree (yet), let me say in no uncertain terms: get a degree. Even if you can _do_ the job, getting that first job is tons easier with a degree. HR departments (and most hiring managers) will hire a candidate with a degree over one without. And even when you do get a job, you'll get paid far less than a "more qualified" candidate. And really, why would you *choose* to slave away 40 hours a week rather than spending 4 years hanging out with uninhibited coeds?
  17. Telastyn

    Reference to a Reference?

      In general, the C# idiom is to make RefToRefCow a Func<RefCow> var RefCow = Cow1; var RefToRefCow = ()=>RefCow; RefToRefCow().HowMuchWeight();  // 5 RefCow = Cow2; RefToRefCow().HowMuchWeight(); // 10
  18. Telastyn

    Programming the right way?

      First things first, there's no "right" way - there are a bunch of ways that will get the job done well.   Beyond that, I would look at the code you have written, and figure out why there are bugs. Did you use certain patterns that made the code fragile? Did you name things poorly so they got misused? Did the functions have too many side effects? Did you not have a good process to prevent typos/merge errors/etc?   Books and even good programmers can only bring you so far. Eventually you have to internalize the knowledge so that you can get the feel of what things are troublesome and why; what things are usually good and why. Then you can better apply those things to the problems at hand.
  19. I concur with Khaiy. Even if you know the syntax (and you don't), watching videos does not teach you how to program - writing progressively more difficult programs does. I think that focusing on C++ is a mistake, and thinking that C# or Java are more difficult is a clear cut sign that you have no actual experience making programs. Slow down. *Practice*. Show that you can take the knowledge you've gained and apply it to solving problems.
  20. As a dissenting view, I'd just like to say that how computer architecture works, or what high level languages compile down to is largely orthogonal to being able to use them effectively.   Knowing all of that stuff won't help the OP understand bad tutorials better, it just provides more terms they don't understand and relationships that aren't clear.
  21. Telastyn

    How exactly are video games made?

      Well, the animation itself will be some sequence of sprites. They will literally define every single pixel for Mario, for every single frame of animation.
  22. Telastyn

    How exactly are video games made?

      In general, Direct X (or OpenGL) is more low level than people need to accomplish their goals. It's there, you can use it, but for the majority of games (and all For Beginner's first games), SDL and SFML will do what you need with 80% less headache.
  23.   I can't really. I mean I never really encountered these problems, but let me see if I can explain my understanding.   1. Computers are "computation machines". Thus all of the things they do boil down to math. Do you know what a function is? Do you know how to generate functions to solve word problems? Do you know how to combine functions to achieve more complex results? That is all programming is, and all computers do when you boil it down.   2. All these things are tools you use to solve problems. Why would you return void? Because your problem doesn't require a result. Many things are like this. The tutorial can't say when you would use them because they don't know the problems you face.   Now on to the specifics:     If you return 0 in another function, the caller would get 0 as a result. It would only be an error if you were really supposed to get 1 or 42 or whatever as a result. And even then your program would run, just incorrectly.     Traditionally, programs were very function oriented. They said "do this, then do that, if x=y then this other thing". Object oriented programs are designed more like "make a dog and a cat. make the dog chase the cat". Instead of focusing on the operations/recipe to do something, it focuses on modeling the parts of the problem as objects.     Data is variables. Code is operations performed on variables.     That's the thing, it isn't always true. singles are 4 bytes (in most languages) doubles are 8 bytes (in most languages). So if you don't need the range (larger min/max values) or precision (more decimal point accuracy) of a double then you can use 4 less bytes to store that variable. Since you have less bytes to work with, operations should be faster too.   Unfortunately, on some machines, working with 8 bytes at a time "fits" better with how the processor works, so is actually faster.   That said, the performance difference is negligible and saving 4 bytes here and there is also usually meaningless these days.
  24. Your modeling app is only rendering that model, and it's doing it in not real time. Rendering engines need to render a bunch of models at high frame rates, all while doing all of the other logic involved in games. Frankly, the odds of your game making any profit are nil. Just use cryengine.
  25. +1 for just pass it in and/or dependency injection.   There's no reason for this to be part of the language. (Though C++'s lack of reflection capabilities limits your options as far as auto-magical solutions go).
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!