# DEVELOPING THE JINX GAME FOR NEOXIAN CITY - THE USER INTERFACE

in Game Development2 months ago (edited)

Hello folks, It's been quite a while I've posted any game dev content and it was for good reason, I was feeling ill, so I decided to avoid any content that takes too much concentration, I could manage to post about art or fiction, but I shied away from anything that would compound my headaches lol. I posted briefly about my health a month ago.

With refreshed health, I decided to go back to my projects I still plan to finish the runner game and maybe pick up on one of my world building fiction to adapt a new game but I also got another idea, I wanted to work on something relevant to a community on Hive, particularly Neoxian city.

The Jinx Game was an Idea originally coined by Mr. Neoxian himself, it is a probability game in which active chatters in the channel can earn his 100% dragon vote by guessing a random number within a given range. The closest guess to the winning number would win but this win could also be de-buffed by other players. The rules were as followed...

The game was pretty fun while it lasted, until Mr. Neo complained of the laborious method of manually figuring out a winner, the thing is, like all probability games, there is a vast amount of random combinations in which the game could go.

In my brain, I already wondered the logic behind it and how it could be automated, so I decided to pick up the challenge at the right time, Although halfway into this challenge I realized that I was building a royal rumble of (if-and-nested if conditions) which was very tasking but since I already committed myself, I had to see it to the end. I've actually succeeded in developing a working prototype that I submitted to Mr. Neoxian, so I will talk about my development process in this series of posts.

CONSTRUCTING THE USER INTERFACE AND COLLECTING DATA

A user interface is centered around the user but first, it is important to figure it out from the POV of the player. but for this kind of close circuit game, Mr. Neo is actually the player number one, although there is a solid multiplayer concept around this game, the fastest route to creating a working prototype is building it from a POV of Mr. Neoxian in a more controlled system.

That is the first screen transition I designed, I tried to make the GUI simplistic while also portraying elements of the Neoxian city theme.

The first screen accepts values that are then wired through the scripts that track the text fields and store the data, but what if the data is corrupted, lets's say the user inputs a value with the wrong data type, I had to catch exception cases for all the text fields. An example of an exception-catching code snippet is below.

After collecting the data, I had to set up a dynamically spawned text fields that accepted the player names based on the stored data entry.

The unity software treats each screen element as game objects, so I had to dynamically instantiate the text fields based on prior data, doesn't matter if the user entered 10 or 100 player numbers. dynamic instantiation takes a bit of understanding gameobjects and instances.

The next screen is where the main battle begins, all the player abilities, advantages and debuffs is collected in these fields, scanned and stored in a dynamic array through the script. the variables in the arrays are then scanned and calculated against each other to get the winner, I used quite a number of find() methods and array point indexing to keep track of user data in this game. at times it felt like juggling 5 balls with one hand but I was able to manage it. below, is a code snippet of scanning the form for dragon jinx ability info. I repeated the same process to keep track of all other player data throughout the game run.

On the final screen transition, the winner is declared with an option of recalculating the win for simulation purposes or viewing the log and seeing how the win was calculated.

In the coming episodes, I will talk about how each win is calculated, their ranks, and the elimination logic I used to achieve it. Thanks for passing by :-)

Sort:

Man, after reading this post, all I have to say is that I don't know how y'all do this Dev stuff, but I envy the skill. Hehe.

Thanks for the good work mate. Neoxian city are lucky to have you. Also, thanks for sharing this post on DreemPort.

Thanks for the nice words bro... I'm doing better.

I just have a habit of figuring out how things work, most especially digitally, it takes a bit of practice but once you get the groove, you never lose it.

This post has been manually curated by @bhattg from Indiaunited community. Join us on our Discord Server.

Do you know that you can earn a passive income by delegating to @indiaunited. We share 100 % of the curation rewards with the delegators.

Here are some handy links for delegations: 100HP, 250HP, 500HP, 1000HP.