text: Content count116
  Joined
  Last visited
  Community Reputation720 Good
  About brx
  - RankMember
  Branching in switch statement
  brx replied to ryt's topic in General and Gameplay ProgrammingEhmmm.... actually... that is not quite right... switch does have something exclusive. A switch statement can - quite often - be realized through a jump table or something similar (performance!). I don't know of any compiler that can do that for a nested if statement (which is the only alternative to a switch). I have implemented quite a lot of programming languages myself (high level languages... Java, C#, Smalltalk, Javascript, some custom scripting languages) and I can assure you: If it's possible, use "switch" instead of nested IFs. It is very likely to be faster. I only talked about "interpreted" languages (the quotes are due to the fact that, of course, nowadays those are not really interpreted anymore, but just-in-time-compiled), but if I remember correctly from some previous posts from you, you are using C++... the thing about the jump table does also apply to C++ (which, in general, is not interpreted nor JIT'ed)
  Project Management Tools
  brx replied to Brick's topic in Production and ManagementMy).
  What reference book on C++ should a beginner buy?
  brx replied to dimescion's topic in General and Gameplay ProgrammingSince you're asking for a reference book I would suggest this:
  "built-in loop" question
  brx replied to Ronnie Mado Solbakken's topic in General and Gameplay ProgrammingI take it, this means you are not going to return to this thread. However, I still want to clear something up: Yes, I did take your statement out of context, that's why I labeled it to be off topic. I also know, that you were not talking about int/Integer in Java but on a higher level of abstraction. However, I think there still is a valid point in it regarding this thread: You will actually find pages on the internet that tell you that comparing two objects of the class type Integer using '==' will behave the same as comparing two values of the primitive type 'int' (as opposed to using the class type Double where two objects of that class will never evaluate to equal using the operator). And at first glance (when dealing with small numbers) this is actually true. I am not saying, that you will spread such false information unchecked, but if you do not understand all (or most of) the little details and quirks, something like this can happen very fast. So, in my opinion, when trying to teach others, the teacher should be way ahead of the students and not just ahead by one page of the text book. And this example wasn't about finding a quick fix (i.e. exchanging Integer with int), but finding an explanation - magic has nothing to do with it. As a side note: Don't use the Integer class if you have no reason ;-). Using OR-Database mappers like hibernate would be a valid reason, for example.
  "built-in loop" question
  brx replied to Ronnie Mado Solbakken's topic in General and Gameplay ProgrammingKind of off topic, but to be honest, since you were talking about Java, Integers can be kind of hard to figure out. Try the following: public class Main { public static void main(String[] args) { Integer a = new Integer(126); Integer b = new Integer(126); a += 1; b += 1; if (a == b) { System.out.println("equal"); } else { System.out.println("not equal"); } a += 1; b += 1; if (a == b) { System.out.println("equal"); } else { System.out.println("not equal"); } } } Run it and try to come up with an explanation. I don't think this website turns in anything closely related to a cult; to me the thread looks like some good people trying to save you (and possible your future viewers) from a bad time.
  Pointer to an abstract class
  brx replied to lucky6969b's topic in General and Gameplay ProgrammingNot trying to derail the topic (sorry), but I'd like to hear more about your reasoning for this statement (the parts I've emphasized). IMO there's nothing inherently wrong about the PIMPL pattern (except that it produces a lot of boiler plate code - but at the same time it enables nice things like implicit sharing and reducing compile times). Besides, declaring the data class inside the actual class would not really be the PIMPL pattern, as the PIMPL would still be "public" (not in the language kind of way, but in the "I see what you did there" kind of way) in C++ as it could be seen in the header (you'd usually have a private header that's only included in the implementation not in the declaration; also, only when used like that, the PIMPL pattern can reduce compile time, which is one of its main merrits). [EDIT - _very_ exaggerated, to be honest]: Actually, isn't PIMP the only true object orientated pattern? Afterall, one of the main points is encapsulation. What's more encapsulated than only showing the actual interface to the user? The user should not care "how" and "what data", but only "what can I do with it?". Back to the topic: to me the question is lacking some information. What are you trying to accomplish? To me it seems like you are actually asking how to instanciate objects of the "Objects" and "Goods" classes (btw, get rid of the plural form)!? If that is the case, you will need actual implementation of the abstract classes. This is a long shot, though, since some information is missing here.
  - Sorry if my comment sounded harsh or belittling or anything, it was not meant that way.
  Got kids? Like sports? Then you can appreciate this.
  brx replied to Alpha_ProgDes's topic in GDNet LoungeYes, she really is impressive and I really appreciate it. To be honest, though, she's about two years too old to absolutely blow my mind (she would if it wasn't so obviously rehearsed). My boy is two years old now and this really impresses me: two year old drummer: and another four year old /yes, I am a drummer...
  c++ memory leaks detection
  brx replied to the dodger uk's topic in General and Gameplay ProgrammingQFT. This is some very good advice and so far you did not comment on even trying it.
  - I don't know what kind of multithreading you did in C#, but from my experience it's not easier than in C++. So if you say, that multithreading in C# for all your needs is easy than either a) you're a freaking genius or b) your problems were perfectly fitted for multithreading. Our brain is just designed in a way that it thinks sequential. Once multithreading comes into play, it's hard to even imagine what might happen and to think of all possible scenarios. Andrei Alexandrescu from the C++ consorptium pretty much naiiled it: "Multithreading is just one damn thing after, before, or simultaneous with another". And that's all we know. When the code based is not designed for parallelism from the start it is a great step to adapt. The funny thing is, that most of those people complaining about only one core being used would shut up, if you'd just create <number of cores>-1 threads in your program doing nothing but an infinite loop so they see 100% of CPU usage. What I am trying to say is, that saying "...there's no simple way to make something multithreaded..." is very accurate. Usually, the first 2 or 3 attempts to parallelize a previously sequential algorithm/architecure will lead in full CPU usage but in slower execution.
  What else will i need to learn before i can make a rpg
  brx replied to game of thought's topic in For Beginners[Disclaimer: I am not very exerienced with Python, I have only used it once in University for a class about breaking crypting algorithms.] To be honest, for me, being a quite experienced programmer, it seems kind of strange when someone says that "he has finished to learn" a programming language. I have been using several languages during the past 20 years (mostly C++, but also a fair amount of Java, C# and others) but in none of them I would say that I "finished learning". So, sorry, from your info it is impossible to say what else you need to learn, since, imho, it is close to impossible to actually finish learning a language (hell, even Bjarne Stroustrup says, he doesn't know every dark corner of C++ and he invented the damn language). Start your project and once you encounter an actual problem, ask a specific question. I am quite sure somebody will be able to help you then. game of thought already posted some good ones, but since you "finished learning" the language, all of those must be known to you. [EDIT] Wow, now that was a brainfart. Sorry, I kinda missed that GoT is the OP, thanks for pointing that out, slice4ever. So please, ignore my above comment, I am leaving it here, though, so everybody can see how stupid I am ;)
  Visual C++ is rallying an army on my computer...I'm scared
  brx replied to CaseyHardman's topic in GDNet LoungeWindows: Patching can become problematic (when using static linkage) if you switch to a newer VS version and run an incremental update. Linux: Patching can become problematic (when using static linkage) if you switch to a newer gcc version and run an incremental update. I'm starting to have the feeling that the last posts are just due to some "M$ is teh evil" (sorry, English isn't my first language) troll and we should leave it at that. So, to the OP, don't worry about those entries, it's all good! Besides: Our company (not me!) says: We support Linux! This is about the same as for a mobile app developer to say "we support android" Too many different vendors... if nothing changes there will never be a (binary distributed) program that runs on all Linux distributions. But, I can assure you, our program runs on all PCs that run Windows 2000 (yes, really) or later.
  Visual C++ is rallying an army on my computer...I'm scared
  brx replied to CaseyHardman's topic in GDNet LoungeYep, that's actually why I didn't even mention that option. [EDIT No. 2] (continue to read the first edit ;) : In the following paragraph "You" is not directed at Bacterius, but to Karsten_, even though I just quoted Bacterius [EDIT] And there's one more thing, I'd like to add: I am not trying to advocate / defend the "dll-hell" Microsoft has brought upon us (I still don't understand that stupid manifest-thing), but your points are just showing the usual "GOM M$ is so evil" attitude that I cannot stand anymore. The Microsoft people I've talked to (all of them are engaged with VS or similar developments [e.g. C++ AMP]), are some of the smartest people (regarding software development) I've ever talked talked to. And... guess what... they are open for suggestions and corrections in a way that I have never experienced from any other company (or open source community). So imho, Microsoft has moved from being one of the "bad guys" to being one of the companies that I would love to work for. P.S.: Can somebody disable that editing history please... ;)
  Visual C++ is rallying an army on my computer...I'm scared
  brx replied to CaseyHardman's topic in GDNet LoungeEhmm... under Linux you still need the gcc runtime (libstdc++) in the correct version for your program to run. A mingw compiled program under Windows also needs the correct dll for the mingw runtime. Also, you can ship your VC++ program with the correct version of the runtime dll as a side-by-side assembly, so no need to install it manually (yes, there are rare cases where this does not work, I know).
  How to read file line
  brx replied to TheScriptan's topic in For BeginnersJudging by the question, you do not only want to read a line from a file, but also write it, right? Writing: TextWriter writer = new StreamWriter("settings.dat"); writer.WriteLine(colorId); writer.WriteLine(userName); writer.Close(); Reading: TextReader reader = new StreamReader("settings.dat"); String colorId = reader.ReadLine(); String userName = reader.ReadLine(); reader.Close(); Note that you also should do some error checking, right now bad things will happen if, for example the file cannot be opened or the file does not have two lines in it...