Hello everyone! It's been a long time since I've posted my first journal entry here and a lot has happened.
First of all, my original framework didn't quite work out the way I wanted it to, largely because of several issues related to C++ and poor design on my part. C++ is a very difficult language and as much as I love the control it gives you, I realized that I'm just hurting myself by programming in a language that will end up working against me due to its complexities as opposed to helping me. I have prior experience with working in C# and because SFML offers a great .NET port I decided that I would make the move over.
Second of all, there is a great book out there by the name of "SFML Game Development" and is one of the most fantastic books specific to a programming library that I have ever read. I highly recommend it for anyone wanting to work with SFML or even just wants an intro to game programming. Of course, everything is in C++, but I am working on porting the majority of the framework provided into C# for my own personal use. The framework they have you make in the book is fantastic and intuitive, and solves a lot of issues that I would have undoubtedly run into if I had continued designing my own. I am about halfway though the book and expect to finish porting everything for the framework in about a month or so. Though that's being pessimistic, I can get through about half a chapter(There being 10 chapters) a night if I dedicate a couple hours to it. This is a bit slow, but porting from C++ to C# is a bit tricky, simply because C# uses several different ideas and features that C++ doesn't, and vice versa. However I am making great progress with it and am in the process of designing my game while I continue finishing the framework. I hope to being programming my game a couple weeks after I finish the framework and am making good progress with my game design/programming bible (I include a lot of comment about how I think stuff should be implemented in the code midst my design stuff).
Anyways, sorry this is so short but for now as I continue finishing the framework and designing the game, the entries in my journal are probably going to be about the design, (I will post sections of my design/programming doc as I finish them), issues and solutions I have run into while programming everything. I hope to be posting entries much more often now that I've really gotten back into the project. Thanks for reading and see you next time where I'll talk about the game I am making and some of the design.
Hello Gamedev! This is my first developer journal here and I am excited to get started! School just got out for me and after spending the year researching design patterns and frameworks for making games, I've decided my summer goal is to make a very basic geometric platformer. First things first however, I need to make the framework my games will be using. I've decided to use C++ with SFML as my A/V library and Box2D for physics. (I chose these because all three are super intuitive to code with/in, IMO) After finishing my framework, I'll test it out with a quick demo of Pong with a menu and multiple levels. The rest of this post is going to be dedicated to how I'm designing my framework, and the details and issues associated with my design.
The Game Class There will be a main "Game" class that I initialize in the main function that takes the first "Scene" as an arguement, it automatically updates your "Scenes" (more on these later) and renders them, according to the methods contained within those scenes, with a reference to the Game class itself as the argument for all these methods. The Game class will manage the Scenes, and contains the main loop, for updating and rendering and all that stuff. The Game class will have a list of scenes, loaded and unloaded. The reason for this being that I don't want to load all my scenes at once, especially considering the way I'm going to be doing the loading. The reason for them all being in a list is because I'm lazy and don't want to have to keep track of whether my Scenes are in scope or not at the moment, and as long as the Game class exists so will the lists, so once I add my scene to the list I can let it go out of scope. (In the initialize method is where I'll want to define all of my scenes and stuff, but since they won't be loaded it hopefully won't take that much time) Each "Scene" contains a list of "GameObject" classes which is just an extension of sf::Sprite with some added functionality. (Like having its own update and render function, to be called by the Scene it is in by that Scene's update and render function, it is meant to be extended to create your own objects) For a LevelScene, there will also be an associated two images, which when the scene is loaded in game, the images' pixels will be read, and depending on the RGBA values of each pixel, an object will be placed in the "tile" where that pixel is located in game. This is my rudimentary system for level design, the reason for two images is that one image will contain on the objects in the foreground that interact with one another, while the other contains all the background objects that generally don't interact with the player. Some problems with this, the game and the scene classes own a list of objects, I have no way of knowing which object is which, so each object in the list will have an associated string name with it, so you can delete and switch to scenes based on the string name. This also applies to the Texture Atlas below, by me extending sf::Texture and simply adding a string name to the new Texture class. I'm pretty sure this isn't the best way to do things and if anyone has any advice on a better way to sort my objects, feel free to comment!
The Texture Atlas SFML Sprites require a reference to a Texture object. So you have to manage the memory of all your textures. The Texture Atlas will do this for me by simply adding a texture to its list, and being initialized by the Game class so that the Texture Atlas class stays in scope, and thus so does the Textures. The Game class will have a function to retrieve the Texture Atlas, (since I have to initialize it in the game class). And then you can use the Texture Atlas to assign textures to sprite, consistently re-using preloaded ones since you'll only have to load any image you use once!
That's all that I can think of for now, if you have any advice/suggestions/feedback, feel free to tell me! I'm always open-minded to new ways of doing things and I appreciate that I am largely new in the area of serious game making and would love for a more experienced person to tell me what I'm doing wrong! (I've definitely coded games in the past, but from a code perspective they absolutely sucked, this will be my first attempt at "serious" coding) I'll be adding more to this journal as I find and solve problems within my framework and add stuff to it. (I am definitely adding things to it, I understand that it is very basic and simple right now.) I'm keeping this journal as a sort of design document to write down my ideas and force myself to work on the framework. I apologize for the rambly nature of this journal and I hope you will all bear with me as I get better! Thanks for reading and I hope this wasn't a complete waste of time!