View Poll Results: Is the project helpful for you?

Voters
1. You may not vote on this poll
  • Yes

    0 0%
  • No

    0 0%
  • Not Sure

    1 100.00%

Thread: A learning Game Project

  1. #1
    Registered User sarvsav's Avatar
    Join Date
    Oct 2013
    Posts
    25

    A learning Game Project

    Hi Everyone,

    We have started a learning project named cyberbitgame [1], that will help others to learn about game programming. We will discuss and share our knowledge about how software development works, and what we learned in our past days.

    We are not so experienced programmer, but still as it's a learning project, we share our knowledge and learn from it. We will try to cover from very basic start to advance end of the project. Interested one can join this. And yes, I would appreciate if some experienced users give some of their valuable time, about reviewing about our code, that would be very helpful and generous for us too.

    Game is linux/windows platform based, and we are using C++ and SDL 1.2

    [1] => https://github.com/cyberbitgame/cyberbitgame

    Important Link: Docs

    Thanks. Sarvsav.

  2. #2
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,739
    Honestly, y u no use SDL2?
    Devoted my life to programming...

  3. #3
    Registered User sarvsav's Avatar
    Join Date
    Oct 2013
    Posts
    25
    Hi GReaper,

    There is a topic in our milestone too, when we move to v0.6.0 to v0.8.0. We will discuss, how to port your SDL 1.2 apps to SDL 2.
    Kindly share your views, is it a bad idea?

  4. #4
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,739
    Well, you could make valid arguments for both sides. On one hand, you have 1.2 which supports more systems and has tons of references. On the other, you have 2.0 which generalizes the interface, providing multiple windows. Also, I'm for using the latest stable editions of libraries. Yet, some SDL2 extension libraries have yet to be compiled and tested for 64-bit GNU/Linux distributions.
    I'd say, unless you have a serious reason for using an old platform( like old code, which would be tedious to change ), you shouldn't.
    Devoted my life to programming...

  5. #5
    Registered User sarvsav's Avatar
    Join Date
    Oct 2013
    Posts
    25
    The SDL team is working too hard, I noticed lots of bugs have been fixed for SDL2, but still lots of alive. Yes, as its learning project, So, We cann't force anyone to install a new OS or purchase a machine. and SDL 1.2 has more stability over the machines, and good references is also the plus point. And it's not only a game development project rather its how software development works. How to work in team? Even, many of the joinee learning GitHub too. If we use SDL2, it will be a big challenge to us too :sigh: but still SDL1.2 has lots of docs/tutorials, we can ask them to work on it by looking at online reference.

    Thoughts?

  6. #6
    Registered User Alpo's Avatar
    Join Date
    Apr 2014
    Posts
    877
    Quote Originally Posted by sarvsav View Post
    The SDL team is working too hard, I noticed lots of bugs have been fixed for SDL2, but still lots of alive. Yes, as its learning project, So, We cann't force anyone to install a new OS or purchase a machine. and SDL 1.2 has more stability over the machines, and good references is also the plus point. And it's not only a game development project rather its how software development works. How to work in team? Even, many of the joinee learning GitHub too. If we use SDL2, it will be a big challenge to us too :sigh: but still SDL1.2 has lots of docs/tutorials, we can ask them to work on it by looking at online reference.

    Thoughts?
    I think this is a pretty cool idea. I've been writing my own 2d rpg engine using SDL2 and a few other libraries, for about a month now (maybe more now that I think on it). So I'll probably be checking in with your project. I'm mostly interested in seeing the implementation, but the development side could be educational.

    A few questions I have after looking at the sources:

    Are you planning on building separate manager classes to handles loading images / sounds / states, or doing it all in the Game class?

    Are you planning on doing a data-driven type design (parsing ect.), what language and parser will you use if so?

    Also, are you planning on having players, enemy's ect inherit from a common source, or do it all separately?


    That's about it, hope all of that was intelligible lol. Sign me up as an interested lurker!

    Edit: I voted "not sure", but please don't take this badly, I really like the idea, but it is still so early.
    Last edited by Alpo; 07-03-2014 at 10:45 PM.

  7. #7
    Registered User sarvsav's Avatar
    Join Date
    Oct 2013
    Posts
    25
    Hi Alpo,

    Wow, 2D RPG engine, I am planning to work on it next.

    Are you planning on building separate manager classes to handles loading images / sounds / states, or doing it all in the Game class?
    - The code needs refraction, but there is no need for different class for sound/images? or does it? If you something better in mind, i would love to hear.

    Are you planning on doing a data-driven type design (parsing ect.), what language and parser will you use if so?
    - I would love to create a parser, but no plans for right now.

    Also, are you planning on having players, enemy's ect inherit from a common source, or do it all separately?
    - All humans will inherit from same Player class, but they get different abilities from Power class.

    Yes, I am thankful to you. Please notify us, if you have any great things in mind.

  8. #8
    Registered User
    Join Date
    Apr 2006
    Posts
    43
    After looking at the code I would say that you have a long way to go. Try to pick one part of the game and really work on that part instead of adding a lot of half baked features that don't really work or will never be completed. That way you will have learned one thing thoroughly from this game which you can take with you to your next attempt.

  9. #9
    Registered User Alpo's Avatar
    Join Date
    Apr 2014
    Posts
    877
    Quote Originally Posted by sarvsav View Post


    - The code needs refraction, but there is no need for different class for sound/images? or does it? If you something better in mind, i would love to hear.
    On sounds and images - It will probably depend on how you write the code. Consider this though, you want to make your code as extensible as possible, right?

    Basically the point of writing something like an image manager class (responsible for loading, rendering, and destroying SDL_Texture/ SDL_Surface / ect) is that you isolate all the SDL unique functions into one place. That way you don't need to sprinkle SDL functions all around your code, and if you want to change libraries or whatever, all you need to do is change the manager class. You won't have to track down references to SDL through huge chunks of code. So your code becomes better able to survive changes.

    Like I say, it's not necessary, just something to think about.

  10. #10
    Registered User sarvsav's Avatar
    Join Date
    Oct 2013
    Posts
    25
    Thanks for your feedback, alpo. Yes, the point make sense. I will modify it again. Thanks again.

  11. #11
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Choice of API or engine should be second fiddle to domain knowledge.

  12. #12
    Registered User sarvsav's Avatar
    Join Date
    Oct 2013
    Posts
    25
    HI Alpo,

    I have a doubt here, as I am loading all images and sounds in Game class, so, what is the need of extra class for Image, Sound.? Because no other class is going to use that class Image, which is responsible for loading/rendering images, and same for sound?

    There are 2 cases here:

    1) Game class load everything: player image, map image, game sounds.
    2) Game class call Player class, Player class then load player image/sound using Image/Sound class, Enemy class load enemy image/sound.

    2nd case is undoubtedly good as per structure, but will take lots of extra effort. and as per performance, is first case better than second? because there is a single inheritance, whereas in second case, every class need to inherit Sound and Image class? Kindly help.

  13. #13
    Registered User sarvsav's Avatar
    Join Date
    Oct 2013
    Posts
    25
    Hi VirtualAce,

    You mean should we use something like openframeworks.cc ? or is there anything else you are pointing to. Kindly suggest. Thanks

  14. #14
    Registered User
    Join Date
    Apr 2006
    Posts
    43
    Don't worry about design, just start coding. If this is your first attempt to code a game, then you need to code more. Experiment! If you are worried that writing two more classes for handling sound and image loading is too much work, you'll never finish your game. As per performance, it doesn't matter! Never optimize before getting it to work! (and if you worry about performance in a hobby game on a decent modern computer, then you have done everything wrong)
    Do it the way you find easiest at first, redo it when you find out that doing it that way sucked.
    Thinking of the grand design of a game engine will get you nowhere.
    Just do a simple game at first, for example, try doing a flappy bird clone, you have most of the code you need in your project for that.
    When everything works, do another side scrolling game and see how much code you can reuse from the first one by just copying whole classes and files. That will give you real world experience with design and code reuse, which btw are quite hard topics.
    But have fun, experiment and don't over engineer your first games, follow the KISS principle...

  15. #15
    Registered User Alpo's Avatar
    Join Date
    Apr 2014
    Posts
    877
    Quote Originally Posted by sarvsav View Post
    HI Alpo,

    I have a doubt here, as I am loading all images and sounds in Game class, so, what is the need of extra class for Image, Sound.? Because no other class is going to use that class Image, which is responsible for loading/rendering images, and same for sound?

    There are 2 cases here:

    1) Game class load everything: player image, map image, game sounds.
    2) Game class call Player class, Player class then load player image/sound using Image/Sound class, Enemy class load enemy image/sound.

    2nd case is undoubtedly good as per structure, but will take lots of extra effort. and as per performance, is first case better than second? because there is a single inheritance, whereas in second case, every class need to inherit Sound and Image class? Kindly help.
    Hello, and sorry it has taken so long to reply, I'm still pretty busy with my engine.

    To clarify, I was suggesting making a sort of manager class for images (I'll just stick with images, but it applies to other media, and fonts as well).

    The way I have mine set up, the Game class only loads a state (The main menu state) in it's initialization function (after initializing SDL and all that). A state is responsible for loading (and keeping track of) it's own media, which it does using the "Texture" class.

    In general terms, my system works like this:

    1. Game class is created in main, then the Game::Init function is called with all the parameters needed to create the window and renderer.

    2. At the end of that function, a class called MainMenu is created and pushed into a vector of GameStates (a base class for all the states in the game). When a state is created, it executes it "Enter()" method.

    3. In the GameState::Enter() a class called Parser is created which uses tinyXML to get parameters from an XML file to create the images. The Parser will use the Texture singleton to store SDL_Textures in a std::map in the Texture class. The map is then accessed through it's key, which is stored in the character classes (or whatever class needs rendering).

    The reason I prefer (at least so far to use a separate manager class is that not only does it isolate a lot of SDL specific code in one place, it also gives you a greater range of how you will use those SDL Functions, and takes some of the responsibility for keeping track of things.

    Maybe a good example is special effects (like getting hit with a spell). When a character is hit with a spell, the spell class will pass it's "type" to one of the collision functions in that characters class. This collision function will then (among other things) start a timer for the effect, then pass the "type" on to the Texture class, which will then automatically apply the appropriate effect, and reset the SDL_BlendMode and render Color.

    I suppose you could just write all the stuff my Texture class does in the base class of your inheritance chart for characters, but trust me, those classes will probably grow big and gnarly enough. And if you have classes that aren't in the character hierarchy and need to be rendered (possibly with special needs), you wouldn't have access to the code without copying into the new class.

    It's up to you, you'll find your preferred way after a while (hopefully without to many headaches). Good luck!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reinforcement Learning, ConnectFour game
    By MrRed in forum C Programming
    Replies: 11
    Last Post: 04-30-2012, 01:56 PM
  2. Easy Bash program project for learning
    By theKbStockpiler in forum Linux Programming
    Replies: 0
    Last Post: 09-15-2010, 09:05 PM
  3. Learning game programming worth it?
    By taver in forum Game Programming
    Replies: 6
    Last Post: 07-04-2009, 11:07 AM
  4. Learning game C++ but different
    By traitors in forum C++ Programming
    Replies: 8
    Last Post: 05-21-2006, 11:50 AM
  5. Learning Project
    By howdytest in forum C++ Programming
    Replies: 12
    Last Post: 12-27-2004, 02:35 PM

Tags for this Thread