r/ruby • • Jun 09 '22

Show /r/ruby Soft body physics in Ruby (DragonRuby Game Toolkit) :-)

Enable HLS to view with audio, or disable this notification

171 Upvotes

33 comments sorted by

View all comments

Show parent comment

5

u/katafrakt Jun 14 '22

Thank you for writing this, Amir. I needed some time to process it. Now I see your point - it is indeed a problem, that you cannot progressively transition from simple code to ECS, but you need to make some upfront decisions or rewrite the whole codebase.

I also looked through the source code of animation example from this thread, which was posted somewhere below. I think it answered some of my doubts about code organization and doing it like that might be a nice middle ground for me. I would have to experiment with it more.

2

u/amirrajan Jun 14 '22

One of the philosophies of DragonRuby is “Continuity of Design”. It’s important to have multiple options on the spectrum.

As an example:

In Unity, to render a collection of sprites that fly across the screen and wrap around, you need to know about C#, static constructors, classes, inheritance, MonoBehavior life cycles, GameObject instantiation, adding components/scripts through the IDE, Vector3, Quaternion.identity, Camera.main, transform, Time.deltaTime, how to create a prefab, and how to associate a sprite to a prefab using the ide.

The claim is "this is how you should do it because it sets you up for success and a good architecture". Which isn't necessarily false, but I'm not ever going to get to that "pit of success" if I can't even get up and running.

It's like saying "Oh don't use if/else statements, you should just go straight to using the strategy pattern. Every time."

When in reality, understanding the Strategy Pattern includes the progression to the "perfect" solution: if/else statements, multiple if/elsif statements, consolidation of logic so case statements can be used, generalization of case statement to a Hash of Procs, then maybe the full blown strategy pattern.

I’ve yet to have a proponent of ECS lay out a sane progression.