Finishing up the Apartment Server for now

Finishing up the Apartment Server for now

Today I need to do a few things and then I am out of the office early if it all goes well. Monday I have to start planning and building the Slime Server, rather start that fresh and rested so I don't make so many stenanks in the foundation.

Gonna get some noodlin' done and get some caffeine in me and get started on getting it done.

Today's Music

So I need to make sure I unload decor on the server otherwise A the scripts will still run and B there will be memory in use that should be freed. The way I get back my data from queries is in ordered arrays. This is fine but I need to add the inventory_item_id to the array and I can either do that in the middle or the beginning of the array, then I need to pop it out and set the name of the node server-side to that ID, since it is unique and will allow me to easily remove the thing. Actually, do I need to pop it? If the client has this ID could it be used for evil? Hmm...

I could also assign an ID sequentially and send that over in the array. Would be cheaper than having to pop_front() a value and have 7 ops to reorder the array. I will just use a counter and assign IDs that way... I can't always trust the client to send the right ID though, someone could inject a new ID into the packet unloading a different item's script and then all kinds of exploits could open up, potentially allowing multiple scripts of the same type to run where they should not and many other bugs.

Generating a UUID for each item would be more expensive on the server and also have the same problem. Hmm...

I guess the best way to handle it would be when we remove a furniture item to just reload all of them? It's a lot of work for the server but it would prevent the people who think like I do from bamboozling the decor and furniture.

Yeah, after a long, hard think my tired brain has come up with nothing better. It's a little heavy on the server but that's why the apartment server IS a server and not just part of a general World Server. Like some MMOs will have a server(or several) for each zone, or at the very least seperate processes. Some things just can't be both optimized and secure. I'm sure I will come up with a better way down the line but for now I will just reload the decor. I wont be doing this with the furniture as yet, since the furniture wont have actual scripts attached for a while yet, it's just some variables as far as the server cares right now.

Well, the way I am handling it should work for now. I also added a hook to reload the decor server-side when new decor is placed to make sure any scripts that need loading or may need to recalculate based on the new item can do so. This may bite me in the ass eventually.

Added a close button to the inventory.

The tank decor now loads and unloads, the server-side nodes have a place where they can cleanup before unloading and now I am on to making the temp, humidity and light buttons work server-side.

Pretty straightforward, send a request to the server to increase temp for example, server hands it to the tank, tank processes it, updates the DB and sends the new temp back to the client. The client gets the temp and signals to the UI that it has changed.

Alright, actually managed to do all that by lunch. A true half day today.

Humidity, Temp and Light all server controlled now.
Database agrees with what the client shows.

Looks like I can make some lunch, get a shower and relax for a little extra time before Monday, when I start the mighty Slime Server. The most complex server so far.

Delicious progress.