mount datablocks problem on 'loadout' in gameCore
by Dimitris Matsouliadis · in Torque 3D Professional · 02/13/2012 (9:17 pm) · 4 replies
hello
Working on a mmo rpg game, all code written for both sides, server client (T3D 1.2, dedicated).
I create a new character selecting body, head, hair, eyes etc.
Each character has its own datablock, loaded when the player makes login.
I have no problem up here on both sides (server, client), the characters should do spawn as well.
Datablocks stored in player file, Example:
player file Astald_db.cs
datablock PlayerData(Astald_data : DefaultPlayerData)
{...
mainWeapon = "impSword";
maxInv[impSword] = 1;
.... };
datablock ItemData(Astald_head : bHead)
{... };
datablock ShapeBaseImageData(impSwordImage)
{... };
etc weapons, armors ...
what's my problem? character can not do any mount in multiplayer mode (dedicated server), ���¤T3D crash.
in single player mode all working as well.
Example mount:
%player.mountImage(%player.getDatablock().mainWeapon.image, 0); < here is my problem in multiplayer
if someone met the same problem and can help I am particularly grateful :)
Working on a mmo rpg game, all code written for both sides, server client (T3D 1.2, dedicated).
I create a new character selecting body, head, hair, eyes etc.
Each character has its own datablock, loaded when the player makes login.
I have no problem up here on both sides (server, client), the characters should do spawn as well.
Datablocks stored in player file, Example:
player file Astald_db.cs
datablock PlayerData(Astald_data : DefaultPlayerData)
{...
mainWeapon = "impSword";
maxInv[impSword] = 1;
.... };
datablock ItemData(Astald_head : bHead)
{... };
datablock ShapeBaseImageData(impSwordImage)
{... };
etc weapons, armors ...
what's my problem? character can not do any mount in multiplayer mode (dedicated server), ���¤T3D crash.
in single player mode all working as well.
Example mount:
%player.mountImage(%player.getDatablock().mainWeapon.image, 0); < here is my problem in multiplayer
if someone met the same problem and can help I am particularly grateful :)
About the author
entelsoft, commercial accounting software
#2
I use it as you propose, but there is still.
The mounts works great in single player, but not in dedicated server
Noted: The datablock of the player loaded only when the player makes connection and login, and automatically creates the choices made by the player.
example datablock of a player etc Astald_db.cs
new ScriptObject(Astald_db) {
shapeFile = "art/shapes/actors/tplayer/thPlayer.dts";
shapeHead = "Astald_head";
sHead = "0";
sRhand = "impSword";
sLhand = "ironShield";
sHealth = "100";
sEnergy = "80";
sRestoration = "2";
sAlteration = "1";
sIntuition = "2";
sDestruction = "5";
sDexterity = "3";
sAgility = "2";
sMagic = "1";
sSneak = "0";
sSpeed = "6";
sHeavyArmor = "2";
sLightArmor = "1";
sClothArmor = "1";
sBlock = "0";
sOneHanded = "1";
sTwoHanded = "1";
sArchery = "1";
sParry = "0";
sLockpicking = "0";
sPickpocket = "0";
sMining = "1";
sSkinning = "1";
sWoodcutting = "1";
sBotanists = "1";
sCooking = "1";
sFame = "0";
sDefenseless = "0";
sReputation = "0";
sInBattle = "0";
sPosition = "102.057 17.509 238.429";
sMoneyS = "156589";
};
datablock PlayerData(Astald_data : DefaultPlayerData)
{
shapeFile = "art/shapes/actors/tplayer/thPlayer.dts";
maxDamage = "100";
maxEnergy = "80";
maxForwardSpeed = "6";
maxBackwardSpeed = "4";
maxSideSpeed = "5";
mainHead = "Astald_head";
maxInv[Astald_head] = 1;
mainWeapon = "impSword";
maxInv[impSword] = 1;
mainShield = "ironShield";
maxInv[ironShield] = 1;
};
datablock ItemData(Astald_head : bHead)
{
shapeFile = "art/shapes/actors/heads/bHead.dts";
image = Astald_headImage;
};
datablock ShapeBaseImageData(Astald_headImage : bHeadImage)
{
shapeFile = "art/shapes/actors/heads/bHead.dts";
};
new ScriptObject(Astald_it) {
bagI0 = "10001 6";
bagI1 = "10002 10";
bagI2 = "10005 11";
bagI3 = "10007 12";
bagI4 = "10008 23";
bagI5 = "10004 25";
bagI40 = "10009 24";
bagI41 = "10010 11";
};
The new player datablock working great and inform all connected players, single player or multiplayer.
In this example player datablock is 'Astald_data', player login in the game successfully.
this in 'loadOut' working wonderful in singlePlayer mode
function GameCore::loadOut(%game, %client, %player)
{
//echo (%game @"c4 -> "@ %game.class @" -> GameCore::loadOut");
//%player.clearWeaponCycle();
%player.setInventory(%player.getDatablock().mainHead, 1);
%player.mountImage(%player.getDatablock().mainHead @ "Image", 2);
}
...but broken the engine when login a Client on dedicated server.
the %player.getDatablock().mainHead is the 'Astald_head' and
the %player.getDatablock().mainHead @ "Image" is the 'Astald_headImage'
Where this can be due? Where to look in the code to find a solution?
Thanks :)
02/17/2012 (9:10 am)
thanks Ryan for your help, the problem lies precisely at this point.I use it as you propose, but there is still.
The mounts works great in single player, but not in dedicated server
Noted: The datablock of the player loaded only when the player makes connection and login, and automatically creates the choices made by the player.
example datablock of a player etc Astald_db.cs
new ScriptObject(Astald_db) {
shapeFile = "art/shapes/actors/tplayer/thPlayer.dts";
shapeHead = "Astald_head";
sHead = "0";
sRhand = "impSword";
sLhand = "ironShield";
sHealth = "100";
sEnergy = "80";
sRestoration = "2";
sAlteration = "1";
sIntuition = "2";
sDestruction = "5";
sDexterity = "3";
sAgility = "2";
sMagic = "1";
sSneak = "0";
sSpeed = "6";
sHeavyArmor = "2";
sLightArmor = "1";
sClothArmor = "1";
sBlock = "0";
sOneHanded = "1";
sTwoHanded = "1";
sArchery = "1";
sParry = "0";
sLockpicking = "0";
sPickpocket = "0";
sMining = "1";
sSkinning = "1";
sWoodcutting = "1";
sBotanists = "1";
sCooking = "1";
sFame = "0";
sDefenseless = "0";
sReputation = "0";
sInBattle = "0";
sPosition = "102.057 17.509 238.429";
sMoneyS = "156589";
};
datablock PlayerData(Astald_data : DefaultPlayerData)
{
shapeFile = "art/shapes/actors/tplayer/thPlayer.dts";
maxDamage = "100";
maxEnergy = "80";
maxForwardSpeed = "6";
maxBackwardSpeed = "4";
maxSideSpeed = "5";
mainHead = "Astald_head";
maxInv[Astald_head] = 1;
mainWeapon = "impSword";
maxInv[impSword] = 1;
mainShield = "ironShield";
maxInv[ironShield] = 1;
};
datablock ItemData(Astald_head : bHead)
{
shapeFile = "art/shapes/actors/heads/bHead.dts";
image = Astald_headImage;
};
datablock ShapeBaseImageData(Astald_headImage : bHeadImage)
{
shapeFile = "art/shapes/actors/heads/bHead.dts";
};
new ScriptObject(Astald_it) {
bagI0 = "10001 6";
bagI1 = "10002 10";
bagI2 = "10005 11";
bagI3 = "10007 12";
bagI4 = "10008 23";
bagI5 = "10004 25";
bagI40 = "10009 24";
bagI41 = "10010 11";
};
The new player datablock working great and inform all connected players, single player or multiplayer.
In this example player datablock is 'Astald_data', player login in the game successfully.
this in 'loadOut' working wonderful in singlePlayer mode
function GameCore::loadOut(%game, %client, %player)
{
//echo (%game @"c4 -> "@ %game.class @" -> GameCore::loadOut");
//%player.clearWeaponCycle();
%player.setInventory(%player.getDatablock().mainHead, 1);
%player.mountImage(%player.getDatablock().mainHead @ "Image", 2);
}
...but broken the engine when login a Client on dedicated server.
the %player.getDatablock().mainHead is the 'Astald_head' and
the %player.getDatablock().mainHead @ "Image" is the 'Astald_headImage'
Where this can be due? Where to look in the code to find a solution?
Thanks :)
#3
Also take a look at this from Steve Acaster Basic Torque3D Hierarchy
02/17/2012 (7:32 pm)
I think you have a creation dependency issue. In the itemdata you set the image to Astald_headImage but it isn't defined until afterwards. I would also make sure those are defined before your playerdata as well. Also make sure it is being exec'd on the client as well. When running in single player client and server kind of share data, but if it is only exec'd on the server and not the client then you will have problems. Best thing to do is look how the examples are execing the datablocks both client and server.Also take a look at this from Steve Acaster Basic Torque3D Hierarchy
#4
Moreover these are constant datablocks and can exist on both side.
Thanks Ryan, again :), i go to try with all datablocks (outside the character) to exist in both sides.
02/17/2012 (8:23 pm)
I think the problem is there. All the base datablocks are in both sides server and client (etc DefaultPlayerData, bHead). After client login server loading datablock based of the name (etc Astald). Inherited from 'DefaultPlayerData' to new 'Astald_data' datablock. Server inform great all clients for this. I tested this with up to 9 different clients simultaneously. But this obviously applies only to 'PlayerData' type datablock, not for 'ItemData' or 'ShapeBaseImageData' datablocks.Moreover these are constant datablocks and can exist on both side.
Thanks Ryan, again :), i go to try with all datablocks (outside the character) to exist in both sides.
Torque Owner Ryan Mick
Red Witch Entertainment
%player.mountImage(%player.getDatablock().mainWeapon @ "Image", 0);
The image variable in Items have the full ShabeBaseImageData name, which you variable does not contain.
Hope that helps.