Game
Project 1935
7 years ago

Project 1935 Devlog #4


Project 1935 Devlog #4

The two weeks leading up until this devlog have been tough, struggling with a lack of motivation, not for the project, but motivation in general led to me very rarely getting things done most days, add onto that various problems with networking that I still need to solve. All of that results in this being a relatively short devlog, but it’s okay to realise that sometimes you lose motivation, and to focus on what has actually been achieved, as opposed to what has not.

Building System

So the bulk of the time I actually got work done, it was on the building system. My aim for the game is to have each province house any number of buildings, each building doing something different, whether that be to just increase the province’s resource output, increase province happiness or to actually carry out an action and have its own UI screen such as a Barracks which would facilitate the production of units.

I could spend a long time coming up with ideas for buildings as the possibilities really are endless, but for now I settled on the Barracks, Refinery and Fortress.

I decided to have a Building object in C# that would hold the data associated with each building such as its name, UI object, modifiers and the building’s cost. I then have, on each Province, two lists of buildings, one for inactive buildings and one for active buildings. Now when a building is added to either list, it will carry all of its data with it, including the UI associated with it via the unity inspector.

5d0afdb54a07b.png
5d0afdb62ab1f.png
5d0afdb68f253.png

Now I had the Building objects and had associated them with their UI, all I had to do was to check if the building was the the inactive or active list and then position them in the UI to show as such.

If the building is active, it will be parented to the active panel in the UI.

5d0afdb6ee176.png

and if the building is inactive, it will be parented to the inactive panel in the UI.

5d0afdb756dd7.png

After that, it was just a matter of changing the building’s Y position depending upon which index they are within their respective lists.

5d0afdb7b1053.png
5d0afdb86880c.png

All buildings start within the inactive panel, the above code resulting in the above screenshot initially. The code is called when a province UI is opened, so as to make sure the UI is positioned correctly depending upon which province is open.

Next up was the actual effects the buildings would have on a province, I knew that, using the above system, the only thing that would change between buildings and provinces would be the UI objects and so I could make the buildings have any effect they want without altering other provinces those building objects also reside on.

Starting with the refinery, its job is to boost the provinces modifiers (how many resources they gain per tick/turn/timespan etc). As seen at the start, the building objects have a cost, and a modifiers array with the values in the order of what the values of the provinces are.

5d0afdba9024e.png

Using this, I could check if the province can afford the building by making sure the province values are more than or equal to the cost values, and if so, minus those values from the province values and activate the building by returning true to the province which would remove it from the inactive list and add it to the active list.

5d0afdbb2c9ec.png

I now knew the building could be afforded, all I had to do was add this buildings modifiers onto the provinces modifiers.

5d0afdbbe89b0.png

The act shown above is the same for all of the buildings, only differing by what actually occurs when the building is purchased.

Right now, I have a hacky solution, being that the check for the type of building using a BuildingType enum is carried out on the Building object, I will probably move this out in the future, but for now it works.

Finally, I needed a way to activate the buildings other than by manually calling it within the code, this obviously meant I needed buttons.

5d0afdbccd414.png

All I needed to do was to run the routine demonstrated above, but when the button was pressed. Initially I just passed in the buildings index within the inactive list to the button’s onClick() function, and hoped for the best. This would work if you activated the very last building in the list, or on the very first try, because once you activate a building, it is removed from the list thus changing the index of all of the other buildings, and the index I pass into the onClick() function was a static number. I tried various solutions until deciding on setting the BuildingType enum of the building via the inspector and then checking which building in the inactive list has that enum, and then activating that building.

5d0afdbd4d0cc.png

Results in

5d0afdbde7402.gif

It also works between provinces

5d0afdbed5de7.gif

Obviously right now, the UI is temporary, but the idea is simple, and it works. Also, the values are arbitrary at the moment, but once the buildings have been given their proper values and costs, it will work as intended as tests have shown.

I hope that when I do have lots more buildings, I can use some sort of scrolling UI, or pagination, but that is for another day.

I did also fix a bunch of bugs and issues, but they are meaningless in a devlog so i’ll leave them out. Thanks for reading this Devlog. Hopefully by the next one I will have regained motivation, and will have a lot more to show.



0 comments

Loading...

Next up

Just as Pecaminosa's musicians #improvise this rendition of #LittleSunflower 🌻, so do we improvise with this post you're reading. 😂

What's coming out of your own improvs? 🤔

#Pecaminosa | #IndieDev | #OST | #Jazz

Back in my art school days I used to ride the 710 COPSA line from Parque Del Plata to Montevideo almost everyday. This is the Marcopolo Viaggio G4 Mercedes Benz model from the late 80s, one of the older bus models that was running on the line.

An infected room from the second part of Cybel ! Are you up for some cleansing?

Made my first ever animation.

2d lighting experiment

Double Rainbow!!!

I made a small jungle house.

Hi all, Quick update with a bunch of fixes and changes.

Updated save system, optimisation and screen tear fixes, a new shoutout room and more sounds.

Don't forget to follow the kickstarter going live on the 20th! https://www.kickstarter.com/projects/9fingergames/zapling-bygone

Enjoy!

Hello my space friends! Now I added a space background to the ship. I love that space look but I still feel like stuff is missing. The lighting on the ship needs some improvements I think. Please tell me your opinion!

Magic staffs created especially for each sign

#moba #zodiac #magic #staff #signs #gamedev #3Dart