logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Storing creature appearances (PC's)

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Database related
View previous topic :: View next topic  
Author Message
Kilana



Joined: 28 Jun 2008
Posts: 2

PostPosted: Mon Jul 27, 2009 16:58    Post subject: Storing creature appearances (PC's) Reply with quote

For this system I'm trying to setup, I want to let PC's record their appearance which can be recalled at any time by other PC's. (This includes, character name, race, subrace, gender, pheno, body parts and examine description data)

I was thinking about two possible approaches for this.

1: One was to use the default APS Set/GetPersistentObject() to store a copy of the PC(stripped of all inventory items/equips to save space). This strikes me as the easiest to implement... if it will work, though I'm worried because I heard something about 1024 char limit on result data, which creature objects probably exceed.

2: The other approach I was thinking of was to create a custom table with all the key data, and apply changes dynamically in game with template creatures. This method strikes me as a space saver since unnecessary things would not be recorded like class, skill info... but I don't know if this will even work because some players have very long examine descriptions.

So I was wondering? Will option 1 actually work? This would be the prefered option because it's simplest to script. Or would option 2 be better? (I can see the advantages of having an easily readable table with this data.) Or are both unfeasable without some sort of workaround scripting, like breaking up the stored data into smaller values and using multiple rows. Any advice would be really appreciated!

Oh, our server runs on Windows XP and the database is sqlite. Alot of data is stored using the default APS Set/GetPersistent() functions, but we also use SQLExecDirect() and acaos/Funky's SQLExecStatement() when we need more function. I'm still a complete novice when it comes to sql scripting though.
Back to top
View user's profile Send private message
juliam



Joined: 09 Aug 2008
Posts: 16
Location: Québec Canada

PostPosted: Mon Jul 27, 2009 22:05    Post subject: Reply with quote

hi Smile
i installed this yesterday, so i am not even a newbie, i'm a starter
but i come give some answers since there was not much people answering mines hehehe
yesterday, i read the posts for few hours so, i may be able to help

storing the objects is alot less work
the limits come from the settings of the database, you heard 1024....
Papillon made something like pwdata of pwobject to store objects, you should use that... and the limits do not apply to that...

someone gave the advice of storing the description on an object to avoid limits on varchar 1024 but again this limit could be set IMO

now, if you intend to design the architecture of a creature object in tables, that would be a super toy to play with... it is the best way to learn architecture of data... it is surely a huge work but how rewarding Smile
Back to top
View user's profile Send private message
Zebranky



Joined: 04 Jun 2006
Posts: 415

PostPosted: Mon Jul 27, 2009 23:14    Post subject: Reply with quote

I'm not sure if Set/GetPersistentObject() will work on PCs. If you try that, I'd be interested to know how it works.

Length of descriptions don't matter as long as you use a TEXT or BLOB type for that field. Plan 2 sounds like it would work.

I'll tell you the same thing I tell everyone who uses sqlite: I recommend switching to MySQL sooner rather than later (the fewer data you have to migrate, the better). MySQL generally has more features, even if they come at a minor performance cost.
_________________
Win32 SVN builds: http://www.mercuric.net/nwn/nwnx/

<Fluffy-Kooshy> NWNx plugin is to this as nuclear warheads are to getting rid of fire ants.

<ThriWork> whenever I hear nwn extender, I think what does NWN need a penis extender for?
Back to top
View user's profile Send private message Visit poster's website
Kilana



Joined: 28 Jun 2008
Posts: 2

PostPosted: Sun Aug 02, 2009 4:44    Post subject: Reply with quote

Sorry for the late response, but thank you for the replies.

Set/GetPersistentObject is actually working without a problem, so I guess my concern really was unnecessary Smile. I don't actually save the PC creatures, but I use copyobject first and a stripping function. (Like the cloning script in XP2, the mirror chamber)

As for switching databases, I wish we could (Would love to get rid of the necessity to COMMIT; BEGIN to save the database)... but our server doesn't have the population to warrant such an upgrade probably. And also we'd like to minimize the amount of work our host needs to do on her end.

I actually tried setting up an SQL server on my laptop for testing a couple weeks back... but gave up. The MS SQL Express thingy took nearly four hours to download and install, and after it was on my system, my CPU wouldn't go below 80% usage... So after an hour of tinkering and frustration, I just uninstalled it.
Back to top
View user's profile Send private message
Gryphyn



Joined: 20 Jan 2005
Posts: 431

PostPosted: Sun Aug 02, 2009 6:50    Post subject: Reply with quote

Kilana wrote:
I actually tried setting up an SQL server on my laptop for testing a couple weeks back... but gave up. The MS SQL Express thingy took nearly four hours to download and install, and after it was on my system, my CPU wouldn't go below 80% usage... So after an hour of tinkering and frustration, I just uninstalled it.

Strange that... SQLExpress has a relative low 'latent' profile. I'll assume you went with SQLe2008 and installed all the extras as well. Still this shouldn't cause a problem. When you say 80% are you talking about RAM or CPU? (RAM you can 'cap' to something your machine can handle)
I'm not pushing it, but the SQLServer plugin is the first designed to work with BOTH the database AND with NWN(1) - along with providing far simpler NWScript options for accessing the database. I'm lost interest to redo it for MySQL (or ODBC, or NWN2) The NWN1 version meets my needs.

Cheers
Gryphyn
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Database related All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
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