Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Mnemotic

Member Since 08 Sep 2010
Offline Last Active Sep 14 2014 04:23 AM

#5173943 CMake (some random questions)

Posted by Mnemotic on 15 August 2014 - 12:18 PM

  1. You're the boss of your project directory structure! It is what you say it is, and therefore there are no assumptions made. If you insist on future-proofing, you can define a variable in the top-level CMakeLists.txt that would hold the include directory for library. Then use it in another_library CMakeList.txt.
  2. Do whatever makes the overall structure clearer to you. I have no opinion either way.
  3. On Linux: probaby under /usr/shared/app or /usr/local/shared/app. On Windows: in the installation directory. I haven't the foggiest about OSX.

HTH




#5122337 Using C++11 smart pointers for asset manager

Posted by Mnemotic on 09 January 2014 - 03:53 AM

 

Having a shared_ptr in asset manager and handing out weak_ptr to asset users is a solid strategy.

I don't understand this strategy. Why weak_ptr? The users will have to lock and check for expiration everytime using the asset. If you already have shared_ptr in the manager, why not for the users?

 

Because they're users. Giving out only weak_ptr's opens up the possibility to, f.ex. unload some resources that aren't actually being used in favor of some other high priority resources. This would need some mechnanism to avoid thrashing, tho. If you used shared_ptr instead, you wouldn't have the possibility to track actual usage.




#5122319 Using C++11 smart pointers for asset manager

Posted by Mnemotic on 09 January 2014 - 03:05 AM

Why are you using shared_ptr?

To me it seems "natural" that an asset manager "owns" the assets exclusively. It seems to be strange that an asset can outlive the manager, so no shared ownership should be required.

Having said this, unique_ptr is the more obvious solution to your problem.

Do not use shared_ptr unless you really need shared ownership, especially if efficiency is your concern.

I disagree.

 

Having a shared_ptr in asset manager and handing out weak_ptr to asset users is a solid strategy.




#5122318 SFML 2.1 OOP Code Review

Posted by Mnemotic on 09 January 2014 - 03:00 AM

Most issues that I see have to do with code organization.

  • `using namespace` in non-local scope is a shooting offense. You put it in a HEADER. Code police is on its way. Please assume the position.
  • Global variables are a no-no. I could understand global `Objects` but global iterators? Whoa...
  • Whenever possible, prefer range-for to iterators when working with std containers. It makes for a much cleaner code and you don't have to keep coming up with a name for each iterator. ;)
  • `auto` is your new best friend. Use it wherever possible.
  • Consider encapsulating each logical part of the update loop in a "system". A function, f.ex. `doDeadCulling(std::list<GameObject>& objects)` would do the trick.
  • Two-phase initialization is not necessary in your case. Have your `Player` and `Enemy` call `GameObjects` constructor with appropriate parameters as the first statement in their respective constructors.
  • Base class destructors must be marked virtual, else nasal demons. This applies to every class that will be inherited from. Not just the class at the root of hierarchy. In your case, `GameObjects`'s destructor is in error.
  • Your `GameObject` is responsible for way too much. There are two possible ways to deal with this. Classic way would be to split it into various abstract base classes, f.ex. `Drawable` and `Collidable`, and have your `Player` and `Enemy` multiply-inherit from those. Modern approach would be to use a Entity Component System (ECS). It has many advantages over the classic aproach. Your favorite search engine should give you a couple of good hits.
  • You lose a game vs. your pants are loose. ph34r.png

I'm happy to expand on these points if you have questions.




#5122048 Variable consistently returns bad values [FIXED]

Posted by Mnemotic on 07 January 2014 - 07:33 PM


@boogyman So what exactly would I put for a virtual destructor? For anything, really? They don't have any assets I necessarily need to delete, I think.
It still needs to be marked as virtual. So write one that does exactly nothing.
virtual ~Entity() { }



#5121935 Help me make the first step

Posted by Mnemotic on 07 January 2014 - 10:29 AM

What I need to know is, what technology should I use? What software does one use to achieve what I want to achieve? Should I go Unity? Should I build it from scratch using some engine? Which one and why? What should I use to do the art part? What's the general process of developing a game such as mine?

 

Based on the vague information you've provided, it seems to me that you're looking to develop some sort of a multiplayer dungeon crawler. I told this to my magic 8ball and it came back with the following list:

  • Either a game development kit, like Unity3D; any 3D game engine under the sun, if you're feeling adventurous; or roll your own if you never want to release a game. Ever.
  • Database software for persistence -- I'm partial to PostgrSQL because it isn't MySQL.
  • 3D modeling and animation software for creating character models and environments. Blender, Maya and 3DMax are popular contenders. Blender are free, other have licensing costs.
  • 2D art software for creating textures and concept art -- Photoshop or GIMP or MSPaint.
  • Networking engine. I've read good things about RakNet.
  • Hardware for developers and/or test environment.

Rough outline of the tradition inception-development-release cycle is as follows:

  1. Write a game design document.
  2. Get funding.
  3. Hookers and blow.
  4. ???
  5. Release.

 

Since it is a beginners forum I was only trying to prevent other beginners like me from jumping in with speculations, a very common thing to happen in such forums, not everything is an attack Mnemotic

 

Your questions are in a form that encourage speculation.




#5121919 Help me make the first step

Posted by Mnemotic on 07 January 2014 - 09:09 AM

What I need to know is, what technology should I use? What software does one use to achieve what I want to achieve? Should I go Unity? Should I build it from scratch using some engine? Which one and why? What should I use to do the art part? What's the general process of developing a game such as mine?

These are all questions of the type "if you have to ask, you really shouldn't bother asking". Show some modicum of effort and do your own goddamn research!

 

 


I really hope there are skilled enough people here to answer these questions.

 

Implying that we're not "skilled enough" if we can't/won't spoon-feed you answers to you ill-formed questions. That's not a very good way to start out in a community. mellow.png

 

 

I understand your worry but I'd really appreciate if you could address my questions. I may opt to hire more coders besides artists and move the project forward so please respect the original post.

 

So you're wealthy? Because hiring people strongly implies paying them. In cash. At market rates.




#5121891 Component design question

Posted by Mnemotic on 07 January 2014 - 06:57 AM

My issue with that method is that I don't know if I like not being able to use the ctor with parameters though. Seems there won't be a "perfect" way to do it though and I'll just have to pick the one that I dislike the least.

 

I also think I'll look at returning references from GetComponent() instead of pointers too (because the Object class owns the component memory management), but I'm not sure how I would do that if I need to check if the component exists in the container and if not what to return.

 

Behold, the magic of variadic templates and forwarding! In Windows-land, this will work in VS2013 and, I think, latest version of MinGW.

template<typename T, typename... Args> T* createComponent(Args&&... args)
{
        /* Check that `T` is indeed of expected type. */
        static_assert(std::is_base_of<Component, T>::value,
                      "`Component` is not a base class of `T`");

        auto t = new T(std::forward<Args>(args)...);
        /* handwave */
        return t;
}

With that, you can make calls like this and it will "just work" as you'd expect.

auto comp = createComponent<YourComponentType>(arg1, arg2, arg3, ..., argN);



#5121883 Need help in choosing game engine

Posted by Mnemotic on 07 January 2014 - 06:32 AM

Need for Speed: Rivals

 

What you describe are features of a game, not an engine.




#5121491 HELP! C++ Game Programming

Posted by Mnemotic on 05 January 2014 - 03:55 PM

SFML is commonly chosen as an alternative to SDL. There are good tutorials on their site. Here is another.

 

Next time, consider using a search engine first.

 

 

Happy hacking! :)




#5121471 Highscore list to my game

Posted by Mnemotic on 05 January 2014 - 02:13 PM

No-one here will fix your code. Or even read it.

 

Tell us what you're having problems with, and someone might help you.




#5120736 Begginer To Game Dev

Posted by Mnemotic on 02 January 2014 - 11:46 AM


Any other tips and tricks or resources that a budding c++ developer should know about would also be appreciated.

 

Budding C++ dev should stop looking for the royal road to programming mastery.

 

Fact is -- programming is hard and game programming doubly so. You absolutely will have to expand a significant amount of effort to learn the art and science of it. If you're not the sort of person who derives enjoyment from cracking hard (and not so) problems, maybe this just isn't for you?

 

I wouldn't recommend videos for learning -- it just isn't the most effective medium for it. Get a good book. SO has a list of titles that are widely regarded as worthwhile. Personally, I can recommend "C++ Primer" by Stanley Lippman et al. -- 5th edition covers C++11, the latest and greatest standard; and "The C++ Programming Language" -- THE C++ reference in dead tree format. It's a reference tho, and not worth it until you have a good grasp of basics -- cppreference.com will do until then. Avoid that other C++ reference site.

 

Happy hacking!




PARTNERS