Jump to content
  • Advertisement

wqking

Member
  • Content Count

    442
  • Joined

  • Last visited

Community Reputation

770 Good

About wqking

  • Rank
    Member

Personal Information

  • Interests
    Business
    Design
    Education
    Production
    Programming

Social

  • Github
    wqking

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Nested components can only make your system unnecessary complicated and adds nothing else, think about the worst nested components hierarchy can be another non-ECS inheritance tree. So avoid it. In you example, fist is just an entity, not a component.
  2. What's wrong? The below code compiles fine in VS 2017. struct A { virtual ~A() {} }; struct B : public A { ~B() override {} };
  3. My Gincu game engine supports both SFML and Allegro, you may be inspired from it. The game application doesn't know the underlying engine (SFML or Allego), so it's quite what you want.
  4. class __declspec(dllexport) A {}; How about google "VC export class"? It gives you https://msdn.microsoft.com/en-us/library/81h27t8c.aspx
  5. pInt belongs to B::function() . That's to say, its scope is limited in B::function() . Though it's a pointer to member of A.
  6. wqking

    double accuracy in C++

    There is infinite real numbers, while double can only present finite numbers, so it can't present all numbers. To solve it, you need fixed point number
  7. A guess may be the server sends some data the clients can't understand correctly and corrupt the memory. Run the debug version in a debugger, then you can see the source code where it crashes.
  8. Include guards are used to prevent cycle inclusion, not to (and not need to) prevent multiple declarations (not definitions). Though as frob said, most class declarations are also class definitions so they can't be multiple in one translate unit. Here is an article on declaration vs definition.
  9. Multiple class declarations are allowed in one translate unit. So it's fine you include class A many times in one .cpp. But class definition (which define the function code, etc) must be in a single translate unit, except they are inline.
  10. https://github.com/wqking/eventpp eventpp is an open source C++ event library that provides tools that allow your application components to communicate with each other by dispatching events and listening to them. With eventpp you can implement signal/slot mechanism, or observer pattern, very easily. Facts and features Powerful Supports both synchronous event dispatching and asynchronous event queue. Configurable and extensible with policies and mixins. Supports event filter via mixins. Robust Supports nested event. During handling an event a listener can safely dispatch event, append/prepend/insert/remove other listeners. Thread safety. Supports multiple threading. Exception safety. Most operations guarantee strong exception safety. Well tested. Backed by unit tests. Fast The EventQueue can process 10M events in 1 second (10K events per millisecond). The CallbackList can invoke 100M callbacks in 1 second (100K callbacks per millisecond). The CallbackList can add/remove 5M callbacks in 1 second (5K callbacks per millisecond). Flexible and easy to use The listeners and events can be any type, no need to inherit from any base class. Header only, no source file, no need to build. No dependencies on other libraries. Requires C++ 11 (tested with MSVC 2017, MSVC 2015, MinGW (Msys) gcc 7.2, and Ubuntu gcc 5.4). Written in portable and standard C++, no hacks or quirks. License Apache License, Version 2.0 Version 0.1.0 eventpp is currently usable and near stable. Quick start Namespace eventpp Using CallbackList #include "eventpp/callbacklist.h" eventpp::CallbackList<void (const std::string &, const bool)> callbackList; callbackList.append([](const std::string & s, const bool b) { std::cout << std::boolalpha << "Got callback 1, s is " << s << " b is " << b << std::endl; }); callbackList.append([](std::string s, int b) { std::cout << std::boolalpha << "Got callback 2, s is " << s << " b is " << b << std::endl; }); callbackList("Hello world", true); Using EventDispatcher #include "eventpp/eventdispatcher.h" eventpp::EventDispatcher<int, void ()> dispatcher; dispatcher.appendListener(3, []() { std::cout << "Got event 3." << std::endl; }); dispatcher.appendListener(5, []() { std::cout << "Got event 5." << std::endl; }); dispatcher.appendListener(5, []() { std::cout << "Got another event 5." << std::endl; }); // dispatch event 3 dispatcher.dispatch(3); // dispatch event 5 dispatcher.dispatch(5); Using EventQueue eventpp::EventQueue<int, void (const std::string &, const bool)> queue; dispatcher.appendListener(3, [](const std::string s, bool b) { std::cout << std::boolalpha << "Got event 3, s is " << s << " b is " << b << std::endl; }); dispatcher.appendListener(5, [](const std::string s, bool b) { std::cout << std::boolalpha << "Got event 5, s is " << s << " b is " << b << std::endl; }); // The listeners are not triggered during enqueue. queue.enqueue(3, "Hello", true); queue.enqueue(5, "World", false); // Process the event queue, dispatch all queued events. queue.process(); Please check Github for the source code and documentations. https://github.com/wqking/eventpp
  11. The simplest solution is using a shared pointer such as std::shared_ptr, otherwise you may roll your own reference counted pointer. // pseudo code struct MyPointer { MyClass * pointer; size_t count; }; struct MyPool { MyClass * requirePointer(someKey) { MyPointer * myPointer = findBySomeKey(someKey); ++myPointer->count; return myPointer->pointer; } void releasePointer(MyClass * pointer) { MyPointer * myPointer = findByPointer(pointer); --myPointer->count; } }; But I would highly recommend using std::shared_ptr instead of your own reference counting.
  12. A vtable index is same as a function name, it's determined at compile time and won't change and of course won't be over flow. If you debug to see a virtual member function pointer, you will find it's some vtable index instead of pointer to memory.
  13. Don't forget the other advantage of dynamic libraries: They can be loaded on demand. So assume you have DLLs for different languages, you can only load one DLL for one language at certain time, without linking to all languages statically. They can be patched. So it's possible that your game downloads and updates only several DLLs without updating the whole game.
  14. You can install your core app to "program files" folder, which will not be updated. Then your core app installs updatable app/resources to a writable folder. Your "core app" only does two jobs: 1, Check auto update 2, Execute your main app from the writable folder.   This is how we did auto update in mobile games. Hope it helps.
  15. wqking

    Will there ever be another language of the web?

    I hope in the future JavaScript becomes the "binary machine code" of the internet, similar as the real binary machine code on local machine. Then we use higher level and better language, then the language is compiled to JavaScript. Similar as we compile C++ to binary code. Seems this is the trend. Microsoft has already had TypeScript.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!