More tanks: Decoration
I kinda wish I had designed the furniture model the same way I did the tank model. I think I will start out refactoring the decoration items to work how the tanks do as far as inventory and placement. It will lighten the load on the DB server and the Apartment server. I am still not sure why I did it how I did. I think I had some "clever" idea but I lost the logs from that period of development when I bamboozled the server. There are still 3 databases unaccounted for, I went through every volume I have and they are just... gone. I have absolutely no idea how they could be gone, since the volumes should persist beyond the lifespan of the containers but for some reason those ones vanished.
Today's Music
Anyway, today starts with a rework of the decor model so that I don't need to run 4 queries and can run only one for most of the work needing doing. I also had a realization that I should probably modify the Geru model and add a JSON field to store modifiers from the environment, etc. This will allow me to handle the offline tick without having to pull data from apartments and tanks and furniture and decor and... yeah, less work for the DB and less work for the process.
Now this should be a lot easier than it was for furniture in the apartment. I really accrued a lot of technical debt designing my models while stressed out and not rested. At least I am fixing things now and not just letting it ride, I guess. Besides; I have been learning a lot and a project that doesn't challenge me or teach me anything is worthless in my eyes.
Welp, finished up with my guitar noodling. Gonna take my dog out, get some caffeine and get to work.
Also managed a shower in there which will hopefully help keep my arm from going screwy on me today.
So the things remaining on the list from yesterday are...
Hmm. Can't seem to paste it, screenshot it is.
Need to get the tank UI popping up and populated with the correct data for the tank.
While starting to design the UI for the inventory I had some interesting ideas for the way I could handle new item releases.
Ah, a sneaky sort of bug. Tanks load in the apartment sometimes but not other times. Time to find out why.
The client is receiving the data for the tanks so it's not that. Maybe somehow the order of the array is getting jumbled? I don't think it's able to do that but maybe it is, if so I need to do a little refactoring and data formatting.
Got apartment tanks: [[Tank_1, Tank with no name, BasicTank, 70, 50, False, 100, 100, 25, 0a9083a6-c943-4928-b923-208d86a8b48b, Null, True, -79, -91, False]]
Looks to be in order to me. Let's see what it looks like on a boot where it doesn't load in.
Of course I can't reproduce it now. Cheeky bastard bug is hiding.
Okay, for now I will just continue working. It will show up again and I will find out why when it does.
I might make it a pop-up with exclusivity now that I am looking at it. Just makes more sense than building my own window when there's such a thing already in the engine.
I wish I could use pointers in this situation... would make things a little clearer to read in future when working with the tank array.
The bug happened again, I know my signal is being emitted and my tanks are being received on the client but the apartment is not placing them because for some reason it does not seem to have gotten the signal... I know it's loaded and I know it's got the data and is connected to the signal but somehow it's not firing the code. I think I may need to detour a bit and write my loading system now.
All I can think is there's too much data coming in at once for the apartment to handle and it's ignoring stuff it can't handle at that moment. I could have a sequential load where after the apartment data is received and loaded we ask the server for the furniture, then the placement, then the tanks, then the decor. That might solve the problem, them we can play the fade in and show the apartment like a loading screen sort of deal. I should probably put a little animation in the loading screen so if there's a long load it doesn't feel like the game locked up.
So, we start out with a loading screen overlay on the apartment scene.
- Character is Received
- Request Apartment + Furniture
- Apartment and Furniture are Received
- Request Apartment Inventory
- Apartment Inventory is Received
- Request Tanks
- Tanks are Received
- Request Decor
- Decor is Received
- Fade loading screen
Then I can get back to populating tank data in the Tank UI (assuming this fixes my tank loading issue).
Alright, back to tank data...
Turning it into a popup like this has some... interesting issues.
E 0:00:11.601 get_viewport_rect: Condition "!is_inside_tree()" is true. Returned: Rect2()
<C++ Source> scene/2d/canvas_item.cpp:944 @ get_viewport_rect()
<Stack Trace> TankContainer.gd:10 @ setup_tank()
Tank.gd:18 @ interact()
TankBase.gd:142 @ _input()
Because I was trying to do setup on the popup before it was even in the scene, apparently. Good to know.
Okay now we have the tank data, there's some UI from early prototyping that I will see if I can't display and populate with the correct data.
I see we have a small bug on the temperature and humidity display. It's not updating when the tank UI opens. Simple enough to fix.
Of course the buttons only affect the client right now, I have to wire that up to the server so you can turn off the lights or increase humidity, etc and have it persist server-side.
Knowing me this will turn into an immersive sim style pet-sim. Well, time will tell.
For now I have my tank data populating the client as intended. I need to add some code on the server to handle some of these buttons. I also need to get my tank inventory to display and populate, then I need to be able to place decor. Much to do.
I should maybe start with decor inventory, eh?
Now that I have a UI I need to get the data from the server to the client and populate the UI with it.
Alright, I've done some simple formatting and sent the data over to the client, now to unpack and create inventory item buttons...
Alright, so that's about where I am going to stop, it's 4 now and my arm is starting to get a little painful. It's not as bad as yesterday so improvement is day over day, that's good. I have some stuff to put on my whiteboard anyway.
Tomorrow I will start with Decor placement which means designing the Basic Hide decor item and writing all the client and server functions to handle placing and removing the decor items.
Progress is pretty good, I think.
Gonna do some whiteboarding and clock out.