Stellar Survivor

IMAGES
Gameplay screenshot of Stellar Survivor
Traps and enemies of Stellar Survivor
World and enemy of Stellar Survivor
ABOUT THE GAME
Stellar Survivor is a survival and tower defense game made for PC by a team of 29 students during the entirety of our third year. Our objective for this project was to create a survival game.

This game went through a lot of iterations, so a lot of the work that I did for it did sadly not make it to the final builds. I will, however, still document this work to show what I did.
SPECIFICATIONS

Made in
Unreal

Made in
8 months
TRAILER
DOWNLOADS

Download on Steam

My Work

MY RESPONSIBILITIES
During this project, my tasks varied a lot, but overall my main focus was on gameplay related programming and making sure the core and main systems of the game were fully function and working. Almost all work this project was done using C++, with minor Blueprint work mostly done by designers.

My responsibilities during this project:
  • System for player drainers (health, hunger, etc)
  • Complex inventory system
  • System for gathering resources
  • System for interacting with objects
  • Programming Lead for 10 weeks
  • Game stability
MY WORK HIGHLIGHT
Inventory System: Base code
My largest task for this block was creating an inventory system. The inventory system was supposed to work very similarly to the inventory in the game Minecraft, allowing people to drag items to different slots, and have stacks of different items. We also wanted some items to take up more slots, to promote inventory management.


This inventory system was created using an inventory class, item class, and item struct. The item struct was used by Unreal data tables to allow designers to create as many items as they wanted. This data table would be loaded and saved at the start of each game.

The inventory itself consisted of an array of item pointers for each of the inventory slots. This allowed multiple slots to link to the same item for larger items. There was one widget that handled the entire inventory, and that used this array and had child widgets for each of the linked slots.

Only 1x1 size items and no dragging.

Inventory System: Dragging items
The next thing to add was being able to drag items from one slot to the other. In order to do this, I could simply use the slot widgets to check when they were clicked. There would always be one invisible 'hand' slot and whenever you clicked an item, it would switch whatever is in hand with whatever is in the clicked slot.


During this stage, I realized I had to make empty slots contain air instead of nullptrs, as this would make switching the object with the one in hand easier, and would make for a better check, so I simply created a new item using the data table, with ID 0. Now I could simply check for items of ID 0 to see if the slot is empty.

Adding dragging itself didn't prove to be as difficult as I had thought, but the real challenge was making sure dragging would work properly with different item sizes, without causing any crashes.

Dragging items working.


Inventory System: Different Item Sizes
My final task was the most difficult one. Making sure I could give items any size. I started by adding a Size Vector2D to the item data table and then proceeded to change the code for adding and removing items. Most of this wasn't a big problem, but dragging items definitely was.


For dragging, I had to make sure that when an item is grabbed, it would change all the slots occupied by this item. I did this by giving each item an int value for the slot, and by looping through other slots from that slot to the right and bottom based on the item's size.

I could then change all the values at once, and make sure I picked up the item. This worked rather well, except for the fact that I had to make sure that when I placed the item, it would only occupy the new space actually taken by the new item, instead of all slots of the item picked up. For example, when you place a 1x1 rock on a 2x2 one, only one slot should become the smaller rock, and the others should become air.


Different item sizes working.


I also had to make sure you could only place large items when there actually is space on the clicked location, otherwise, we would get nullptr exceptions and the game would crash. Finally, I had to also make sure that the widgets would resize for items of larger sizes, but this was quite easy.


Inventory System: Final reflection
In the end, most people were quite pleased with the inventory system I produced, but the game took a different turn. After we decided to go for a tower defense game, instead of a classical survival game, the inventory was no longer needed. After some discussion and trying to find another use for the inventory, it was clear it would simply not fit with the game we were making, so we decided it would be cut out completely.


If I had to create an inventory like this again, my biggest change would be to make sure I have all the right C++ classes in place before I start writing the code, especially for the widgets.

There were some times where I created a Blueprint for a widget I needed, without making it a C++ class first, and this always led to problems in the end, as I wouldn't be able to access some of the variables I needed in C++. This led to me later moving a lot of the logic to C++, which cost a lot of extra time.

Dragging items of different sizes.



Though it was a shame that all of this work would not be shown in the game, it was definitely a valuable learning experience. It taught me a lot about working with C++ and Unreal, something I hadn't previously done much, and it also gave me a much deeper understanding of the way widgets work in Unreal.






Stellar Survivor



ABOUT THE APPLICATION


Stellar Survivor is a survival and tower defense game made for PC by a team of 29 students during the entirety of our third year. Our objective for this project was to create a survival game.

This game went through a lot of iterations, so a lot of the work that I did for it did sadly not make it to the final builds. I will, however, still document this work to show what I did.
IMAGES


View from the entrance

View from the bathroom

View from the bathroom
SPECIFICATIONS





Made in Unity



Download on Steam




Made in 9 months
MY RESPONSIBILITIES


During this project, my tasks varied a lot, but overall my main focus was on gameplay related programming and making sure the core and main systems of the game were fully function and working. Almost all work this project was done using C++, with minor Blueprint work mostly done by designers.

  • System for drainers (health, hunger, etc)
  • Complex inventory system
  • System for gathering resources
  • System for interacting with objects
  • Programming Lead for 10 weeks
  • Game stability
MY WORK HIGHLIGHT


Inventory System: Base code

My largest task for this block was creating an inventory system. The inventory system was supposed to work very similarly to the inventory in the game Minecraft, allowing people to drag items to different slots, and have stacks of different items. We also wanted some items to take up more slots, to promote inventory management.

This inventory system was created using an inventory class, item class, and item struct. The item struct was used by Unreal data tables to allow designers to create as many items as they wanted. This data table would be loaded and saved at the start of each game.

The inventory itself consisted of an array of item pointers for each of the inventory slots. This allowed multiple slots to link to the same item for larger items. There was one widget that handled the entire inventory, and that used this array and had child widgets for each of the linked slots.




Only 1x1 size items and no dragging.


Inventory System: Dragging items

The next thing to add was being able to drag items from one slot to the other. In order to do this, I could simply use the slot widgets to check when they were clicked. There would always be one invisible 'hand' slot and whenever you clicked an item, it would switch whatever is in hand with whatever is in the clicked slot.

During this stage, I realized I had to make empty slots contain air instead of nullptrs, as this would make switching the object with the one in hand easier, and would make for a better check, so I simply created a new item using the data table, with ID 0. Now I could simply check for items of ID 0 to see if the slot is empty.

Adding dragging itself didn't prove to be as difficult as I had thought, but the real challenge was making sure dragging would work properly with different item sizes, without causing any crashes.




Dragging items working.


Inventory System: Different item sizes

My final task was the most difficult one. Making sure I could give items any size. I started by adding a Size Vector2D to the item data table and then proceeded to change the code for adding and removing items. Most of this wasn't a big problem, but dragging items definitely was.

For dragging, I had to make sure that when an item is grabbed, it would change all the slots occupied by this item. I did this by giving each item an int value for the slot, and by looping through other slots from that slot to the right and bottom based on the item's size.

I could then change all the values at once, and make sure I picked up the item. This worked rather well, except for the fact that I had to make sure that when I placed the item, it would only occupy the new space actually taken by the new item, instead of all slots of the item picked up. For example, when you place a 1x1 rock on a 2x2 one, only one slot should become the smaller rock, and the others should become air.




Different item sizes working.


Inventory System: Final reflection

In the end, most people were quite pleased with the inventory system I produced, but the game took a different turn. After we decided to go for a tower defense game, instead of a classical survival game, the inventory was no longer needed. After some discussion and trying to find another use for the inventory, it was clear it would simply not fit with the game we were making, so we decided it would be cut out completely.

If I had to create an inventory like this again, my biggest change would be to make sure I have all the right C++ classes in place before I start writing the code, especially for the widgets.

There were some times where I created a Blueprint for a widget I needed, without making it a C++ class first, and this always led to problems in the end, as I wouldn't be able to access some of the variables I needed in C++. This led to me later moving a lot of the logic to C++, which cost a lot of extra time.


Though it was a shame that all of this work would not be shown in the game, it was definitely a valuable learning experience. It taught me a lot about working with C++ and Unreal, something I hadn't previously done much, and it also gave me a much deeper understanding of the way widgets work in Unreal.




Dragging items of different sizes.