The MMO Project Part 7: The internet is a series of tubes.

The MMO Project Part 7: The internet is a series of tubes.

I was going to work on Tamakai today but realized I had not finished enough design on it to really get started coding it. I need to do a bit of research and talk to Mew about what I might need to consider before I just go and start modeling the DB as I would really rather not like to have to redesign the DB 40 times like I did with Mantilogs. Still have a web project today though, the MMO's web interface.

Well, you need a place to register accounts of course. Also need a DB for those accounts and for characters. Actually there is going to be a DB responsible for most things serverside, from monsters to items to map information. This way I can have a nice interface in the background to quickly change anything I might need to plus I could rebalance an entire item database with a couple lines of SQL. Putting in the extra work now will pay me back in the future. Plus I needed to take a break from the MMO code for a day, clear my head of it so I can approach new problems with a fresh mind. I find it is very important to maintain more than one project at a time because if you have trouble with one you can work on another one for a bit and usually, at least for me, I find that when I get back to it I almost instantly come up with answers that had previously eluded me.

So, I am to set about some Django work and also get started on the ORM for my servers to connect to the DB. So far I have made the DB and secured it to some degree. Edited the HBA configuration to allow my dev machines to connect to it and created a user for it. Now to spin up and configure the Django app, extend the user model and create a character app. There are a lot of apps and models that will be added in the future but for now I want to keep it simple so I can also test the ORM against this DB while I write it.

The libpqxx documentation makes me just want to write post requests to an endpoint on the django app. This would be a pain in the ass to secure and also be slow, so I am trying to avoid it. I am also considering writing several small applications that do specific tasks in C++. Like one for creating a character, one for updating a character, one for looking up a character. Then using the OS.execute function in Godot to fire them and pass the args in via terminal command, then capturing the output as CSV, then converting that to an object.

I could create a GDNative plugin for each function I guess, I really have to look into how they work. I also need to generate UUIDs for the characters which isn't a function in Godot or C++ STL so I have to go find me another lib to include into this. I can currently create read update and delete from my test db, now I guess I will just roll some software for each of these operations. While I could handle character creation on the web end of things I am pretty sure users would rather do that in game. I'd still have to write the SELECT and UPDATE stuff either way, so what's 2 more?

Holy shit I hate C++ sometimes. All I wanted to do was generate a UUID. How hard does it need to be? I'm not even at the point of trying to make this code into a GDNative node or anything, I am thwarted after managing to CRUD on the DB and then trying to generate UUIDs which I intend to use for identifying characters with select statements. Of course it just so happens that every method I try for UUID generation has some problems. What the hell? I don't want to use boost dammit.

It's 2:30pm and all I have is a model and the model hooked up to Django Admin. This is a shameful display, I must say. I tried QT's QUuid but no matter what I did there (Even using qmake and including core like it said to in the docs of course) It was coming back as not found and I got the whole damn thing installed and... bah. I tried using some C libs that are on my system and that ended with the compiler yelling at me that it didn't know what the functions were despite them being included. I tried some github code that relied on GSL and I have that installed but again "What's this GSL you're including?" says the compiler.

Ever feel just... completely exhausted and unable to even comprehend any words you try to read? I think I may have hit a wall on this UUID generation problem. I ended up using boost and smashing my head against it a bunch until it worked. Now I can generate UUIDs... woo... That took a lot out of me. Also feel dirty using boost.

Holy shit, I think we done it. That was... frustrating. But it works now.

The test is successful.
      C.prepare("insert_char","INSERT INTO char_test (ID,name,level,exp,health) VALUES ($1, $2, $3, $4, $5 );");

      string name{"Cake"};
      int level{1};
      int exp{1};
      int health{10};

      work W(C);
      W.exec_prepared("insert_char", id_gen(), name, level, exp, health);
      cout << "Inserted Character." << endl;
Get in there.

With a function to generate the ids (id_gen())

string id_gen(){
   boost::uuids::uuid id;
   return boost::uuids::to_string(id);
It works, at least.

I did try to return just the uuid call but it wasn't having it. I am not sure how the uuid function works behind the scenes at this point and I will just chalk it up to some black magic in my code. All that matters for now is that it works. Geeeeezus that was rough.

Alright, now let's try to insert a character into the real character db ._. HOLD ON TO YOUR BUTTS!

Success. Characters can be created in the actual character database.



With that I have the foundation of the thing I need to add into godot to create, lookup and save character data without having to fire it over in json and hope for the best. This should run way faster too. There is still much to do with this bastard thing... but the hard part should be over. (He says, still having no experience with GDNative.)

I think I need a short break then I need to figure out character updates and selects. SELECT * FROM characters_character WHERE account_id == acct and whatnot. Integrating this stuff into the servers will be... interesting. I am not sure how I will be extracting the character data into this to save it either, like could I just add this to a node and use it to extract the data from the script on the node? Or will I have to pass it the data and then format it from within? Well, break time for now.

Well, I will need to start with a GDNative project and import this stuff to run in it tomorrow. It's 5 and it is taking way too long to build the godot-cpp project. Plus the description of how to setup the folder structure was confusing for it, though I am having a rough day with the thinking so it could just be that, but I got the headers in the wrong spot I guess.

New landlord showed up, had to sign the lease. After several years as a hermit I get all screwed up when I have to interact with other people. Anyway, that's a problem for me to work on I guess, preferably after the pandemic. For now I will just work on my projects and see if anyone needs me for some work. I could use some money. Well, I am going to go and make dinner, I feel thrashed.