Post

Working buttons

Immagine
In this post we already bound functions to the pressing of either the "Deploy mine" or"Repair" buttons. Now it's time to make them really work! First, the easier one: Repair button. In this case it's just a matter of completing the Repair() function; I want all these actions to happen only when we are in the player's turn, which means being in gameState == 0. If we're not in it, simply return. We also have a boolean variable called repairAvailable , that updates itself based on how many resources we collected; if it's false , let's return as well. In case none of the above happens, we can actually repair our ship: this means adding 1 life to the player ship, and removing 2 resources from our collection. Please note that calling the AddLives() and RemoveResources() methods, will automatically take care of updating the UI and the repairAvailable variable. (In this case the UI will be redrawn twice, but it's not a problem). Here...

Collecting resources

Immagine
I'm finally back to programming after some time spent with 3D modeling, printing and a hard disk failure that forced me to re-install everything, including Unreal Engine and Visual Studio, with all the troubles of importing the project in a new environemnt (I tried to switch to VS 2017 and UE 4.17, but I reverted back to VS 2015 and UE 4.15 after several compilation fails). And the next thing I'm going to handle is the raw material for building our mines and for repairing the spaceship: collecting resources! To display and manage resources we're going to use many techniques we already used for enemies. It's actually even simpler, because a resource will spawn at a location and never move until it's collected from either the player or an enemy. As a first step, I imported the asset I created in Blender (my floating potatoes): Then I created a C++ class named "ResourceClass", and I derived a Blueprint Class from it so we can easily add multiple ...

3D printing the starship miniature

Immagine
In the previous post  I modified the starship model used in-game to make it's printable, adding details and making sure it's manifold . Let's export it in a print-friendly format, like .STL : Now it's time to give it a pass with a dedicated software to check its integrity. Since my O.S. is Windows 10, i'm going to use the built-in application 3D Build ; it's very simple but works perfectly for checking and repairing 3D models. There are many alternatives online, like Netfabb by Autodesk (you can download the free trial: for the first 30 days you'll have access to all the functionalities of the software, and after the trial expires you still have the basic features working, and they're enough to preview and fix your 3d models). Importing the model Automatic repair Now, with my Geeetech Prusa I3 MK2 3D printer I'm going to use the dedicated software called Repetier; this will use an engine called Slic3r to create a series o...

How to prepare a model for 3D printing

Immagine
Today's post won't be about programming or game design, but I'm going to create something related to my game, so I guess it still fits in my game development blog (and I'm so excited with 3D printing, I needed to share it with someone!) For my birthday my family gifted me with a beautiful 3D printer. It's a Prusa I3 Pro, with maximum printable dimensions of 200x200x180mm. A test cube, printed and painted with acrylic colors After a long assembly work and some test prints I wanted something original to print; I thought it would be a good idea to have a miniature of the Player ship of my hexagon project: the model was already made, I just needed to add a stand. This is the model I used in-game; I made most of the details with textures, but since the 3D print will be totally white, it's a good idea to add some details to the model itself, to help later with the painting process. I'm using Blender to make my 3D models. It's a freeware...

Cloaking device

Immagine
The next problem I want to address is hiding the enemy ships when they're on undiscovered tiles, and obviously showing them as soon as they enter a discovered one. This can be easily done with the Actor's SetActorHiddenInGame() method, but I want to try and make the effect a little nicer, by playing an animation from totally transparent to totally opaque while the ship is moving. But first things first, let's use visibility to make it visible as soon as it starts to move from an undiscovered tile to a discovered one: Since all enemies start from outside the grid, their initial visibility will be set to "hidden" by default: Remember that the method sets the Actor to Hidden, so passing a true parameter means we want it to be invisible, and passing false will show it. Then I created a new int variable in enemyClass.h, and I called it changeTransparency; it can take 3 values: 0: the ship doesn't need to change its transparency. ...