Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blueprints ;( #390

Closed
sschmid opened this issue Apr 21, 2017 · 9 comments
Closed

Blueprints ;( #390

sschmid opened this issue Apr 21, 2017 · 9 comments
Assignees
Milestone

Comments

@sschmid
Copy link
Owner

sschmid commented Apr 21, 2017

Blueprints… ;(

tl;dr;
I will probably stop supporting Blueprints as I don’t have the time to maintain them.
Entitas.Blueprints will stay, but Entitas.Blueprints.Unity will probably fade away.

Taken from the wiki:

The idea is that everyone in the team can configure entities with blueprints, not only the developers. Blueprints are considered configuration. They are serialized and can be exchanged to balance your game even if it is already deployed.

While this sounds great, in my experience games use a more sophisticated approach for configuration. Different teams have different workflows how to provide configuration, e.g. Google Docs, Excel Sheets, Json Cloud Service, etc.
Game Designers, Balancers and other people will work with Tools they feel comfortable with and produce and distribute some kind of configuration (json, binary, etc) which will be used for development but also be sent to game clients already shipped to the player. Requirements are different. Some configurations are fairly simple, some require to be able to apply complex math functions for balancing the economy.

Configuration also changes and needs to be versioned and you might need a migration workflow. I think configuration should not be modified to fit a certain architecture. Blueprints do that as they actually serialize entities. I strongly recommend a custom serialization solution which doesn't depend on the current architecture of the game.

Why do I plan to remove them:

  • I don’t use them
  • I recommend a more sophisticated approach with versioning and different Environments (develop, staging, production)
  • Maintaining a generic serialization tool that works for everyone takes a lot of time
  • I focus on other features

But, it's so convenient

I also saw people not only using Blueprints for configuration but for convenience, e.g. setting up objects like a Spaceship with Health, Speed, Asset, etc. I did this myself :D

My suggestion:
Use c# extension methods for that, e.g.

public static GameEntity CreateRedGem(this GameContext context, Vector3 position) {
    var entity = context.CreateEntity();
    entity.isGameBoardElement = true;
    entity.isMovable = true;
    entity.AddPosition(position);
    entity.AddAsset("RedGem");
    entity.isInteractive = true;
    return entity;
}

This is quick and simple to do and also works with data from the config

public static GameEntity CreateSpaceship(this GameContext context, Vector3 position) {
    var entity = context.CreateEntity();

    // ... some setup

    // from config
    entity.AddSpeed(_config.playerSpeed);
    entity.AddHealth(_config.playerHealth);

    return entity;
}
@IDNoise
Copy link
Contributor

IDNoise commented Apr 21, 2017

For those who is working solo or have configs in editor - use scripatble objects and create extenstion methods with scriptable object as parameter, this way you can create entities with custom logic and special cases based on this configuration. It's more extensible nd you don't miss required component, also changing components will not affect your configuration! ;)

@VladislavKostin
Copy link

VladislavKostin commented Apr 21, 2017

I'm personally so used to prefabs and being able to reference any assets and components directly in a prefab, that it's hard for me to imagine a better workflow (than prefabs). And I think the majority of Unity developers are using that workflow.

Currently, it means that in Entitas I need to create scriptable objects for each type of object, and then a method that would read it and configure the object, and it is simple but it could be automated/generated.

public static GameEntity CreateSpaceship(this GameContext context, Vector3 position, SpaceshipData data)
{
    var entity = context.CreateEntity();
    entity.AddSpeed(data.playerSpeed);
    entity.AddHealth(data.playerHealth);
    if (data.isSomething)
        entity.isSomething = true;
    //etc, etc.
    return entity;
}

So this approach is better for me than current blueprints, but ideally it would be automated and be like that:

public static GameEntity CreateSpaceship(this GameContext context, Vector3 position, SpaceshipBlueprint blueprint)
{
    var entity = blueprint.CreateEntity();
    entity.ReplacePosition(position);
    return entity;
}

@FNGgames
Copy link

Glad i never used them now :)

@sschmid
Copy link
Owner Author

sschmid commented Apr 21, 2017

I keep the Blueprint sources and will only exclude Blueprints from the zip files. So if you really want to use it / improve it / play with it / you can by forking Entitas

@sschmid sschmid modified the milestone: 0.42.0 Apr 26, 2017
@ophilbinbriscoe
Copy link

Tangentially related - I have implemented ICodeGenerator in order to generate some ScriptableObject-based replacements for Blueprints, but I haven't been able to get Entitas to find my generator.

It doesn't appear in the Code Generators dropdown of the preferenecs window (in Unity), and if I add the full type name of the generator to the generators line in the Entitas.preferences text file, it is still not used.

Any tips would be much appreciated - thanks!

@sschmid
Copy link
Owner Author

sschmid commented Apr 27, 2017

I assume you created a new class and implemented ICodeGenerator and saved the file in an Editor folder. This means your code generator is part of Assembly-CSharp-Editor.dll.

Make sure you specify this dll in the Entitas.properties file under the key Entitas.CodeGeneration.CodeGenerator.Plugins. Since this dll depends on other dlls like UnityEditor.dll etc, make sure the Entitas.CodeGeneration.CodeGenerator.SearchPaths contain the folder where your Unity dlls are located (example: Match-One - Entitas.properties)

Now the code generator will find your custom ICodeGenerator and will display in the drop down.

Hope that helps

@ophilbinbriscoe
Copy link

Thanks a lot for the detailed reply, I'll give that a try tomorrow. If any further tweaks are necessary I'll be sure to share.

This was referenced Apr 27, 2017
@IsaiahKelly
Copy link

in my experience games use a more sophisticated approach for configuration. >Different teams have different workflows how to provide configuration, e.g. Google Docs, Excel Sheets, >Json Cloud Service, etc.

That actually sounds great, but as someone new to Entitas I have no idea how to even start creating such a configuration setup without some kind of learning material on the subject. 😞 I think a real lack of good, up-to-date learning material and detailed full featured examples is the biggest weakness of Entitas at the moment and the biggest thing preventing more people from using it.

For me the most appealing aspect of blueprints was their intuitive Unity like nature. This was especially helpful for a lone Unity only indie developer like myself. I also think this intuitive designer friendly aspect is the key if you ever want widespread adoption of Entitas in the Unity community. Having to learn a completely new workflow from the very start isn't something most lone developers are gonna be really excited to do. At least not the creative / artistic focused kind.

However, I understand all of this requires a huge amount of work not directly related to the core development of Entitas. So I can completely understand your need to abandon it for now. I'd love to help develop this aspect of Entitas myself, but I'm beginning to think I'm just not skilled enough to help in that area yet. 😞

@ophilbinbriscoe
Copy link

ophilbinbriscoe commented Apr 28, 2017

Hey @IsaiahKelly, I've got something cooking that might be ready to be tested outside of my project soon.

I think the logic behind discontinuing the Unity side of Blueprints is totally fair, but I'm in the same boat as you - lone developer, no existing approach to lean on.

The solution I'm working on is actually fairly simple. It takes Unity's built-in serialization, Entitas' code generation pipeline, and the Prototype pattern, and mashes them together to make something that's pretty intuitive to use (I'm still working on my first Entitas project, myself) and has so far made injecting Unity assets into Entitas significantly less painful.

Up until now, it's lived inside of my game's project but it's probably time I made a separate repository for it - thanks for the impetus!

@sschmid sschmid added this to Entitas Jul 2, 2023
@github-project-automation github-project-automation bot moved this to Todo in Entitas Jul 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

6 participants