Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

629 Good

About Melkon

  • Rank
  1. Melkon

    Criticism of C++

    Who said it is the same? As i said, Meyers and alot of great C++ programmer want to break backward compatibility in the language itself, not just in STL. (btw, STL is not just a random library) It would be still C++. Most of the things which is allowed now (like: uninitialized variables without signing that "Yes, i know what i am doing"), but every static analyzer sign a warning aboit it should be cleaned up. Most problem in C++ is deriving from C, but C compatibility is not that important right now, and anyway we have great refactoring tools (thank you clang), so it's not too hard to change the language. If C++ will be cleaned, everybody will call it C++... just because something is changing it doesn't magically become a whole different language...
  2. Melkon

    Criticism of C++

    Can you point to any breaks?   There is a bunch of minor things in the stl (and i think there is some in the language itself), i won't search for it, but hanging around cppreference you can find alot of stuff which will be removed in C++17, in C++11 alot of contructor and stuff also changed and i am pretty sure not all in a backward compatible way.   These are for example will be completely removed: Just like auto_ptr and alot of other useless class.   These were mostly unused, so it's not painful to the community, but it still breaks backward compatibility. As far as i know, the name of this language is still C++.
  3. Melkon

    Criticism of C++

    A 'rethink from scratch' would just give you another language. Anything which breaks backwards compatibility is a new language. End of story. And people have tried, D which was brought up earlier is this indeed incarnate, yet it has failed to catch on. A 'rethink of C++' is no longer C++.   C++11 broke backward compatibility, C++17 will also do this. Just in minor things, but still... this assumption is a fail.   Anyways Scott Meyers made a blogpost when he encouraged breaking backward compatibility in major things. This is something alot of great C++ programmer waiting for... and no, it wouldn't be a different language, it would be a better version of C++.
  4. As Stroustrup said, C++ doesn't have Garbage collector, because C++ doesn't generate garbage. GC is problematic: - It gives you the illusion that you shouldn't care about resource management. In real world you still have to (it's more of a beginner trap) - There are alot of resource type (eg.: memory, files, locks, threads etc), but GC only care about memory. - It's memory management is also poor, as long as you care about performance it's never acceptable. - If you doesn't develop performance critical applications GC can be viable, but when you touch C++ you mostly really care about performance.   As long as you write idiomatic C++ code it's impossible to leak anything. What you don't use is released instantly. The solution is simple: - Never allocate directly any (non-thread) resource. So never write: new, delete, lock, unlock, open, close etc. - Use resource handlers -> you will end up with an exception safe code without writing try-catch blocks everywhere. - The best is if your static analyzer drop you warnings about resource allocation or release.
  5. Melkon

    Unsure between 2 books

    For best practices i think Effective C++ is superior.
  6. Melkon

    Code Review

    I think it's a pretty good idea to read Scott Meyers's Effective C++. It's easy to read, there are short and easily understandable tips which can help you improve your code.
  7. That's so true. These days game companies need a lot more people and teams are orders of magnitude larger than in the old days. Only a small group of those will be true experts, but a lot of them can just be good. It has been my experience too that you can get a junior job these days without much expert experience. To give an example, none of my junior colleagues had even heard of template meta-programming   Yeah, at my company maybe there is 1 more people + me (from ~100 people in the site) who know some metaprogrammings, people barely know any C++11/14... And not just the juniors, even the seniors have just a basic knowledge.   I feel like being a senior is nothing related to how good you are, it's just related how much working experience you have... it's more about the numbers than about the knowledge and efficiency.
  8. Hello!   Team name: Don't know yet, i will update it later. Members: Melkon Website: -   I plan to make the game in C++ with SFML, if someone likes to join PM me.  I am not sure how much time i will have tho, so join for the fun, not for the end product!
  9. I think people without working experience overestimate programmers in the industry. I am a C++ programmer and i think most programmer in the industry have just a really basic knowledge about the language (however, they ended up with alot of experience in different territories, which are really useful)   I think you shouldn't overthink this, just apply for a job, try yourself and you will see what you should improve. :) At my country, with a stable basic knowledge about your territory you can easily get a junior job, the interviewers will know that you don't have much experience...   Also: If you can show something, like ANY free time project which is not a homework like stuff it's matter alot. It says alot about you if you do these kind of stuffs in your spare time. :)
  10. You can use smart pointers. If you reference to the object through an std::weak_ptr (and in the container you use an std::shared_ptr) when the object is deleted, the weak_ptr::lock() will give you a shared_ptr pointing to nullptr.
  11.   They're not unnecessary if they're needed.     Well, i am pretty sure passing some refs/pointers all around the code base just because somewhere deeply in the codebase somebody might want to use it is a bigger antipattern than using singletons... And if 99 command from 100 don't use it, then i feel like it's unnecessary.
  12. Thanks for the answer!   I totally agree, the question is how, without messing up with tons of unnecessary parameter passes everywhere? :) So you know, i can have generic pools somewhere, but the question is how will i reach it from the places i need? For example i will have a "TrainWizardCommand", which should know how to add a new unit, even tho this will be created in an OnClick event, for example in a Building class.   So, unless every single building have a pointer to the UnitPool (which is i think also avoidable) i ending up with keeping it as a singleton.   Another issue is, that i like to keep the Commands parameterlist as small as possible, so i am not sure if the right way is to pass the pools just because this case. Most command won't use this pool, but they will have other requirements.   Well, maybe i will be unable to keep the "1 command pattern for every cases", but it's possible that from the same function i can create different type of commands, and that's problematic. For example, i have a unit with these skills: - Summon 2 skeleton (Unit pool required for execution) - Give a shield to a building (Building pool required, it would be kinda strange if a building would have a pointer to the pool, which contains the building itself) - Give vision to somewhere in the map (map, or whatever will handle the fog of war required)   The "solutions" i see: - Make some classes singleton, so i can reach them when i need, but then... i ended up with using singletons, which is kinda sad. :( - Passing pointers around to the pools and other stuffs, which is even worse than the singleton way and make it a nightmare to refactor anything.   I don't really know what's the elegant way to handle this.   I will probably have 1 for buildings, 1 for units, 1 for Images (to don't read the same images over and over again just because i have 10 units from the same type)   The building's draw is actually just call it's sprite's draw. (i use SFML for this)
  13. Hello! In my project, i have some class which do too much thing. For example:   BuildingManager is a singleton, right now it does - Hold the vector of buildings - Process OnClick events (i detect which building was clicked by iterating over them unless i found the clicked one) - Update them - Draw them - Add building   It's maybe too much for a single class. The alternate which is in my mind: BuildingsHolder singleton class: (do you know better name? ) - Hold the buildings vector. (it have the interface to add new ones) EventProcesser class: - Process the events, like onclick (not just for buildings) DunnoHowToNameIt class: - Call the update ticks on everything (like max 80-100 times a second) Drawer (don't know better name yet): - Call the draw on everything   Well, i don't know, while most of these seems reasonable i feel like it's still far from a good solution. Btw, i don't want to ending up with a bunch of singleton for the Event related things, ticker, drawer and other stuffs. (i think in this case it's not hard to avoid tho)   How would you separate these things? Thanks! Melkon
  14.   ImageCache sounds fine, thanks.   Well, it updates the objects with the elapsed time. Yes, this can mean alot of things, like train units, move, attack and other stuffs, but i feel like it's reasonable.
  15. I try to be a bit more accurate, there is not that much functionality in the ImageManager. It has an Init function, which load the textures to a container, and have a function like that: sf::Texture getTileTexture     (Image::TileTexture texture); Which give back the given texture (TileTexture is an enum) So it does 2 things: Load the textures, and give an interface to get the texture you need.     No, these classes just iterate through all Units and Buildings, and call the update on them. Everything else is done by the given Unit's or Building's update function.
  • 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!