Game uploaded

Download Otherworlder here


Let me know here if you encounter any bugs. Thanks!

(log in to comment)

Comments

aha, awesome as always:) There is no bugs for me on Windows 10, python 3.6. My level is stop at red world 'race to win'. It is really hard to win in my eyes :) I am quite curious about the usage of `Component class`, itseemed use it as decorator. I really can not understand the usage here, it makes me confused :) Is there any tutorial about such usage? Would you kind to tell me the trick here? 
Thanks for trying out the game! If you want you can unlock the rest of the levels with --unlockall.


The Component class is defined in a module I made called enco. It is documented, but to be honest, the basic idea is hard to get used to. If you do try it, let me know if you have any feedback!

yeah, the enco.py is awesome, I know quite a little (only basic concepts) about typical ECS, as the doc said, this is different from typical ECS implementation. I am not sure I am really clear about the implementation. But at least I have a better understanding of decorator in python, I only use decorator in @property @classmethod before. :) Now I can use it as instance :)


class A(object):

    def __call__(self,cls):
        def wrapper(*args,**kwargs):            
            print('class decorator is called :)')
            return cls(*args,**kwargs)
        return wrapper


@A()
class B(object):
    pass

b = B()


I think this style is quite fun, because use class modifies another class is easy to accept by noob like me, not instance modifies another class. In my eyes, this is normal, say the code maybe like 

class C(object):

    @classmethod
    def __init__(self,cls):
        print('class decorator runing')
        return cls()
        


@C
class D(object):
    pass
a class modifies a class and return the class, Of course this will raise an error :)because decorator is that its return value must be callable. So I have to write the `__call__` method, How about


class E(object):
    
    @staticmethod
    def __call__(cls):
        def wrapper(*args,**kwargs):
            print('class decorator comming')
            return cls(*args,**kwargs)
        return wrapper
        


@E
class F(object):
    pass
I just use @staticmethod to treat the method as common function, again,it would not work, maybe just for fun :) As the examples shows in enco-test.py, there are really many confusing things. I need a pen and a paper to clarify the results, hard to say use it. 


I think I need more practicing time, to be honest, ECS is really hard to me, say, I use kivy, there is a game engine called kivent based on kivy, but I can not use it, because it is using ECS. I even can not blit a image on screen, because it is using system! I think when I have a month free time, I would research it. Anyway, thank you for teaching me this, maybe several years later, I would get your idea of this ECS implementation. :)

You shouldn't need to be familiar with how decorators work in order to use enco. However, I understand that the syntax could be confusing if you're not used to them. It just seemed like the most straightforward way to implement what I wanted, but I think I should consider changing it so that it doesn't use a decorator.


I also think I should not have called it enco. The basic idea is something I came up with while learning the benefits of an entity-component system, so I called it that, but it's really not the same thing as an ECS.

Between these two concepts - decorators and ECS - I think I understand why this module has not caught on. But thanks for checking it out!

Yeah, as you said, using decorators is hard to me, it is closure, sometimes I have to think what the inner function do, I can understand it, but really hard to use it, if there is an error, I am sure I would be mad :) To be honest, in my opinion, I can directly add a method or property to entity class without using component decorators, yeah, I know I have such feelings just because I am too young. :)


In my eyes, I think enco is fine, it is not hard to understand, just entity's component, creating every components for the entity, then use think method if it need update. This is somehow quite like sprite in pygame. this concept and usage is more easier than typical ECS's components. It is still object oriented programming.


I am shocked when I found you created such repo in github 3 years ago :) Only from the time and experience, I think you must be right in using decorators here. :)