Game Development Community

Character information screen for Rpgs

by Brandon Beauchene · in Game Design and Creative Issues · 03/02/2005 (9:33 pm) · 6 replies

Hello all you happy readers. I am here to pose a question, a simple one at that. I wish to expand the player datablock in the FPS demo (or any other game for that matter) my simple question would normally be in the programming section but what im having issues with is updating the gui display.

i have added a few vars for stats like strength, agility, etc to the : datablock playerdata(PlayerBody) section in the fps demo that came with torque. I have also create a base gui screen for showing character information using just a bunch of guitextcontrols. My problem is what variable to i use to access each of the variables in the playerbody?
for instance:

new guiTextCtrl() {
//blah blah
variable = %strength
}
doesnt work. Ive tried using just the variable name, %player.strength, etc and nothing updates. any suggestions or answers?

#1
03/09/2005 (7:59 pm)
Still having probs with this?
#2
03/17/2005 (2:04 pm)
Nope i figured it out, i was several things ranging from data not being sent from the server to the client properly, mistyped variables, etc. but thanks tho :)
learned more by fiddling with it myself anyway :P
#3
04/12/2005 (5:01 pm)
You should write up a lil resource then, like how to add a few stats(strength,speed,hp) and a char gui to see them? :-)
#4
11/13/2005 (7:43 am)
I know I'm realy, really late to the ball with this one, but for the next person who tries this let me be the first to say.
Adding stats to the datablock is a really bad idea. If you do that then as soon as you change a stat, all players using that datablock instantly incur that change.
A much better solution is to create a ScriptObject or SimSet called stats during the player creation phase after the datablock has been loaded, and put your stats in there.
After that it's a simple matter of making sure changes from go from client to server and back again.
#5
05/13/2006 (9:13 pm)
Script is nice for testing implimentation
but as game builds decreases performance
thing such as this (repeditive usage)
should go into C++ processes

scripts are nice because you dont need a rebuild after every edit
but once the process is working just fine
code it into build, free up that process time
#6
05/13/2006 (9:29 pm)
I store my player attributes in server side variables in 'Player' (ie., strength, intelligence, social standing, combat rating, etc...).

When a human player request the player stats screen, the GUI code sends a 'commandToServer' to request a set of the player's current stats. When these stats are received back on the client (via commandToClient), I just store them in dynamic script variables of the GUI components (PlayerStatsGui.strength) and put them up into the screeen via pushDialog with a player stats GUI.

I did end up declaring the various player attributes in C++, but only because I eventually want to access to them in the physics-related routines (such as strength to alter running speed. endurance to alter energy drain, etc...). If I was only expecting to access them via script routines, I could probably just have used dynamic attributes in TorqueScript.

In either case, you probably shouldn't count in accessing variables (especially local ones like '%strength') on the client-side unless you explicitly set them there.