Comments (15)
I'd love a straight C#/Monogame example as well. I can't get this working. It generates the files, and those files show up in my project, but the component list has zero components and none of their code is generated. Generating code in Unity worked fine for me.
Is there something I'm missing or should I wait for the executable generator?
from entitas.
Just want to add support for a nice MonoGame example. I'm having the same problem as others where no component code is actually generated. I'm excited to try this, but unable to proceed. Thanks for any help you can provide.
from entitas.
I updated the wiki Install-Entitas-and-first-steps.
I created a simple C# project for you with the code generator already set up.
This should help getting started.
https://github.com/sschmid/EntitasPure
Have fun! :)
from entitas.
Hi,
yes Entitas also works without Unity. Here's an example on how you can use the code generator outside of Unity
https://github.com/sschmid/Entitas-CSharp/blob/develop/Entitas.CodeGenerator/Program.cs
You have to make sure to add the generated files to your project, but I guess you can automate this, too.
from entitas.
Hey, I updated the wiki and added a new page
"Install Entitas and first steps"
https://github.com/sschmid/Entitas-CSharp/wiki/Install-Entitas-and-first-steps
That might help
from entitas.
Hi. I'm new here too. I don't see how this gets my own component into the system. I created a new console project, added the generation/entitas code in it, I call your generation code from the wiki yet the generated types do not have my PositionComponent listed. What do I need to do exactly to hook all this up?
from entitas.
When you generate new files be created. The code generator doesn't add them to the *.csproj file. This means your IDE is not aware of those files. Try to add sth like this to your *.csproj file
<ItemGroup>
<Compile Include="path/to/generated/folder/**" />
</ItemGroup>
If that doesn't work we should try to find a way to automatically add those generated files to the project. We figured out a way with roslyn for windows already, but it doesn't work on mac yet.
from entitas.
My generated output folder does not have any code related to my component class I made. It just has pool classes.
My component class in my generator project
namespace EntitasCodeGeneration
{
public class PositionComponent :IComponent
{
public int X;
public int Y;
public int Z;
}
}
If I use your sample code. This does not cause my component to suddenly be generated
Generator project (which has the component class in it)
static void Main(string[] args)
{
Console.WriteLine("Building SadConsole entities");
// All code generators that should be used
var codeGenerators = new ICodeGenerator[] {
new ComponentIndicesGenerator(),
new ComponentExtensionsGenerator(),
new PoolAttributesGenerator(),
new PoolsGenerator(),
new BlueprintsGenerator()
};
// Specify all pools
var poolNames = new[] { "Core" };
// Specify all blueprints
var blueprintNames = new string[0];
var assembly = Assembly.GetAssembly(typeof(SadConsole.Game.Entitas.Entity)); // I compiled entitas into a library which I reference in this project.
var provider = new TypeReflectionProvider(assembly.GetTypes(), poolNames, blueprintNames);
const string path = "./Generated/";
var files = CodeGenerator.Generate(provider, path, codeGenerators);
foreach (var file in files)
{
Console.WriteLine(file.generatorName + ": " + file.fileName);
}
Console.WriteLine("Done. Press any key...");
Console.Read();
}
from entitas.
I looked a bit more into it and I figured out why it doesn't generate anything for me. I changed the namespace of all the entitas code and you do a type.fullname == "Entitas.xxxx"
check on things 😞 How come the code generator doesn't do a type == typeof(Entitas.xxx)
instead?
from entitas.
I plan to provide the code generator as an executable in the future. As a first step it was necessary to check for the type with string comparison, since the executable doesn't contain Entitas.IComponent etc. I want to move the code generator to a separate project since the ultimate master plan is to offer a roslyn based code generator (or to basically enable any kind of source parsing, e.g. reflection, roslyn, json or etc)
from entitas.
That sounds awesome. Especially because people could generate into other languages. I still voice my opinion for a good example of a non-unity project as an example though :)
One thing you could do is have a init system where the consumer provides all the types you know the generator needs.
from entitas.
I'll have to check. So far I used Entitas mainly with Unity, but I like to keep it working for c# only projects, too.
from entitas.
@mike991166 It may be the difference in methodology. It seems that you don't create an "entitas.dll" library and reference that. You include the entire code base in your game project. I have two projects:
- My game project which also defines components used by entitas.
- My generation project.
Both projects have the entire entitas code base. The generation project includes my component files from my main project. When the generation project runs, it outputs the generated files into a folder for my main project. Then back in my main project I exclude the "generated" folder and include it again to pick up all the new files.
from entitas.
Thanks, that did it.
from entitas.
@mike991166 I just wanted to comment that I played around with this for a while and I find it very hard to use in a non-unity project. I've now started to test thelinuxlich/artemis_CSharp and it seems to play really nice with MonoGame. The tutorial website is simple and gets you started. However, there is also a sample MonoGame game where you can explore a full implementation of it.
So far I really like it, however, I really, really, love the entitas way building out the entity to have the components built in and miss that.
from entitas.
Related Issues (20)
- Unity crashes when clicking on a GameObject with Component of Entitas HOT 8
- Remove DesperateDevs dependencies
- [SOLVED] Unity 2022.3.4f1: Exceptions + broken inspector when looking at any entity HOT 16
- Add/Replace/Remove vs Set/Unset HOT 5
- Boolean in setttings for unique components to actually be unique
- A component with multiple contexts +events, only make event listeners for 1 context
- Could not resolve type with token ... expected class System.Threading.CancellationToken HOT 10
- How to generate codes in a project which has several csproj files? HOT 1
- Update on Entitas 2.0-beta and my situation HOT 3
- [1.14.1]code gen twice and compile error HOT 1
- there is a Error, on click Tools/Jenny/Gennerate, how can I do? HOT 4
- _group.GetEntities().AsParallel().ForAll(Execute);这段语句有GC HOT 2
- Is it feasible to use Entitas in the backend? HOT 7
- Entity Behaviour in Unity inspector not visible HOT 2
- Removal of crucial SearchPaths when executing the wiz command
- How to get all group in some context, without reflection。
- GUI Null ref when trying to view entity in inspector HOT 1
- generator issues HOT 1
- Error running dotnet Jenny/Jenny.Generator.Cli.dll gen -v command - System.IO.FileNotFoundException HOT 1
- Bro i want remove this how i remove
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from entitas.