• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

5248 Excellent

About ChaosEngine

  • Rank

Personal Information

  • Interests
  1. C# Question about reference types

    you said I thought that seemed kind of odd, but what you meant was gridPositions is an array of GridSquares. That might seem pedantic, but it's an important detail.
  2. C# Question about reference types

    So you're saying that GridSquare has an index operator that returns another GridSquare? public class GridSquare { public GridSquare this[int x, int y] { returns ????? } } if GridSquare is a class then it is a reference type and unless you are doing something funky in the index operator (e.g. constructing a new GridSquare) then it will most likely return a reference to an existing object.
  3. C# Question about reference types

    The answer is "it depends" What is the type of gridPositions? is GridSquare a class or a struct?
  4. Coding my own game engine in Java

    In that case, you may as well make it public. You really don’t have anything to lose.
  5. Coding my own game engine in Java

    What’s your goal with this engine? Are you writing it to make a game as a hobby project? Is it something you want to sell? Are you doing this for a portfolio and potentially a future job? Or just doing it for fun? its kinda hard to answer your question without knowing what you’re trying to achieve.
  6. Are you sure that's the right link? I don't see anything about splitting strings there. but yeah, basically you want the string.Split method.
  7. Again, that assumes that your name will always be two words separated by a space. What happens if someone adds John F. Kennedy? or Carrie Anne Moss? Who is generating the address_book.txt file? If it's you, you might consider adding a delimiter.
  8. Ok, well your code is expecting them on separate lines. // reads one line Name = addressBook.ReadLine(); // reads next line Address = addressBook.ReadLine(); if you change address_book.txt to something like it will work. The other problem is that if you have more than one line, you will only store the last line in the Name and Address strings. If you want to put them on one line, you will need some kind of delimiter (a tab character, or a | ) to say when the name ends and the address begins (you could just assume that the name is the first two words, but then you're stuffed if someone puts a middle name or initial). I don't know much about the Scanner class, but a cursory google tells me your java code won't work either.
  9. are you sure the name and address are on separate lines? Can you show us the contents of address_book.txt?
  10. Can the “No kill rule” be violated?

    There's an urban legend that kryptonite was invented by the writers of the Superman radio show because the actor playing Superman wanted to go on vacation for a week, so they put Superman in a "kryptonite trap" and had a stand-in groan in pain for the episode.
  11. C# Wizards and Warrors

    Read the article. It will explain in greater detail than I can here. Those people are, IMHO, wrong. Classes are not "overkill" and OOP is not "bad". You can write bad OOP and design the wrong classes, but that's a flaw in the way you write code, not in the paradigm itself. Identify the correct problem space and solve it within the constraints you have to work with, e.g. performance, etc. That's fine, but it's not part of the problem description. Even then, be very wary of any kind of solution that relies on "magic strings". At the very least, use the nameof operator. I don't see how that solves any of the problems outlined in the article? You've basically disconnected player types and weapon types into separate inheritance trees. That's fine, but I'm not even sure why you'd bother with inheritance at all. Part of the point of the article was the ability to write code like var players = new List<Player>(); players.Add(new Wizard { Weapon = new Staff() }); players.Add(new Warrior { Weapon = new Sword() }); Monster w = new Werewolf(); foreach(var p in players) { p.Attack(w); // expect some kind of multiple dispatch here } Now, you can argue that's a naive way to write code (and I'd agree with you), and no-one would (or more accurately should) design a game that way, but Lippert isn't really coming at this from a gamedev POV. He's really talking more about general software design and just using this as an example and this kind of thing is incredibly common.
  12. C# Wizards and Warrors

    @Scouting Ninja, why do you have Wizard, Soldier, and Thief classes? They're functionally identical to the PlayerClasses class, just different data. They're objects, not classes. That's the whole point of Lipperts article. Don't try to encode things in the type system that don't need to be encoded in the type system.
  13. Can the “No kill rule” be violated?

    To be fair, that is a terrible article. Most of the instances are either someone other than Bruce Wayne (Flashpoint, Azrael), really early Batman (before they established the no killing rule) or circumstances where it looked like Batman killed someone, but actually didn't. That said, movie Batmen seem much more ok with killing, especially Burtons and Snyders. You could also make the argument that Batman is at least partially responsible for some of the Jokers victims. He knows that Joker won't stop killing, so even if he doesn't want to "lower himself", that's just an excuse on his part. But yeah, even in the "I just knocked them out" fight scenes, a lot of those guys are either dead or at the very least, extremely debilitated, and that is the case for nearly any media where someone is casually "knocked out". "They'll wake up with a sore head" in movies = "they have severe concussion and probably brain damage" in reality. Basically, don't overthink it. The reason Batman doesn't kill isn't some high-minded philosophy on the part of the writers... it's a pragmatic approach to storytelling. If you kill off the bad guys, you can't use them again.
  14. Bad Design vs. Niche Design

    I don't really like the term "bad" design because it's too broad. "Bad" design is essentially design that you don't like. Now, that could be because you don't the aesthetic of the design or the design is incompetent (i.e. they had a vision and executed it poorly). Actually, Dark Souls is a good example of both of these. While it obviously has a huge fan base (disclaimer: that includes me), there are also plenty of people who hated the game, not just for its difficulty, but for the design decisions around how it educates the player, the distance of the bonfires to bosses, etc. This is an example of people subjectively not liking the design, even though the Dark Souls fanbase will tell you those things are a core part of the experience. On the other hand, even the most ardent Dark Souls fan would be hard pushed to defend its awful menu systems (see also: Far Cry 3). That's an example of poor execution.
  15. How to save Call of Duty

    That’s disgraceful. Your country is so fucked up. It should be embarrassed to call itself a first world nation, let alone the worlds biggest economy. Back on topic, have you tried the new DOOM? Best shooter I’ve played in years
  • Advertisement