WARNING: DO NOT vi(m) THIS FILE. Being maintained on a winbox for now. Tech notes: mobtrix (c)2001 ?Sevenheavens? Contents: -Global (database, php, c) Definitions -Database Structure -C file information (AI) -php (mob) information -general tech history ********** Global (database, php, c) Definitions ************ defined for C... probably const global in php (no enums) all start AI_ for clarity ----------entities---------- AI_ENTITY_???? 0 -who knows but it shouldn't be AI_ENTITY_CITY 1 AI_ENTITY_RACK 2 -racketeer AI_ENTITY_HITMAN 3 AI_ENTITY_BOOTLEG 4 AI_ENTITY_MOB 5 -the right name for an army AI_ENTITY_CLEANER 6 -the badass AI_ENTITY_AUTO 7 -an automation command from the user ----------actions---------- AI_ACTION_DEAD 0 -set by hitmen AI_ACTION_FIRED 1 -set by user (return to civs) AI_ACTION_TRAVEL 2 -set by user AI_ACTION_KILL 3 -set by AI when hitmen arrive AI_ACTION_ATTACKED 4 -for cities and armies AI_ACTION_ATTACKING 5 - " AI_ACTION_LOLY 6 -short for lollygagging, abandoned AI_ACTION_NORMAL 9 -maintained by AI DATABASE STRUCTURE ********************** The main use of so many VARCHARS (rfc to mysql: VCHAR) - less storage/mem TIMESTAMPS not used because the autoupdate affects whole columns TABLE1 - Named: players FIELDNAME TYPE NOTES name VARCHAR(25) 25 is pretty long for a username pw VARCHAR(15) 15 " " password email VARCHAR(40) (jefferson.airplane@dialup9.earthlink.net) hate to exclude anybody cash INT 2Billion+ upper limit score INT UNSIGNED 4+ billion upper limit (??) joined DATETIME updated DATETIME last player activity registered BIT char(1)... boolean 0=NO 1=YES (implement?) verified BIT boolean 0=NO 1=YES (w/SBS re: needed?) protected BIT protection only set 1 if player AI don't need protection INT current/updatable percentage protectstart DATETIME when started pw_question INT 10-30-01: prefab questions, numbered 10-24-01: Question to retrieve password (filled out when registering by user) pw_answer VARCHAR(25) Answer TABLE2 - Named: entities FIELDNAME TYPE NOTES 0 name VARCHAR(25) Cities have user names - others probably php generated with TYPE#### 1 type SMALLINT math faster than strings-check defs above and use/update the .C file accordingly 2 created DATETIME birth time 3 cash INT 2Billion+ upper limit (in cities population) (in mobsters count) 4 owner VARCHAR(25) Every city,mobster has a player owner 5 city VARCHAR(25) Name of city of residence (self if city) 6 target VARCHAR(25) Name of target or destination (none if none) 7 action SMALLINT math faster than strings-check defs above and use/update the .C file accordingly 8 x SMALLINT current matrix X 9 y SMALLINT current matrix Y 10 return DATETIME automation - order to go home @ 11 lastupdate DATETIME AI/user last update TABLE3 - Named: messages id (10.24.2001 - this is going to have to be fixed... too much bounds checking and overhead with autoincremented stuff) mysql>ALTER TABLE messages ADD id INT UNSIGNED ->NOT NULL AUTO_INCREMENT FIRST, ->ADD PRIMARY KEY (id); 10.24) created DATETIME sender VARCHAR(25) target VARCHAR(25) note VARCHAR(200) TABLE4 - Named: gamestate closed BIT access closed by AI - because this is a bit field, it is easy as pie to add a single row in the C file and then delete all data from the table when it exits TABLE5-?? - Named: forums-alliance/gangrelation/etc ID INT(5) NOT NULL AUTO_INCREMENT NAME VARCHAR(50) NOT NULL EMAIL VARCHAR(50) NOT NULL TOPIC VARCHAR(50) NOT NULL MESSAGE TEXT NOT NULL MY_PARENT INT(5) NOT NULL DEFAULT 0 TIMESTAMP VARCHAR(10) NOT NULL PRIMARY KEY(ID) KEY(MY_PARENT) FULLTEXT(MESSAGE) TABLE - Named: admin id INT UNSIGNED NOT NULL AUTO_INCREMENT listed DATETIME the whole date shit in sql dont work listedby VARCHAR(25) fixed DATETIME fixedby VARCHAR(25) msg VARCHAR(255) C FILE INFORMATION (AI) ********************** Debian linux compile command line - must be exact and the .h & .a files from the mysql dist must be present in the specified directory. gcc -idirafter ./clientsql -o ../mobticks mobticks.c -lmysqlclient -L./clientsql -lz ((10.25 subsub-first: rip the tables to some kind of backup )) Sub-FIRST: AI Locks (set the boolean 'closed') 10.23.2001 added new table. The AI will check first for expired players. Next AI needs to kill old messages. 3rd AI needs to go through the entities and do: (fix the order for playable) -wars -hitmen (kill before pay) -move in motion things - Sub-LAST: Release the table (closed=0) PHP(MOB) INFORMATION ********************** 10.24.2001: Need a way to make the UI cleaner-exit and die() in php are just ugly. 10.23.2001: The next dilema: (admin in the way of AI again). The message list has become a nightmare: How to delete a message? The easy answers don't work. AUTOINCREMENT in mysql is a sorry lacking thing. Here's the problem - if autoincrement counts to 100 and then user deletes row 50 autoincrement scans all the rows to fill in the blanks. This is not a problem when you have 2 users per year accessing all 4 rows! If you expect 100 users avg 10+ messages per hour (1000 min rows/hour) and say 40% deleted in an hour (400/hour) your daily math for autoincrement becomes: 1000x24(24000) - 400x24(9600) = 14400 msgs left over.... and most important... mysql trying to plug @10000 holes per day. Too much load on a db/server... Solution: the AI(.c) and PHP is going to have to generate msg ids for click and forget deleting. 10.22.2001: vital note... in my mind I cling to the gd american way of mapping coords (x is horizontal [left to right] and y is vert) php images are x-vertical so the code is going to be messy GENERAL TECH HISTORY ********************** 10.31.2001 Boo... c file renamed changed again backup/phase2.c added admin table above for bugs/todos 10.23.2001 Early start on cleaning up the .C file. Saved at this point as backup/phase1.c realized too much admin and extra stuff going on already. 10.23.2001 Moving files around so root game dir is cleaner... /AI dir (see the command line) 10.23.2001 Adding 'closed' (boolean) to lock databases. MySQL 'LOCK' command and hot backup etc aint worth a turd. 10.22.2001 Moved everything to new server - :( 10.20.2001 (19th still) Dean finally with Stephens help gets C to connect to the db. 10.19.2001 Stephen renames .php .mob 10.19.2001 Dean download and test win9x based mySQL w/C-fast easy. 10.18.2001 Dean looks at php and mysql for first time in history. 10.18.2001 Stephen shows off hyperiums (link) and says lets make a deal.