Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

228 Neutral

About Aristotel

  • Rank
  1. Aristotel

    Showcase of character dialogue displaying

    For now I want to keep it as simple as I can, but in the future we might add it.
  2. Hello GameDev,   currently I am working on a project with two friends where we decided to implement and use an entity system for a turn based strategy game like Advanced Wars.   The current problem we are having (or are rather discussing) is what is the best way of actually using the entity system? For context I am going to describe the flow of a single units turn.    The player clicks the unit -> the unit is now selected and the possible move locations are highlighted  The player clicks again to select a move location, after moving the possible targets are displayed  The player clicks a valid target for the unit to attack  The unit finishes its turn or is destroyed   Keep in mind that for each action where the player clicks the unit again it is equivalent of the wait command in AW (for now excluding the special case for artillery and loading units into transports).   The current idea we have is that each unit has a state component that stores the state the unit is in and for each click switches to the apropriate state (pretty standard, the current state is stored in a component instead of the object).   Another idea we have is instead of a single state component we use the actual components themself  for handling unit state, in this case we can check if a unit has the (let's say) waitingForMove component and continue like above by adding and removing respective components.   My questions are:   Which approach will be more elegant? Which approach will be more flexible? Can you come up with a different approach?   This is the first time we are actually using an entity system for handling our objects so I wanted to see more perspectives on this matter.   Thank you for reading     P.S if you have any resources on the general application of the entity system to a turn based strategy, please do share  
  3. Hello GameDev, just a little something I made for displaying conversations in the game (and a perfect opportunity to try out screen recording). The following "conversation" was generated from this txt file: [indent=1][CHARACTERS] [indent=2]n = 3 char1 = Neil char2 = Andy char3 = Olaf texture1 = data/img/portraits/Neil.png texture2 = data/img/portraits/Andy.png texture3 = data/img/portraits/Olaf.png [indent=1] [TEXT] [indent=2]text1 = Andy, do you copy? text2 = Yes Neil, what's up? text3 = We got reports of enemy forces moving in from the south. text4 = Your job is to take them out. text5 = No problem!!! text6 = What?! Orange army COs, this is gonna be fun. The class loads up the file (using the config manager) and start parsing through the lines. The "" are used for specifying different commands. The is used for changing characters and is used for making dramatic pauses. The number of commands can be later extended if needed. Additionally, when the mouse button is held down (or any keyboard key), the parser increases the scrolling speed and starts to skip over the 't' commands. Cheers
  4. Aristotel

    The map editor

    Thank you :D
  5. Aristotel

    The map editor

    Thank you ^_^   We are using png pictures, so we directly use the alpha channel of the picture. The purple outline is actually the remainder of how my friend wanted all the ships to glow in space (it looks nice with a dark background). This time we probably won't have things glowing ;)  (and I should probably change the green color to something else, but it is kinda relaxing, probably needs to be softer)
  6. Aristotel

    The map editor

    Hello GameDev, today I was gonna write about the gameplay we were planning to have, but being on vacation with some/no internet connection I was unable to contact my friends about that matter. Instead I will showcase (kind of) the map editor with screenshots (yay for internet cafe). So here we go: This is the map editor.Tthe top box is for inputting the name of the map (for saving and loading purposes). The two 20 boxes are the wanted dimensions. The set button clears the map with the currently selected type of terrain and commits the dimension change. Everything else is for choosing the terrain and switching between terrain and units. This next screenshot shows the map editor in action (as much a picture can show). We will be probably changing the water texture, but for now it works to show the principle. The last screenshot shows the map with units (or unit, the texture is from an asteroid game we did a few months back). When editing units you get an additional button X for deleting units. This map editor should provide a nice and fast way for editing maps. Just a note: all the terrain and unit types are stored in files which we can easily edit to add more. That's all for today, I won't make any predictions for the next entry because this seems to often backfire more than it's worth it. Hope it was interesting :)
  7. Aristotel

    Project screenshots

  8. Aristotel

    General project update #1

    Hello GameDev, today I will just write out the progress made on our project. 1) We have been further improving our GUI so now we have sliders, a working text box, radio buttons (missing textures) and we started to work on scrollable lists. The way we have button callbacks implemented is not pretty so I will try to look into a better way of doing them. 2) Further progress was made on the Editor state so now we can actually make maps, save them to a file, load them from a file and move the camera around. 3) We are still trying to agree how to make the entity system. My friend and I each wrote a version of how we imagined it to work and we will try to make a final decision. I would post a screenshot of the current editor, but I am limited with the current internet connection I have available. For future entries I will try to discuss some gameplay mechanics we will try to implement. Happy coding till then :) (and later ofc)
  9. Aristotel

    The MapManager

    Hello GameDev Arhim here with the third entry for this journal. Today I will be writing about the work done on MapManager. The MapManager is a class that is responsible for loading, saving and drawing the Maps. As an addition we will make a MapTile class that will store tile data (like type, sprites, defence strength...). Let's start off with the MapTile:class MapTile{ public: MapTile(); ~MapTile(); void setType(std::string); std::string type; std::string preview; // will represent the tile in the editor std::vector sprites;}; This should be useful for now. Next we will define the MapManager: class MapManager { public: MapManager(); ~MapManager(); void loadMapFromFile(std::string FILE);// void writeMapToFile(std::string FILE); void setTextureForTiles(); void update(double k); void draw(); private: MapTile data[512][512]; std::string texData[512][512]; int n,m; int tileWidth, tileHeight; }; The setTextureForTiles function will, for each MapTile, read its type and assign a texture from the MapTiles sprite vector.void MapManager::loadMapFromFile(std::string FILE){ ConfigManager config; config.parseFile(FILE); tileWidth = config.getInt("SETTINGS","tileWidth"); tileHeight = config.getInt("SETTINGS","tileHeight"); n = config.getInt("SETTINGS","n"); m = config.getInt("SETTINGS","m"); for (int i=0; i
  10. Hello GameDev, Arhim here with the second entry for this journal. Continuing from the last time I will write about other cores needed for the game. The StateManager is a class that will be responsible for, as the name suggests, managing different states. We will first define a class IState which we will be extending and will provide us with a common interface for states. All states should have a way of updating, drawing and handling events. Also, to make things easier for state managing we will define two additional variables: family and ID. The family variable will store the common type of the state (GameState, MainMenuState...) and the ID will store the specific name of the object as strings. Core of IState should look like this:class IState{ public: IState(std::string mID = ""); // constructor will accept the unique ID ~IState(); virtual void update(double k); // the difference in time from the last update virtual void draw(); virtual void handleEvents(const sf::Event &event); // we handle the needed SFML events protected: std::string family; std::string ID; bool isDrawing; // needed for the StateManager bool isUpdating;}; This class should provide us with the basic interface we will need for the states. Coming back to the StateManager, we will store States as IState pointers in a vector and we will implement some basic functions for adding, removing and switching to states (here the variables isDrawing and isUpdating will help out). The .h file:[code=:0]class StateManager{ public: StateManager(); ~StateManager(); void update(double k); void draw(); void addState(IState* state); void removeState(std::string ID); void switchToState(std::string ID); void handleEvents(const sf::Event &event); private: std::vector states;}; For now only the switchToState function is needed which sets the updating and drawing flags to true. This should leave room for later making states draw over each other while only one state (or more) get updated. Coming up with a nice way for doing the GUI was pretty tricky and we finally settled for the following approach: we will have a base class called Container that will implement all the low level needs for the different GUI parts. After that, every GUI part will implement its own specific functions.[code=:0]class Container{ public: Container( std::string id = "", double x = 0, double y = 0, double width = 0, double height = 0 ); virtual ~Container(); virtual void draw(); virtual void update( double dt ); void handleEvents( const sf::Event& event ); virtual bool mouseLeftDown(); virtual bool mouseLeftUp(); virtual void mouseMoved( int x, int y ); virtual bool mouseWheelMoved( int delta ); virtual bool keyPressed( unsigned int code ); virtual bool keyReleased( unsigned int code ); virtual bool textEntered( unsigned int code ); void addChild( ContainerPt child ); void setParent( ContainerPt parent ); void setColor( const sf::Color& col ); const bool isHovered() const; const bool isFocused() const; const bool isPressed() const; const std::string& getID() const; Vec2f getPosition() const; // absolute position // extend... virtual bool isClicked(){}; virtual void setValue( std::string ){}; virtual void setValue( int ){}; virtual void setDrawing( bool ); virtual void setSelected( bool selected ) {}; virtual void addItem( std::string id, std::string value ) {}; virtual std::string getStringValue() const {}; virtual int getIntValue() const{}; virtual bool isSelected() const{}; protected: bool m_hovered; bool m_focused; bool m_pressed; bool m_drawing; double m_top; double m_left; double m_width; double m_height; ContainerPt m_parent; std::vector< ContainerPt > m_childs; std::string m_id; sf::Color m_color;}; This should give us a nice foundation for making new GUI elements. Before starting work on the Entity system we read the different resources which can be found on this wiki. I left programming of this system in the hands of my friend and he took the challenge to himself to make it work really fast (for the cost of some space which shouldn't matter because of the scope). Anyway, the basics of this approach are the following: you have entities that have a set of components, and system which work only on entities that have the required components (you should read the papers, they are really interesting and I can hardly convey this properly). The way we currently have this implemented uses too much magic (to work fast ;) ) and we will have to clean it or rewrite it before using it in our game and posting it here. For the end I will post a screenshot of what we have for now: This is just the basic setup. The New Game, Options and Exit buttons are logical, but the Edit button will lead to the EditState where you will be able to edit maps of the terrain. The edit me box is there just for testing purposes. I hope you had an interesting read. If you have any suggestions where I should go with this series or what I should change feel free to leave a comment. I am open to new ideas.
  11. Aristotel

    A beginning

    Hello GameDev, Arhim here starting a new journal. First of all I will make some things clear: I am a hobbyist programmer who works on projects for fun and learning purposes English is not my first language so there will probably be grammatical errors Having cleared that up I will, for my first post, talk about the current project I am working on with two of my friends. The basic goal for us is to make a clone of the Advance Wars game for the GBA which is an excuse for trying out an entity system for managing units. (We already made a clone of asteroids where we used hierarchy for game objects). On this project I will be mostly working on the supporting classes and system, one friend will work on the GUI and the other will be working on the entity system. We are using SFML for the window and event handling and OpenGL for rendering in C++ with the help of CodeBlocks as the IDE. We will try to write as much of the engine and game ourselves. Because of that, this journal will be more about engine implementation than game play development. The game will be written for Windows and Linux simultaneously. Starting of that I will write about some of the helper classes needed for the engine. Config manager - mainly responsible for reading and editing config files, but will be used for loading levels, writing game states, etc. Asset manager - responsible for handling loading of textures, sounds, texture maps, as well as unloading and keeping track of already loaded assets 1) The config manager accepts files of this format:[section1] name1 = value name2 = other_value[section2] name1 = value3 name4 = some_other_value[window] width = 800 height = 600 fullscreen = 1 // or on or true The section name goes into brackets and everything following it up belongs to that section. The name-value pairs have to be unique for each individual section and they will be stored as strings. Because of that the ConfigManager should supply a way for reading values as other types like int and bool. Example of use:ConfigManager myCM;int width;int height;bool fullscreen;myCM.parseFile("config.cfg");width = myCM.getInt("window","width");height = myCM.getInt("window","height");fullscreen = myCM.getBool("window","fullscreen"); Similarly to parsing config files, ConfigManager will also be able to write configs to files. I had written a more complex version of the ConfigManager which could read in tree-like structured config files, but that was a complete overkill on my part for a test project. Following that experience this time I settled on making it much simpler. 2) The AssetManager is pretty straightforward. It implements functions for loading textures and binding them with OpenGL, for unloading textures and it keeps track of when assets need to be released. Behind the scenes it uses SFMLs interface for loading image data from files, binds the data with OpenGL and then stores the index returned for later access in a map with string as keys (name of the file) and int as the texture index. For fonts the AssetManager again uses SFMLs interface. For now we don't need to load any sounds or something else because we are working only on the bare core (but if the need shall present itself we will implement it). Hope you had an interesting read For future entries I will be writing about managing states, a bit about the GUI and the Entity system and how we plan to implement it. I hope on getting some pictures in this because it looks dull.
  12. Aristotel

    Economics engine

    Don't know how much this helps, but I played a game called Capitalism II,   it features a pretty extensive economy system with corporations that compete for certain goals (highest market share in electronics, etc.). You can mine resources, build factories to craft the resources into goods, build retails to sell the goods (you can also sell your competitions goods if they allow it). You can set prices on pretty much everything, buy shares of company, take over companies, etc.   This is just if you need some more inspiration ;), cheers
  13. Thanks again eveyone for your help,   great advice and I really like the idea behind ppodsiadly's code.     Have a nice day, Arhim
  14. Thank you eveyone for the replies, it cleared some things up about the definitions.   I am still interested in how a system like this would work:   there are different managers, let's say CollisionManager and HealthManager(more like a general gameplay object manager, just for the simplicity) and you have a object that inherits from 2 interfaces ICollidable and IHealth. This object subscribes to the managers to have its respective states updated each frame. Now, if a collision happens between 2 objects (that both inherit from ICollidable) how should the HealthManager be informed?   I was thinking that when I inform the respective objects of having a collision (by sending ICollidable* of the other object) I tryed to cast those pointers to IHealth and if that failed nothing would happen but if it was successful I update their health parts.   Or should the physics (like mentioned) be completely seperate from the gameplay part. Then where does the connection happen in that case? Does the HealthManager poll for collisions between objects and likewise all the other managers? I presume the CollisionManager would remember already caluclated collisions as to be faster.   Sorry if I am a bother, can you also point me to some articles or examples from which I could learn for myself.   Thank you all very much :)
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!