No tank puns.

No tank puns.

Probably going to be another half day, fell on my hand weird on Friday and had a dull ache in my forearm since. Gets worse if I spend too much time typing I found out, so naturally programming will be a bit hampered until it heals. If it starts to get worse I may have to just take time off until it gets better, don't need to risk ending my career because I ignored another injury.

Music today:

And so on.

Anyway, if I recall I was going to get started on the server side tank code, loading tanks and generating them, then I guess on to updating them in the following days, etc.

The rate things are going I may not be able to get something out the door by the end of the year like I hoped but I'll just keep going at whatever pace my body allows and it'll be ready to test within a couple months I think. Who knows, though? The last game I tried to release my laptop blew up on me and I nearly pixeled my wrist into oblivion (I still haven't replaced it, I am using a very old one right now that I am very grateful is holding on for me). I tend to get into a zone when I work where all things outside of the task at hand become non-existent and this can be bad for any injuries I have.

I will do my best to be mindful of my arm and wrist while trying to get things done with this project. I really want to get into the meat of designing the adventure part of the game where we can all go out with our pets and party up and dungeon crawl. Not to say I don't enjoy working on all this other stuff, I just really look forward to the part where it will all come together.

Welp, gonna play some guitar, drink some tea and maybe take a shower to loosen up my muscles in my arm. Today will tell me if I need to take more time off... I hope not, though. I am already getting depressed from not working over the break. If I have to take time off I will have to find a way to have some level of productivity with this game to stave off the mind goblins.


If I had ads on my sites I might not be so broke. That's a lot for a week, at least for some bozo who makes no effort to get things out there.

Anyway... I'll get some more caffeine and get the tanks generating and loading or at least get the framework for it done, first I need to add some functions to the DBMan to generate and retrieve the tanks, which means looking up tanks based on the apartment ID or creating them and assigning the correct apartment ID.

Don't seem to be waking up at all. This should be interesting. I guess I should start with loading a tank in, maybe that's all I should do today. Take it easy and slow until the pain is gone... that way I can make progress while (hopefully) not causing myself further, potentially more permanent injuries. Also wont be able to make as big of a mess with tired brain.

Right, gonna create a tank for Testiclese Jr here and get it loaded into the server. I suppose I will create sub-nodes for the apartment that hold tanks, to keep the code a little cleaner, starting out in the DBMan, I will need a retrieve_apartment_tanks(apt_id) function or something similar.

Had to remind myself of the table name.

Good ol' Tanktank.

A tank is created so I have something to load.
It's simple. Simple is good.
func get_tanks():
	# Retrieve any tanks.
	var tanks = DB.get_apartment_tanks(apt_id)
	if tanks.size() > 0:
		#get_tanks() # Uncomment me after generate_tank() is functional.

func setup_tanks(tanks):
	# If tanks can be placed put them in the inventory, if they are placed put them in the apt.
	for tank in tanks:
		var tank_node = load("res://Apartment/PlayerTank.tscn").instance()
		tank_node.setup_tank(tank) = tank[0] # Should be tank ID.

Let's see where my tired brain screwed up, shall we?

A tank is added.

Looks like the tank data is retrieving properly, there's the ID as the node name. I did have a few issues, well, one issue. I returned only one tank rather than an array of tanks (extra [0], force of habit). Fixed that and it all seems to be working fine now.

I'll finish writing the setup function in the tank node so we can extract the data from the row.

Loaded to the server, values seem in order.

Let's check this against the DB Admin...

Lines up.

Well, there's tanks loading on the server.

It's about time for me to make something for lunch now, guess I will find out if my arm is alright to keep going and if it is I will get the generator function done today and then probably just clock out. Maybe I will be fine tomorrow, maybe it'll take a few days but I really don't want to do something stupid and make it take months.

Once we have the generator function I will have to start on the client side, displaying the tanks, how their scenes work and how they load into UI and all kinds of stuff. There's a good chunk of complexity there, gonna need DB functions for tank decor, gonna need actual tank decor. Basically this is the apartments all over again but with some extra work client-side. Should go quicker, hypothetically but I guess we'll see.

Before I can generate a tank I need to figure out what the basic tank will have in it. I guess I could just start the player out with a hide. Food and water will be given interactively (ideally) so... wouldn't really need much else to start out.

So I will need a Basic Hide decor item.

Like this.

Now I just need to add one to the Testitank and make sure it loads all of it's bits correctly. All the tank decor will have to be added as a child of the Tank on the server since some of the items will have scripts associated that will need to be accounted for on the server, they could increase slime happiness or something and I can't trust the client to handle that, now can I?

Lunch is ready, guess I'll see how I feel afterward and maybe get to work on the generator.

I wonder if GDScript is interpreted or JIT. I should probably know this for optimization.


Good to know, I might take some of the heavy functions and write them in Rust to call from Gdscript via what do they call it now? Oh it's still GDNative, going to become GDExtention I think?

Anyway I will probably use this:

When it comes time to handle applying the Tick across all of the Geru, but I will write the first implementation in GDScript since it's likely to change a lot early on. I also will need to reacclimate to Rust, been a while since I learned it and I have not used it since. Ownership is handled in a hard way to wrap my head around having come from C and C++.

The things I think about when I eat lunch... Anyway I will probably write the generator function today and call it a day, while the pain isn't too bad I did notice my grip was a bit weird when I tried to grasp the saucepan.

Right so the generator needs to create a basic tank and a basic hide, then place it within.

Here's hoping I didn't screw up my INSERT query.

I did catch the missing ; mind you.

So much to go wrong at once, how exciting. (I know, Instert.)

One bug I found off the bat was I needed to not be passing null to a UUID field, so I passed 00000000-0000-0000-0000-000000000000 instead.

Now it SEEMS to have worked, I am not in a failed transaction block...

But there is no tank in the DB. Time to interrogate the code and DB logs.

Gonna have to INSTERT my foot in my mouth.

Wow, a new error.

Foreign Keys strike again.

So what does Postgres say?

I see.

So our tank is not generated yet because we're adding a resident which is essentially a blank UUID but I am guessing because the ID does not exist over in the geru_geru db we get the error. So, in theory if I create a BLANK geru with the blanked ID it could fix it? Let's find out.

I'll have to write myself a query that I will likely need again so I will keep it here once I get it ironed out.

INSERT into geru_geru 
(id, name, level, experience, strength, agility, constitution, intellect, wisdom, charisma, current_health, max_health, current_sp, max_sp,
current_weapon_skillpoints, max_weapon_skillpoints, short_blade, short_blade_xp, long_blade, long_blade_xp, axe, axe_xp, projectile, projectile_xp,
thrown, thrown_xp, spear, spear_xp, face_sprite, hand_sprite, color, color2, color3, color4, color5, body_sprite, head_slot_id, main_hand_slot_id, off_hand_slot_id)
('00000000-0000-0000-0000-000000000000', 'Blank', 1, 1, 1, 1, 1, 1, 1 ,1 ,1 ,1 ,1 ,1, 1, 1, 1, 1, 1 ,1 ,1 ,1 ,1 ,1,
1, 1, 1,1, 'none', 'none', 'none','none','none','none','none','none',null,null,null);

Now there's a blank slime, funny though, I used null here without any problem. Maybe I want to remove the ''s around the null values in the query on the server. Perhaps it is passing the null as a string. I know I have done it before so I am confused as to why it told me to fuck off there.

Aye, it was indeed the ''s. When passing null I should not be wrapping it in ''s, not sure why I did, guess I got used to writing it that way. '%s'

A tank has been made.
E 0:00:11.183   call: [PostgreSQLClient:1261] insert or update on table "tank_decor_inventory_item" violates foreign key constraint "tank_decor_inventory_house_id_ca09daef_fk_apartment"
  <C++ Source>  modules/gdscript/gdscript_functions.cpp:775 @ call()
  <Stack Trace> @ reponce_parser()
       @ execute()
       @ add_tank_decor_item()
       @ generate_tank()
       @ get_tanks()
       @ load_apartment()
       @ setup_apartment()
       @ load_character_data()
       @ load_data()
       @ add_player()
       @ get_client_token()
       @ _process()

Still have a foreign key issue here, though. Perhaps the queries are not running in order? Maybe I should wait for a return from the query? I was unaware they were async. Are they? Maybe. I don't think so. So the error is likely me screwing up my query.

Query was fine, I guess it is somewhat async so I just waited for a return from postgres, THEN executed the next 2 statements. Now we're looking good I think? Let's double check and make sure everything was added...

Tank is here.
Data looks good.

Alas, no errors but the statements did not fire.

Ruh roh.

Peregrinatio has no decor inventory, but does have a tank. Why?

Ah, yes, this will take a bit more cleverness, I suppose.

Oh but it is, just probably not before this query runs.

So I need to delay creation of the inventory item and placement somehow until after I know the query is executed.

Oh, hello arm pain. Looks like I don't have much longer. It's about 2pm now, went more than a half day at least.

I will need a way to delay the decor item generation until I know for a fact we have a tank in the DB. Hmm...

Well, I guess that's a problem for tomorrow (hopefully, assuming this hasn't made things worse...) time to rest, my dog needs a walk anyway.