Update [0.230923]


Summary:
A lot of effort went into cleaning up and reorganizing the code. Several new features, such as an Observer System and State Controller, are now in place. Let's dive in.


What's New:

Here's a rundown of the main updates:

  • Code Cleanup: The game reached a point where better organization was essential. So, various pieces of code were either moved, deleted, or updated to make everything more cohesive.
  • Observer System: This feature keeps tabs on specific values and notifies other parts of the code when changes occur. It was challenging to implement, but it's doing its job well.
  • State Controller: This acts as the game's "brain," governing changes in the game state. Everything else in the game reacts to this centralized system
  • UI: The UI used to be tightly bound to game controllers. Now, thanks to the Observer System and State Controller, the game can run without being tied to the UI. This means that removing any UI element won't crash the game.
  • Scene Cleanup: Every UI element has been converted into "Packed Scenes" and organized under a main UI component. This not only tidies things up but also allows each component to focus on its own specific function. Overall, it's a big step toward making the project more manageable.

Challenges and Solutions:

Skipping the Code Cleanup, as it's too much to unpack here. However, the Observer System does warrant a detailed look:

  • Observer System: This system is vital for cleanly separating various game logic pieces. It's a bit intricate but pays off in spades for extensibility and maintenance. Here's what it entails:
    • ObservableProperty: Just as the name suggests, it's a property that triggers an action when its value changes. Setting up a new observable property is fairly straightforward, and you can bind other properties to it just as easily. Whenever a property changes, an event is fired, alerting all the listening objects.
      So, anytime the value of any of the properties changes it fires an even to the listening objects.
    • ObservableAction: Similar in concept, this is essentially a wrapper around existing actions, making them generic. Creating and binding new actions is simple. The generic nature of these actions greatly simplifies a lot of issues, making it easier to keep the code clean and manageable.
  • State Controller: This is essentially the game's command center, coordinating all observable properties based on mouse inputs. By doing this, it enables the game to run using just a SINGLE PROCESS METHOD. What happens is the State Controller listens to mouse events, and then toggles the state of the game accordingly. This, in turn, triggers the appropriate observable properties, and thus the necessary game components, to update.

    Here's a quick illustration: when you press the left mouse button, the property "IsMouseLeftDown" is set to true. This change then fires off an event to any other component that's listening for changes to this observable value.
  • Scene Cleanup: The UI has undergone a significant overhaul, moving from a somewhat disorganized structure to a cleaner, more modular setup. All UI components have been encapsulated into their own "PackedScenes." This approach not only tidies up the main UI scene but also localizes the functionality of each UI element.
  • Building System: Hey, let's talk about the fun stuff—buildings! I managed to clean up the game behavior, which is already helping me sidestep potential bugs. Here are some of the improvements:
    • Show/Hide Buildings: You know that building tab that's always on your screen? Now you can easily toggle it on and off just by tapping the same tab again. Keeps the screen cleaner and lets you focus on your game.
    • Display Info: Got a small but neat update here. Now, building info will only pop up when you hover over the button, and it'll go away the moment you move the cursor out of the button's area. A small change, but makes the experience feel a lot smoother.
    • Building Placement: So, now when you're dragging a building around the map, you'll actually see it where it could go. If the spot's good, the building stays visible; if not, it disappears. It's still a work-in-progress, but I'm liking where it's headed!

Up Next: Displaying Resources and Selecting Buildings

Alright, the housekeeping is done, the stage is set, and now the real fun begins! Here's what I'm diving into next:

  • Displaying Resource: Let's make resources visible on the map, shall we? This way, you won't have to hover over every grid cell to find out what's there.
  • Building Selection: Placing buildings is good and all, but how about clicking on them to see what they're up to? Time to add some interactivity to these static structures.

I'm pumped! Finally, I can focus on enriching the gameplay experience without the fear of breaking everything I've built so far. Let's get to it!

    Update [0.250923]


    Sumary:
    What a ride it's been! While I might not win any awards for 3D modeling, I'm thinking of giving it a go. The game itself is coming along nicely, especially since the last update made everything more streamlined and easier to handle. It's like a well-oiled machine now, making adding new features a breeze.

    I've also switched gears on how I'm showing off progress. Instead of diving deep into the code, I've opted for a more visual representation. It just feels more intuitive and engaging. But for those who are code-curious, the GitHub link is available for anyone interested. Feel free to fork it and mess around!


    What's New:

    • Resource Display Toggle: Now, you can quickly see where all the important resources are on the map by simply pressing the "Z" key. This feature is somewhat inspired by how resource mapping works in games like Civilization. One press, and all the resource icons will be revealed or concealed based on your needs.

    • UI-Based Resource Rendering: Instead of cluttering the 3D game plane with resource icons, I opted for a cleaner approach by rendering these icons as UI elements. This way, the game interface remains clean while providing crucial information. For the time being, the positions of these resources are updated using the "Process" method, but plans are in place to refine this system.

      The camera's extreme zoom-out in the second GIF is just for demonstration purposes. In actual gameplay, the camera won't zoom out in that way; it's only to emphasize that the resource icons are UI elements, not objects on the 3D map.

    • Universal Selection System: The new selection system isn't just limited to buildings; it also extends to units on the field. Whether it's a building or a unit, clicking on it will now trigger a "SelectionScreenUI." This UI panel provides detailed information on available units, upgrades, or any other relevant attributes.

      The universal selection feature adds a new dimension to gameplay, offering a unified interface for making strategic choices. It makes the entire game more interactive by letting you engage directly with both buildings and units. It's one of those features that should make both micromanagement and strategic planning more fluid and intuitive.

    • Right-Click to Deselect: Added a straightforward right-click function. Now you can cancel any current selections or building placements and return to the original view. This makes it a bit easier to navigate and correct any misclicks or changes in plans.

    • Small Fixes and Improvements:

      • UI Overlapping Fix: Resolved an issue where clicking on a UI button would inadvertently select a building positioned behind it.
      • UI Staying Visible: Rectified the issue of UI elements remaining visible after a building has been placed.
      • Input Fixes: Adjusted mouse input so that left and right mouse buttons trigger actions only once per click, rather than continuously while held down.
      • Buildings Overlapping: Implemented checks to prevent multiple buildings from being placed on the same cell.

    Up Next: Civilizations and Units, Here We Come!

    Alright, now that buildings, upgrades, and units are up and running, it's time to diversify. Who wouldn't enjoy ruling as France or England—two nations known for their "peaceful" history?

    • Civilizations: Starting off with France and England. Once these two are set up, adding more civilizations should be straightforward.
    • Units: Ah, the backbone of any strategy game. Here's where I hit a snag—I'm not exactly an expert when it comes to 3D modeling. But I've got a couple of ideas I'm stoked about:
      • 3D Static Objects: Think chess pieces. Simple, yet effective, and best of all—no need for complex animations or rigging.
      • 2D Sprites: Imagine taking existing 2D sprites and scaling them to fit as units. They'd look like moving banners on the battlefield.

    By the way, there might be another game project in the works with a friend. If it goes beyond the planning stage, it will be developed in Godot. Keep an eye out!

    PancakeGenie If the spot's good, the building stays visible; if not, it disappears.

    It's probably more convenient to make the building semi-transparent, so that it doesn't completely disappear.

      Tomcat Thanks for the suggestion!

      I didn't yet figure out how to approach it completely. I am considering making it semi-transparent even if it is on buildable tile but to color it either green (if can be placed) or red (if can't be placed). This way the player knows that the building isn't built.

        PancakeGenie I am considering making it semi-transparent even if it is on buildable tile but to color it either green (if can be placed) or red (if can't be placed).

        That would be the best option, but the building itself is red, so I'm not sure it would be clear. But it's possible to try.

        Update [0.270923]


        Sumarry
        This update might not look like much, but it took a good bit of work to get here. I managed to move from a single item list to separate databases for each civilization. It was a bumpy road with a few editor crashes along the way, but now everything auto-updates from Google Sheets. It's a small but important step that should make things easier down the line.


        What's New:

        • Civilizations: After some steady work, the game now features two foundational civilizations: England and France. I've structured things in a way that should simplify the addition of more civilizations in future updates.

          • Buildings: Each civilization has its own set of buildings. To give you an idea, the Archery Range for England is visibly different than the one for France. This brings an extra layer of immersion to the game.
          • Selection: With this update, the selection mechanism has become more nuanced. When you select a building, the available units and upgrades you see will vary based on the civilization you're playing. This means that an English Archery Range will offer you an "Archer" unit, while the same building for the French civilization will not.
        • Item Database A significant behind-the-scenes change is the switch from a centralized item database to civilization-specific databases. Each civilization now has its own database of items, loaded at the start of the game. This way, players are limited to building what is actually available for their chosen civilization, much like in the Age of Empires series.


        Up Next: A Foray into "Artistic" Modeling!

        Look, I'm not exactly Michelangelo with 3D models, but I'm ready to take a swing at it. Consider this my artistic cooldown lap after a marathon of code. Expect some... let's call them "minimalist" models making their debut in the game. They may not win beauty contests, but they'll certainly add character!

        And why the single-color palette, you might wonder? Well, it's all about "optimizing the render pipeline," obviously. Totally not because my modeling skills mirror my cooking abilities: functional but unremarkable.

          PancakeGenie Look, I'm not exactly Michelangelo with 3D models, but I'm ready to take a swing at it. Consider this my artistic cooldown lap after a marathon of code. Expect some... let's call them "minimalist" models making their debut in the game. They may not win beauty contests, but they'll certainly add character!

          In order not to make models from scratch, I suggest to pay attention to programs that facilitate their creation.

            Tomcat I looked into the discusion but those are for the characters and trees. I might be missing something. I need to make buildings (barracks, archery range, stables, etc).

            But my idea for units will be similar to how the Battle Brothers did it or something close to it! To simplify is as much as I can without taking it too seriously.

            But I will, maybe, use the Make Human Blender plugin. Will see! Thanks for the tip!

              PancakeGenie I need to make buildings (barracks, archery range, stables, etc).

              Sweet Home 3D, which is also mentioned there, is good for creating buildings.

              To simplify is as much as I can without taking it too seriously.

              MakeHuman has models of different polygonality. Very low poly

              Update [0.011023]


              Summary
              Hey folks! Life's been keeping me on my toes lately, so I haven't been able to dedicate as much time to this project as I'd like. I've also started planning another game, but this project remains my detailed sandbox where I learn and experiment. My journey with Godot has taught me a lot, and I'm cautiously optimistic about the games I can create in the future.

              Enough about that—let's talk about what's new here! I've added a handful of features, each contributing in its own small way to the project. Yes, that includes implementing drag-and-move, object pooling, and a 3D model! Let's dig deeper into these updates.


              What's New:

              • Building Placements: Taking into account some helpful suggestions, like the one from @Tomcat, buildings that can't be placed on a particular tile will now appear transparent. This is a simple yet effective way to provide immediate feedback to the player.

              • Drag-and-Move: I've implemented a more intuitive drag-and-move system. By holding down the right mouse button, players can now pan around the map with greater ease.It's a quality-of-life improvement that makes exploring the game world a bit more comfortable.

              • Object Pooling: Resources appearing on the map are now managed through object pooling. This means that only the required number of resources will be created and displayed at any given time, conserving system resources. If more are needed, they'll be dynamically added to the existing pool. This should help in keeping the game performance more stable.

              • Archery Model: I'm pleased to have completed a simple yet functional model for the Archery Range building. The model has been optimized for game performance, using just a single material and eliminating unnecessary polygons.

              • Other Changes: Some not so visual changes that affect the game:

                • Raycasting Adjustments: As the game screen has been stretched to fit various display sizes, some new challenges emerged with raycasting, particularly when the window is resized. After a bit of work, I've managed to modify the raycasting logic so it now takes into account the window size and aspect ratio. It's not something you might notice outright, but it's crucial for maintaining the integrity of player interactions within the game.
                • Building Height Calculations: Previously, all buildings were placed at a uniform height, which led to some unrealistic scenarios — buildings would sometimes appear to be submerged in the ground or hovering above it. To address this, I've adjusted the building placement algorithm. Now, each building's height is calculated based on the specific tile it's placed on, ensuring that structures are neither buried nor floating, but instead fit naturally within the landscape.

                PancakeGenie Archery Model: I'm pleased to have completed a simple yet functional model for the Archery Range building. The model has been optimized for game performance, using just a single material and eliminating unnecessary polygons.

                This is very strong work — a small amount of polygons, but the building is very expressive! 🏹

                Update [0.031023]


                Summary
                Hi all, I've been spending some time on UI work, logic adjustments, and a bit of modeling lately. While there's still much to learn and refine, the project is coming along. The codebase is getting quite extensive, making it a bit more difficult to keep track of everything. I'm considering adding more comments for clarity, although I usually rely on well-named methods, variables, and classes to keep things understandable.


                What's New:

                • Building Hotkeys: Simplifying player interactions, you can now use hotkeys for selecting and building structures, eliminating the need for repeated button clicks.

                • New Building - Barracks: A humble addition to the game. The Barracks model follows a similar aesthetic to the Archery Range. It's designed to be efficient with a minimal vertex count and shares the same color palette texture as previous models.

                • Revamped Building Selection UI: The previous UI had sections for "Battle," "Resource," and "Economy," which felt cumbersome to navigate. The new UI layout places all these elements under one umbrella but categorizes them for easier navigation. Added a bit of smoothness to the transitions as well, thanks to Godot's Tweening capabilities.

                • Drag-and-Move Building:: A small but handy change—while dragging the map to explore, any "ghost" buildings you're holding won't be canceled. The building will only be placed once you stop moving the map.

                • Building Canceling: Added the ability to cancel "ghost" buildings using the "Escape" key, right-click, or "B" key to select a new building. A tiny feature that makes a big difference in gameplay fluidity.

                • Civilization Colors: All civilizations now share the same building models, but the building colors change depending on the chosen civilization. In the future, players will have the option to customize these colors. This change required a slight alteration in rendering, requiring two draw calls instead of one.

                • OtherChanges:

                  • Instant Placement: Now, buildings appear immediately on the selected tile.
                  • Build Rule: You must deselect a selected building to build another.
                  • File Format: Switched from .GLB to .OBJ for models.
                  • Resource Icon Positions: Slight improvements to resource icon placements on the screen.
                  • UI Hotkeys: Building hotkeys are now displayed in the UI.

                  PancakeGenie File Format: Switched from .GLB to .OBJ for models.

                  What's the reason for the change? What are the disadvantages and advantages?

                    Tomcat Ah, because I needed only the mesh so that I can place it directly on the Packed Scene with MeshInstance3D as root component.

                    Each building has the same two materials: Color Palette and Civ Color. So, for the whole game I only need a two material resource objects that I apply to every unwraped model. This makes it so the renderer finishes rendering in only two drawcalls (because all of the models use the same material). At least this is how Unity did it.

                    I never used .GLB but it seems to be that there is no easy way to add resource material to it. Also, it creates a packed scene that I can't edit by placing StaticBody3D and CollisionShape3D under it.

                    I didn't play with .GLB long enough and I am much more familiar with the .FBX or .OBJ formats in games.

                    Update [0.061023]


                    Summary

                    Though my birthday celebrations and diving into procedural generation in another project ate into some development time this week, I still managed to make some important updates to the game. Let's dive into what's new.


                    What's New:

                    • Turns: After some development effort, a turn-based system has now been implemented into the game. Each game will have a last turn capped at 65,535. While this might seem like an arbitrary number, it's set high enough that it should never become a limiting factor in any game scenario.

                    • Building Delay: The instant build mechanism has been replaced with a more realistic building delay feature. Now, constructing a building takes a specific number of turns based on what you're trying to build. For instance, a Barracks will now require 2 turns to complete, and a Market will take 3 turns. The visuals for this feature are still in the works, but functionally, it's operational.

                    In addition to these updates, I've made a number of bug fixes and logic alterations to ensure a smooth integration of the new "Turn system".