Starfleet Command II: Empires At War
Dynaverse II SQL README - 2.0.3.4
Compatible with 2.0.3.4 clients only
2002-09-20

Prerequisites
-------------

Download and install the following from www.mysql.com:

MyODBC-3.51.03
MySQL-3.23.52
MyCC-0.8.4


Upgrading
---------

The database schema has changed, therefore all existing databases
must be erased and re-created.  This was necessary to fix a binary
encoding problem, and missing PoliticalTension information.


Installation
------------

* Install MySQL as a service by going to the C:\mysql\bin directory
  from a command prompt and issue "mysqld --install".  Then start
  the server from the command line: "mysqld --console".  Once the
  server starts up, hit CTRL-C to exit it.  Then type in "net start mysql"
  to start it as a service.

* Run MyCC and...
  - register your server (localhost) as a MySQL server:
    - File:Register Server...
      - hostname: localhost
  - double-click on "@localhost:3306"
  - double-click on "Databases"
  - right-click on "Databases" and select "New Database"
  - Enter "dynaverse" and click ok.
  - Double-click on "dynaverse" so the icon turns green.
  - Right-click on "dynaverse" and select "query..."
  - File:Open Dyna2EAW2034.sql
  - Click the (!) button to run the reset/setup script.

* Create a System DSN using the "Data Sources (ODBC)" control panel.
  On Windows XP this is located under Administrative Tools.
  Name the DSN "DYNAVERSE-MYSQL" and use the MyODBC-3.51.03 Driver:

  - DSN Name: DYNAVERSE-MYSQL
  - MySQL host: localhost
  - MySQL database name: dynaverse
  - Advanced options: leave at default settings

* Edit your Assets/ServerProfiles/Database.gf file to match:

[SQL]
UseSQL = 1			// (0) 0 = use flat file, 1 = use SQL
DSN = "DYNAVERSE-MYSQL;"	// DSN of database
DumpLog = 0			// 0 = none, 1 = separate files, 2 = one file, 4 = both ways

* Run your ServerPlatform!


Help
----

Use the mailing list to report issues so that both KhoroMag and
Taldren can see them.


Notes for Battle Logging
------------------------

BattleParticipant.VictoryLevel values (ordinal in Score.gf):

0 = AstoundingVictory
1 = Victory
2 = Draw
3 = Defeat
4 = DevastatingDefeat

* Battle.BeginTime is not currently initialized (because it's unknown).
* BattleParticipantShips.GetDamagePercentAtEnd values are not fully
  understood at this time however they do seem to reflect relative
  damage amounts.

I never hooked up the "BattlesRunning" table to the code.  This table
would have..

* Allowed me to fill in the Battle.BeginTime properly.
* Allowed web server operators to show real-time battles in progress
  on their Dyna2 Server.

Perhaps one day I can hook it up.


Banning Users
-------------

A new table called LoginBan has been created.  The database is queried
to see if there are any matches in any columns in any rows for the
WONname (email address), CharacterName, or IP Address.  Right now no
wildcards are supported, sorry.  The fields are not bound together,
for example you cannot ban people with a certain name from a certain
IP address; if they match any of the three fields anywhere in the table
then they are banned.

When a user is banned they are sent an "Incorrect Password" login message
indicating they do not have access to the server.  A better message might
show up in the next edition of the client (remind me to do this).

Late note: Internally the Dyna doesn't pony up the "CharacterName" value
(typed into the login page) for inspection.  Therefore, you cannot ban
people based on their character name.  You can ban based on the WONName
(which is the email address) and the IPAddress.  If you happen to insert
the value '' (empty string) into any of the CharacterName records, you'll
end up banning everybody.  Be careful to only insert what you need, and
leave the other fields blank.  If you ban someone who tries to create a
new character and then unban them, it will cause their client to crash and
could cause server instability.  I recommend never unbanning someone
right now.

- MagnumMan
