Development Pt.1

Development Pt.1

Rapid prototyping is the first step on this, let’s name it “Road of the Development” to keep RPG theme, and its purpose is straightforward. Implement basic functions as quick as possible. Polished, fancy looking 3D assets are far away at this stage. So first step is to implement main character. Changing armors and weapons is inseparable part of RPG themed games. To allow player dress hero to their taste. “I’m in a good mood today, I want to be a paladin that help others in these hard times.”, “My boss has really pissed me off today, I’m gonna wear dark steel armor and smash everyone I’ll meet during my journey today!” and so on… Implementation of such a system depends on ones experience and knowledge, as well as preference. I’ve decided to use segmented meshes to avoid, or at least minimize, clipping issues with meshes (). Function logic is simple, just switch meshes when new armor or weapon is equipped. For rapid prototyping purpose, I’ve decided to use mannequin which is included in UE4 Engine. Once it is properly set up, one just need to swap meshes for finished assets and it should work.

Example of segmented mesh. You can cut mesh to as many parts as you want, depends on game design and mechanics.
Simple setup inside UE4 engine. You can add as many components as you would like to. Beard or hair meshes, if you want allow player to customize character a bit…etc. Note that cape, depite being an aror parts, have their own slots. Head, as well as helmet, is non deforming mesh, unlike other body parts, so chances of clipping artifacts are minimal. Cape, on other hand, is going to be driven by PhysX cloth simulation, and there will be some clipping no mater what you do.

Base character setup is basically done. Next step is to create some assets, like helmet, armor, weapon, and test how it works. But first let’s talk about what in-game object is. Disregard 3D mesh now, and let’s talk about in-game object itself. Let’s say, piece of breastplate. It not only holds information about what 3D mesh has to be loaded and rendered, it also holds other variables as well. Object class, armor value, weight of armor, basically whatever variable you want it to contain. So we can say that in-game object is basically a collection of variables, where each variable carry some information about object. So what we want to do now, is basically create structure of variables we want to use for in-game objects. In UE4 it is called simply “Structure”. Inside structure file you can add as many variables as you wish. My structure file looks like this.

Each in-game object that uses this file will contain all these variables. All these variables can be later changed or accesed to extract required information. i.e. Picking object from the ground will transfer these information to your inventory slot, and use “icon” variable to change appearance of inventory slot. If breastplate is equipped, game will access skeletal mesh variable and swap currently equipped mesh for new one…etc.

I’m thinking about adding a crafting system at alater stages as well, so I’ve decided to add “recipeIndex” variable for later use. Still trying to come up with new game mechanics that could be add to the game, but need to set up basic functions first. Collider added to actor component detects collision with player character , allowing player to interact with object, using simple bool check that is switched to true/false using onCollisionEnter/onCollisionExit. Inventory system works basically as described on image above. If object enter collision with player character, player can interact with said object. Above mentioned variables are then moved from game world to inventory slot and actor is deleted from the world. For this purpose, we need to add few more variables to player character. Variable that holds information about item, array that holds information about all items in inventory, and I’m also gonna add integer variable that defines inventory size. “inventorySize” variable will allow me to modify player’s inventory capacity at later stage, let’s say, through unlocking required skill in skill tree, or wearing armour that allows player to carry more items…etc. I’m not going to implement that mechanics righ now, but it is good idea to think forward. The key (at least in my opinion), is basic logical thinking. What I want object to do on interaction? What actors/objects depend on this function/variable? Sometimes it helps me to simply use power point and visualise what I want to do in logical order.

Simple visualisation of logical order. Sometimes it helps me to see what exactly I want to do. I use this quite a lot, especially when designing advanced shaders/materials. Try to think logically, i.e. If I move “Destroy Object” function before “get variables”, it won’t work, since object carying these variables was destroyed before and doesn’t exist anymore. It’s just a very simple example, and it will get messy at later stages, where one function depends on 10 different variables from 5 different objects…etc.

This simple function should move item from world to inventory. But inventory does exist only on blueprint level for now, so next step should be to create invenotry UI. For this purpose I’m going to create simple inventory window and populate it with buttons. Buttons allows us to detect collision with mouse cursor, change appearance on click on button, on “mouse over”…etc. (this also gave me an idea of another game mechanic I can implement later. That’s where notepad comes handy.). Now, “inventorySize” variable from player character comes handy. “inventorySize” basically defines how many slots will be in inventory. Simple logical function described above should now move item from world to inventory.

Do not forget to add simple check if there’s a sapce in inventory. Simply by getting amount of objects from inventory array and compare it to “inventorySize” variable. If inventory “arrayLength – 1” = invenotrySize, there’s no more space in inventory.
Simple inventory window, populated by buttons that will hold information about items. Note the empty space at the bottom half. It’s going do be used to display description of item when mouse cursor hover over the item in inventory, simply by getting “description” variable from variables collection I’ve created before. It should work.

Picking items should work now. I’m not going to create fancy inventory slots and icons for items at this stage. There’s simply no reason to waste a time on creating fancy graphics just to find out that inventory system is broken. Creation of detailed, polished assets and graphics is still far away. Nice looking, but broken game is still a broken game. Still need to implement function that will increment item position in inventory if slot is already taken. Simple check should do the job. Since picking object will transfer all variables from the object to inventory, we can check if slot contains object of any class. If there’s object of any class in the slot, it will simply increment position of item in inventory.

Simple check if slot is taken. If it is taken, it should increment position by 1.

So let’s drop some test objects to the game world and pick them up.

It works (surprisingly).

So that’s picking objects done for now. I’m going to add few more variables to the player character before embarking for nightsfit again and will continue later (got 3 days off after this shift, wohooo). I’m gona add float variables for health and stamina, and since it is going to be fantasy themed game with RPG elements, I’m going to add variables like armour type, enemy type, weapon type…etc.

So, for weapon type, enemy type…etc. I’m going to use Enums. It will help me to implement some fighting mechanics at later stage, i.e. Higher damage against specific type of enemy for weapons, better defense against specific enemy types for armour pieces, potions to increase specific damage/defense…etc. Took a bit of inspiration from Witcher 3 video game for enemy types haha.

So that’s me done for today, just going to put some footnotes here and that’s it.

Footnotes

World map – creating inventory window using buttons has given me an idea of world map and functions related to travelling. Populate world map with invisible buttons that will execute different checks on collision with player’s icon traveling through the world map.

  • Locations – Reveal location on world map on button collision with player icon
  • Hidden locations – on button collision with player icon, get “perception” variable from player and perform roll to reveal hidden location (i.e. player’s perception = 10, get random integer in range of 0 – 100. If player’s perception => random integer, location is revealed on the map)
  • Secret locations – perform same roll as above, but only if player has certain skill unlocked. (possibility of use of easter eggs?).

Need to test it first. But at a later stage, after other, more important mechanics are implemented. I’m just going to leave it here for now, and will return back to it later.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a website or blog at WordPress.com

Up ↑