Sea of Tranquility

I like talking about sci-fi, space, robotics, linux, anti-fascism and democratic socialism. 🇩🇪☮️

(SeaOfTranquility on libera.chat)

  • 3 Posts
  • 17 Comments
Joined 1 year ago
cake
Cake day: June 14th, 2023

help-circle




  • This sounds a bit like hamster simulator, which we used in high school in our “programming” class, the site is in German, but you might the idea. But I can absolutely see how you can make this more compelling.

    Deutsch wäre jetzt kein Problem für mich und ich glaube, ich erinnere mich sogar daran, das auch mal im IT Unterricht gehabt zu haben. Leider war die Lehrerin damals 'ne Katastrophe und ich hab’ das meiste von damals wohl schon ausgeblendet 😅



  • Personally, and I’m going to be completely honest and frank with you, I don’t think I would play it, (though I’m definitely not the target market), but also, it’s not likely that I would recommend it to someone who wants to learn to code either.

    Usually when people want to learn to code, it’s because they have some end goal in mind - they want to make an app, game, website, they want to get a job as a developer, data analyst, QA, etc. or they have something in particular which interests them - such as machine learning, embedded design, blockchain (yes, I know it’s a scam), digital music/art, etc. - and based on what they want to do, I’d recommend them some very different pathways, and it’s very unlikely that your game would be the best use of their time, to be honest.

    I appreciate the honesty, and I see your point about the game not appealing to a lot of the target audience. Your suggestion with the platform-first approach and the monetization options sound like a good idea, but it is not the direction I’d want to take. I definitely have to think about it more and figure out, how to address the points you made while still pursuing a project I fell invested in.




  • I think your idea is interesting, but based on the examples I’ve listed, which I must admit is not a huge sample, most of them are played in a sort of GUI experience sort of way. I think it would be very, very difficult to translate the core concepts of programming to a side scroller.

    Unfortunately, I haven’t played any of these games, but I have scrolled through that category myself to see what’s out there. I agree with you, that a side scroller is probably not the best option to introduce programming concepts from a game-mechanic perspective. I think didn’t really communicate well, that the way I envision my game differs a bit from these approaches. I don’t actually want to focus on specialized in-game mechanics that help to visualize algorithms or programming concepts. Instead, the game is meant to be a very mechanically trivial, story focussed frontend, that makes achieving the programming tasks more exciting.









  • There are a many approaches to implementing OOP in C. Since C doesn’t give you any language constructs to implement this out of the box, it’s up to you to do it in a consistent and understandable manner. Since there is no definite way to do it, let me just give you an example of how I would translate a Python file, and you can decide how you implement it from there:

    --------------
    class Parent:
        def __init__(self, param1: str, param2: int):
            self.__param1 = param1
            self.__param2 = param2
        def __private_method(self):
            print("private method")
        def public_method(self):
            print("public method")
        @staticmethod
        def static_method():
            print("static method")
        @property
        def param1(self):
            return self.__param1
    
    class Child(Parent):
        def __init__(self):
            super().__init__("param1", 2)
    --------------
    

    I would split the C code for this into header and source files:

    (header.h)

    --------------
    #pragma once
    
    /// Parent Class ///
    typedef struct Parent_obj {
        char* param1
        unsigned int param1_len
        int param2
    } Parent_obj_t;
    void Parent_init(Parent_obj_t* self, char* param1, unsigned int param1_len, int param2);
    void Parent_public_method(Parent_obj_t* self);
    void Parent_static_method();
    void Parent_param1(Parent_obj_t* self, char* out, unsigned int max_len); // property method with upper bound string length
    void Parent_del(Parent_obj_t* self); // destruct object (similar to __del__() in python)
    
    /// Child Class ///
    typedef struct Child_obj {
        Parent_hidden_state_t* super
        char* param
        unsigned int param_len
    } Child_obj_t
    void Child_init(Child_obj_t* self, Parent_obj_t* super);
    void Child_del(Child_obj_t* self);
    --------------
    

    (source.c)

    --------------
    #include "header.h"
    
    /// Parent Class ///
    // private methods
    void Parent_private_method(Parent_obj){...} // not visible in the header file
    // public methods
    void Parent_init(Parent_obj_t* self, char* param1, unsigned int param1_len, int param2){...}
    void Parent_public_method(Parent_obj_t* self){...}
    void Parent_static_method(){...}
    void Parent_param1(Parent_obj_t* self, char* out, unsigned int max_len){...}
    void Parent_del(Parent_obj_t* self){...}
    
    /// Child Class ///
    // public methods
    void Child_init(Child_obj_t* self, Parent_obj_t* super){...}
    void Child_del(Child_obj_t* self){...}
    --------------
    

    Modules and namespaces can be modeled using folders and prefixing your structs and functions.


  • There are a few approaches to implementing OOP in C. The language doesn’t give you any constructs to implement this out of the box, so it’s up to the developer to do it. Since there is no definite way to do it, let me just give you some examples and you can decide how to use it in your project:

    class Parent:
        def __init__(self):
            self.__hidden_state = "properties"
        def __private_method(self):
            print("private method")
        def public_method(self):
            print("public method")
        @staticmethod
        def static_method():
            print("static method")
    
    class Child(Parent):
        def __init__(self):
            super().__init__()
            self.__hidden_state = "child properties"
    

    I would split the C code for this into header and source files:

    (header.h)