Giter VIP home page Giter VIP logo

ecs's People

Contributors

abeimler avatar afpatmin avatar machinemitch21 avatar marcbritton avatar plyul avatar redxdev avatar zfyu222 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ecs's Issues

Not an issue, just a question

Awesome library. Works perfectly. I just have a question about general use. Should there be 1 global world or one in every scene? I have written a scene manager and i cant find an answer anywhere regarding this. I am leaning towards one for every scene..... but id love to hear how you use it. Thanks.

Sorry i know this is the wrong place to ask questions but i dont understand github.

World::each causes Internal compiler error if class has an implementation file

This header file compiles and works perfectly:

#pragma once

#include "ECS.h"

struct TestComp {
	int x;
	int y;
};

class TestClass {
public:
	TestClass() {}
	virtual ~TestClass() = default;

	void update(ECS::World* world, float dt) {
		using namespace ECS;
		world->each<TestComp>([&](Entity* ent, ComponentHandle<TestComp> testComp) {
			testComp->x += 1;
		});

	}
};

however, as soon as an implementation file is present, for example TestClass.cpp, even if it just contains

#include "TestClass.h"

Visual Studio shows an internal compiler error (C1001) at the last line of the implementation file. This error remains whatever i do, using inline, moving the implementation to the .cpp file and so on.

Im running the latest Visual Studio enterprise 2017, v. 15.5.7

What about supporting singleton components

I'm using your library to write a simple game. Your library is wonderful and it helps me a lot. But I hope that you could add APIs to support to create singleton components (came from GDC2017 'Overwatch Gameplay Architecture and Netcode', I'm sorry that I didn't find the video), which is like global variables that directly belong to the world instead of entities. I think they are helpful when you need components with camera position, window width and height, time, etc, that need to share between systems but does not logically belong to any entity.

I add some codes to complement a simple version, using a singleton entity to store the singleton components, but it's not gentle at all:

class World
{
public:
	Entity* singletons;

	template<typename T, typename... Args>
	void createSingletonComponent(Args&&... args) {
		this->singletons->assign<T>(args...);
	}

	template<typename T>
	ComponentHandle<T> getSingletonComponent() {
		return this->singletons->get<T>();
	}
};

I hope you could write these APIs in your way.

Option to disable a system

I'd like to disable certain systems from running based on certain game events. To support would require being able to get a system from the world and call a method or set a field to disable it. Systems that are disabled would not have their tick methods called until reenabled.

Plans to add Multi thread?

Hi!

First of all , you have done a great job developing this library.

Has any plan to addd Multi thread support to this library?

Regards!

Can't build with cmake and g++ 9.2.0

I try to build ECS with my other Project (didn't work), so I fork ESC and add my typical cmake-file and compiler-options (try out C++14 and C++17): https://github.com/abeimler/ECS

OS: Arch Linux x86_64 (4.16.81-1-MANJARO)
Compiler: c++ (GCC) 9.2.0
CMake: 3.15.5

Build:

mkdir build
cmake . -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DECS_SAMPLE_BUILD:BOOL="1"
cmake --build build

Error:

[ 50%] Building CXX object CMakeFiles/sample.dir/sample.cpp.o
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/ext/new_allocator.h:146:8: error: allocation of incomplete type 'ECS::Entity' [clang-diagnostic-error]
                            _Up(std::forward<_Args>(__args)...)))
                            ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/bits/alloc_traits.h:483:24: note: in instantiation of exception specification for
 'construct<ECS::Entity, ECS::World *, unsigned long &>' requested here
        noexcept(noexcept(__a.construct(__p, std::forward<_Args>(__args)...)))
                              ^
ECS.h:454:4: note: in instantiation of exception specification for 'construct<ECS::Entity, ECS::World *, unsigned long &>
' requested here
                        std::allocator_traits<EntityAllocator>::construct(entAlloc, ent, this, lastEntityId);
                        ^
ECS.h:131:8: note: forward declaration of 'ECS::Entity'
        class Entity;
              ^
1 error generated.
Error while processing sample.cpp.
Found compiler errors, but -fix-errors was not specified.
Fixes have NOT been applied.

Found compiler error(s).
make[3]: *** [CMakeFiles/sample.dir/build.make:63: CMakeFiles/sample.dir/sample.cpp.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:105: CMakeFiles/sample.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:117: CMakeFiles/sample.dir/rule] Error 2
make: *** [Makefile:131: sample] Error 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.