View previous topic :: View next topic |
Author |
Message |
Primogenitor
Joined: 08 Jan 2005 Posts: 88
|
Posted: Thu Jan 13, 2005 19:10 Post subject: NWNX on a single player module |
|
|
I am mid-way through developing a single player & LAN module based on the gameplay of the old roguelike games such as Angband. An early version is up on the vault at http://nwvault.ign.com/Files/modules/data/1074366809343.shtml
However, I am going to have to force the module to be run using NWNX for a couple of reasons (DB access with SQL and Letoscript). This will mainly be achieved by booting players from the module if its not setup correctly (GetPlayerCDKey() == "", Letoscript cant get the players name, DB doesnt work). What would be the best way to distribute such a setup? Would it be possible (given licensing and general good practice) to combine it all into a single download (i.e. mod+haks+NWNX+MySQL+Letoscript.dll)? What about possibly using some sort of auto-install package to put (at least some) files in the right place? Or would it be better to just provide links and have players download and install everything themselves (which would put a lot of people off if I have links leading to dozens of different sites)?
Also, I am thinking of turning the module into almost a SP PW given that the module is likely to end up being split over several different .mod files. This is due to the size of the module because of the number of areas, see http://nwn.bioware.com/forums/viewtopic.html?topic=405068&forum=47 for details) Obviously, NWNX will help to no end in this situation, which is yet another reason for using it |
|
Back to top |
|
|
Papillon x-man
Joined: 28 Dec 2004 Posts: 1060 Location: Germany
|
Posted: Thu Jan 13, 2005 22:06 Post subject: |
|
|
I have mixed feelings on using NWNX with single player modules, or to be more specific, with modules that the end users needs to install instead of just connect to. Not because I do not like the idea - mind you. Just because that involves a lot of details that need to be taken care of.
With that said, here is what I would do:
1) Create a fool proof installer with e.g. the Nullsoft installer. It should install everything and ask almost no details
2) Try to find a database that is less complicated than MySQL. There are quite a few embedded database that need to external process, maybe there are some with an ODBC driver as well. Maybe even consider MSDE, since that is what Microsoft impositions on their users as well.
3) As long as the stuff your packaging is licensed under the GPL, you should have no problems, but be prepared to hand out the source code to everything on request. _________________ Papillon |
|
Back to top |
|
|
Manuel
Joined: 30 Dec 2004 Posts: 51
|
Posted: Thu Jan 13, 2005 22:18 Post subject: |
|
|
Go with SQLite. It is 100% freely distributable (even with commercial apps), is great with embedded type programs, has a very small footprint and requires no setup.
http://www.sqlite.org/ _________________ I only know enough to be dangerous. |
|
Back to top |
|
|
Primogenitor
Joined: 08 Jan 2005 Posts: 88
|
Posted: Thu Jan 13, 2005 23:57 Post subject: |
|
|
Thank you papillon, that installer should be exactly what I need.
Manuel, thank you for the link, it does look very good. However, I am a scripter, not a developer, so I have no idea how to use it. Have you got any advice? |
|
Back to top |
|
|
Papillon x-man
Joined: 28 Dec 2004 Posts: 1060 Location: Germany
|
Posted: Fri Jan 14, 2005 14:12 Post subject: |
|
|
SQLite ?
an idea comes to mind.... _________________ Papillon |
|
Back to top |
|
|
Primogenitor
Joined: 08 Jan 2005 Posts: 88
|
Posted: Fri Jan 14, 2005 14:35 Post subject: |
|
|
Your not thinking what I think your thinking, are you? |
|
Back to top |
|
|
Manuel
Joined: 30 Dec 2004 Posts: 51
|
Posted: Fri Jan 14, 2005 17:45 Post subject: |
|
|
Of course he is...
That would make NWNX setup virtually fool proof.
@Primo
Install SQLite the normal way then use the ODBC connection from NWNX to the database. You will need the SQLite ODBC driver which is here: http://www.ch-werner.de/sqliteodbc/
That is, until Jeroen or Pap release a direct driver. With it's C/C++ APIs, this should be pretty damned easy.
Some things to note about SQLite, blob support is ONLY in version 3 or above (RCO/SCO). In general, all data types are treated the same. The database does NOT enforce strict types on columns! _________________ I only know enough to be dangerous. |
|
Back to top |
|
|
JeroenB
Joined: 31 Dec 2004 Posts: 228 Location: Netherlands
|
Posted: Fri Jan 14, 2005 18:40 Post subject: |
|
|
Ow .. no
Pap.. your not going to do it! You are NOT going to do it!
Yesterday you complained we release to much |
|
Back to top |
|
|
Manuel
Joined: 30 Dec 2004 Posts: 51
|
Posted: Fri Jan 14, 2005 18:59 Post subject: |
|
|
JeroenB wrote: | Yesterday you complained we release to much |
Bwahahahahaaaa!
Yeah, SQLite has become extrememly popular if for no other reason than it's Public Domain. Tons of folks bundle it with their apps for DB backends without having to pay royalties are sign expensive license agreements. _________________ I only know enough to be dangerous. |
|
Back to top |
|
|
Liberty Valance
Joined: 06 Jan 2005 Posts: 21 Location: A Persistent World West2
|
Posted: Fri Jan 14, 2005 19:40 Post subject: |
|
|
as long as you don't force it upon us, i think offering an SQLite package option would be a good idea for more novice users out there
if y'all don't have the time, if you just show me how to set up SQLite (or maybe i could get motivated enough to look it up myself), i can write a NSIS installer - i've done the installer for the Generations Arena mod for Q3 since version 0.99b (we're now at 0.99e), and the team's been happy with it _________________ A Persistent World West2 | APWW2 Forums
Wirehead Studios |
|
Back to top |
|
|
Primogenitor
Joined: 08 Jan 2005 Posts: 88
|
Posted: Fri Jan 14, 2005 20:28 Post subject: |
|
|
Wow, that was so simple its shocking. Thank you! I have SQLite setup and running, though I am using the NWNX2 and plugins from the vault because nwnx_leto.dll doesnt work with the latest version yet.
As for setup (on a windows XP machine) it couldn't be easier. Heres how I did it:
1. Get the SQLite file, http://www.sqlite.org/sqlite-3_0_8.zip
2. Get the ODBC SQLitedriver, http://www.ch-werner.de/sqliteodbc/sqliteodbc.exe
3. Extract the sqlite3.exe file from the sqlite-3_0_8.zip and put in in your nwn root.
4. Run sqlite3.exe with the command sqlite3.exe database\nwn.db (either from a shortcut to it, from a batch file, or from the command prompt)
5. Enter the SQL command:
CREATE TABLE pwdata (player varchar(64) default NULL, tag varchar(64) default NULL, name varchar(64) default NULL, val text, expire int(11) default NULL, last timestamp(14) NOT NULL, KEY idx (player,tag,name));
and press enter (you cant use keyboard shortcuts to paste, but you can right click and paste) You may get an error (I did), ignore it. Im sure it means something, but it didnt stop it working for me.
6. Check you now have a file named nwn.db in your NWN database directory. Thats the database file to use.
7. Go to Control Panel -> Administrative Tools -> Data Sources (ODBC) -> System DSN tab (second from left) -> Add... (button right hand side at the top) -> Scroll down to the bottom and select "SQLite ODBC Driver" (see note at top of post about SQLite 3 driver) -> Finish -> enter NWN as the data source name -> press the browse button and select the nwn.db file you created earlier -> OK -> OK
8. Run NWNX2.exe and load the aps_demo module. Then follow the instructions on the signs to make sure its all connected up properly. |
|
Back to top |
|
|
Primogenitor
Joined: 08 Jan 2005 Posts: 88
|
Posted: Fri Jan 14, 2005 20:32 Post subject: |
|
|
I tried the SQLite 3 ODBC Driver, but that didnt seem to work with either version. The log for the old NWNX said:
Code: | o Connect successfull.
o Got request: DROP TABLE pwdata
! SQL Error: file is encrypted or is not a database (26)
o Got request: CREATE TABLE pwdata (player text(64),tag text(64),name text(64),val memo,expire text(4),last date)
! SQL Error: file is encrypted or is not a database (26)
o Got request: SELECT player FROM pwdata WHERE player='Primogenitor' AND tag='Anyndur Imytholin' AND name='demoName'
! SQL Error: file is encrypted or is not a database (26)
o Sent response (-1 bytes):
o Got request: INSERT INTO pwdata (player,tag,name,val,expire) VALUES('Primogenitor','Anyndur Imytholin','demoName','testValue',0)
! SQL Error: file is encrypted or is not a database (26)
o Got request: SELECT val FROM pwdata WHERE player='Primogenitor' AND tag='Anyndur Imytholin' AND name='demoName'
! SQL Error: file is encrypted or is not a database (26)
o Sent response (-1 bytes):
o Disconnecting from database. |
So Im not sure what thats about.
Interestingly, when using the SQL Lite ODBC driver and the latest NWNX version it didnt work either, this is what the log said then:
Code: |
o Logfile maximum size limit is: 524288 bytes
o Log level: Everything will be logged.
o Using ODBC connection.
o Hooking SCO....hooked at 5c4320
o Hooking RCO....hooked at 5c4200
o Connect successful.
o Got request: DROP TABLE pwdata
o Got request: CREATE TABLE pwdata (player varchar(64) NOT NULL default '~',tag varchar(64) NOT NULL default '~',name varchar(64) NOT NULL default '~',val text,expire int(11) default NULL,last timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,PRIMARY KEY (player,tag,name)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
! SQL Error: near "on": syntax error (1)
o Got request: SELECT player FROM pwdata WHERE player='Primogenitor' AND tag='Anyndur Imytholin' AND name='demoName'
! SQL Error: no such table: pwdata (1)
o Empty set
o Got request: INSERT INTO pwdata (player,tag,name,val,expire) VALUES('Primogenitor','Anyndur Imytholin','demoName','testValue',0)
! SQL Error: no such table: pwdata (1)
o Got request: SELECT val FROM pwdata WHERE player='Primogenitor' AND tag='Anyndur Imytholin' AND name='demoName'
! SQL Error: no such table: pwdata (1)
o Empty set
|
And the other combination (SQLite 3 ODBC + latest NWNX) didnt work either
Code: |
o Logfile maximum size limit is: 524288 bytes
o Log level: Everything will be logged.
o Using ODBC connection.
o Hooking SCO....hooked at 5c4320
o Hooking RCO....hooked at 5c4200
o Connect successful.
o Got request: DROP TABLE pwdata
! SQL Error: file is encrypted or is not a database (26)
o Got request: CREATE TABLE pwdata (player varchar(64) NOT NULL default '~',tag varchar(64) NOT NULL default '~',name varchar(64) NOT NULL default '~',val text,expire int(11) default NULL,last timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,PRIMARY KEY (player,tag,name)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
! SQL Error: file is encrypted or is not a database (26)
o Got request: SELECT player FROM pwdata WHERE player='Primogenitor' AND tag='Anyndur Imytholin' AND name='demoName'
! SQL Error: file is encrypted or is not a database (26)
o Empty set
o Got request: INSERT INTO pwdata (player,tag,name,val,expire) VALUES('Primogenitor','Anyndur Imytholin','demoName','testValue',0)
! SQL Error: file is encrypted or is not a database (26)
o Got request: SELECT val FROM pwdata WHERE player='Primogenitor' AND tag='Anyndur Imytholin' AND name='demoName'
! SQL Error: file is encrypted or is not a database (26)
o Empty set
o Got request: DROP TABLE pwobjdata
! SQL Error: file is encrypted or is not a database (26)
o Got request: CREATE TABLE pwobjdata (player varchar(64) NOT NULL default '~',tag varchar(64) NOT NULL default '~',name varchar(64) NOT NULL default '~',val blob,expire int(11) default NULL,last timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,PRIMARY KEY (player,tag,name)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
! SQL Error: file is encrypted or is not a database (26)
o Got request: SELECT player FROM pwobjdata WHERE player='~' AND tag='Chest1' AND name='Item_0'
! SQL Error: file is encrypted or is not a database (26)
o Empty set
o Got request (scorco): INSERT INTO pwobjdata (player,tag,name,val,expire) VALUES('~','Chest1','Item_0',~s,0)
! SQL Error:
o Got request: SELECT player FROM pwobjdata WHERE player='~' AND tag='Chest1' AND name='Item_1'
! SQL Error: file is encrypted or is not a database (26)
o Empty set
o Got request (scorco): INSERT INTO pwobjdata (player,tag,name,val,expire) VALUES('~','Chest1','Item_1',~s,0)
! SQL Error:
o Got request: SELECT player FROM pwobjdata WHERE player='~' AND tag='Chest1' AND name='Item_2'
! SQL Error: file is encrypted or is not a database (26)
o Empty set
o Got request (scorco): INSERT INTO pwobjdata (player,tag,name,val,expire) VALUES('~','Chest1','Item_2',~s,0)
! SQL Error:
o Got request (scorco): SELECT val FROM pwobjdata WHERE player='~' AND tag='Chest1' AND name='Item_0'
! SQL Error: file is encrypted or is not a database (26)
o Disconnecting from database.
|
So it looks like I was lucky and got the right combination first time, which is nice
Hope that those logs actually help someone, rather than just being a load of spam. Oh well. |
|
Back to top |
|
|
JeroenB
Joined: 31 Dec 2004 Posts: 228 Location: Netherlands
|
Posted: Fri Jan 14, 2005 21:56 Post subject: |
|
|
I suppose SQL Lite doesn't support the 'on update' part in the create table. This isn't really required functionality so you could remove that part and try the combo "SQL Lite ODBC driver and the latest NWNX version" again. |
|
Back to top |
|
|
Papillon x-man
Joined: 28 Dec 2004 Posts: 1060 Location: Germany
|
Posted: Sat Jan 15, 2005 1:06 Post subject: |
|
|
Or you could wait till tomorrow and forget about the ODBC driver entirely _________________ Papillon |
|
Back to top |
|
|
Acrodania
Joined: 02 Jan 2005 Posts: 208
|
Posted: Sat Jan 15, 2005 3:24 Post subject: |
|
|
I think one part of you problems is:
CREATE TABLE pwdata (player varchar(64) NOT NULL default '~',tag varchar(64) NOT NULL default '~',name varchar(64) NOT NULL default '~',val text,expire int(11) default NULL,last timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,PRIMARY KEY (player,tag,name)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Look at the ENGINE statement... MyISAM==SPecific MySQL format. The table create fails because you are passing a parameter SQL lite doesn't understand... |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|