Apartment Server Character CRU

Apartment Server Character CRU

Now that I have the client and apartment server talking I can send some data between them. This will require me to create the DBMan so we can talk to the DB.

Today's Music

To start out I will get a terminal into the PostgreSQL server and make sure I can look at the data and have a reference for structure. While I already have the Django admin set up it does a little abstraction on the tables and I need to be seeing all the bits.

I am not sure if Foreign Key fields in Django create intermediary tables or if it's just a raw reference, have to know so I can write my queries correctly.

Seems we are okay.

I'm sure I will have to deal with intermediary tables once I get to the Tanks and Geru, that's why I left modelling them for after I got the character and apartment loading from the DB. I'll have a clearer picture for how the data is moving by then. Alright, time to write the DBMan.

Characters will need functions to

  • Create
  • Update
  • Read

Apartments as well. No deleting, at least not yet. If I need to delete something I can do it with a query or in the admin page.

Well, I have some interesting behavior from the DB connection, I am going to have to do further testing on that and in order to do that I should be able to track player data so I have to register it to the server. Doing this with nodes.

Player registered to server
Player Node

Checking for a non-existent character works as it should. This will be how we tell the client it needs to open the Create Character UI.

Now to test an account that I created character data for...

Character retrieved.
Oh boy, now I have to make sure to get all the data in order when I disassemble it.

Okay, lunch time. Then I gotta shower and finally I can save the character data into a more... friendly format. I don't want to be operating on Arrays all the time unless I have to.

Converted to a Dictionary.

Now the data is kept as a Dictionary, easier to operate on and send to the client.

Before I load data I should probably create it. So right now I am working on Character Creation. I seem to be having a strange issue with sending the signal to the client to create a character. I think there's some strange things going on with the connection ID.

Nope, I have that all in order, phew... that would have been a bastard. It's a problem on the client side. Seems to be the signal isn't connected correctly.

Ah, yep. Signal wasn't connecting up right. Things were being freed from memory before I thought they were. Solved this by writing a Scene Manager.

Now if a player does not have a character when they login they will be greeted with the Character Creation Screen which has some placeholder art.

Room - Day of the tentacle style
Just a room that i tried to draw in the style of the point and click adventure game Day of the Tentacle.
Hello, character creation.

Which currently does nothing, gotta wire it up and send the data over to the apartment server where it will create the character in the Database and assign it to the Player Account's Character via ID.

This is a little complex but not too bad. I just need to pass the data to the Player object, sanitize it and have it send the data and player ID over to DBman and format the long query that will destroy me if I screw it up. No big deal.

I'm not even going to pretend I expect this to work right the first time.

Now lets see where I screwed up.

IT'S ME FROM THE FUTURE! the formatting didn't work how I expected, %i is not correct, everything should be %s.

GDScript format strings
GDScript offers a feature called format strings, which allows reusing text templates to succinctly create different but similar strings. Format strings are just like normal strings, except they con...

Bombs away.

God speed, Testicle.
Welp, the character has appeared in the database. Everything looks right.

The character is created but not assigned to the account. Hmm, let's have a look at why that might be and while I am at it change the string formatting of the characters in the admin site.

Ah, I was in the wrong table, got too used to working in the character_character table. Nice job brain.

Testiclese, I choose you!
There we have it. Testiclese is hangin' out.
and he's assigned to the correct account

Alright, it's 4pm now. I managed to get character data loading on the server and character creation handled today. Wrote the DBMan for the Apartment Server as well, of course.

Gonna make that character string a little easier to read and then do some project management stuff for Monday where I will be loading the character data on the Client and seeing about Apartment data and how that loads.

Hello, Testiclese.

Welp, off with the programmer hat, on with the project manager hat. I'll be back Monday, at least I hope so.