Post

Visualizzazione dei post da settembre, 2017

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. ...

User Interface - Updating when triggered

Immagine
Here we are, we have almost finished our work on the User Interface. In the previous post  we created the building blocks to update the interface when a DrawUI event is triggered from code. Now let's see how to actually draw the changes on screen. Let's say we have 2 health points left out of 3. Then I want to draw 2 green ships icons, and 1 grey ship, like this: I have to create 2 FOR loops: the first one from 1 to lives  for the green ships; the second one from life + 1  to maxLives  for the grey ships. (We created these variables here , in case you don't remember). It could be easily done by code, but since I'm working on the HUD inside its blueprint, I will try to write this in the graph editor. We already added 2 WrapBoxes to the HUD, one for health points and one for resources; the first step is to remove any object inside each box, so we can start from empty containers. Unreal gives us the useful method Clear Children, that we're go...