About Store Forum Documentation Contact



Post Reply 
Inserting character in world
Author Message
Dwight Offline
Member

Post: #1
Inserting character in world
Hi all,

Back in the day, this used to work to insert a character into the world:

Code:
void create(Int ID, Str name, Vec2 position, Flt scale)
{
    Game::ObjParams obj;

    obj.create(*Game::Objs(UID(xx, xx, xx, xx)));
    obj.scale (true, scale);

    obj.matrix.pos.x = position.x;
    obj.matrix.pos.z = position.y;
    obj.matrix.pos.y = Game::World.hmHeight(position);  

    UID uid;
    uid.fromText(L"OBJ_CHR");

    obj.type(true, uid);

    super::create(obj);

    Name    = name;
    this->ID = ID;

    ctrl.actor.mass(1).kinematic(true).collision(true).group(ACTOR_NPC).obj(thi​s);
}

This is what my old code has to insert a character into the world (server sided AI). I have issues finding the equivalent of "Game::ObjParams" [I thought it was ObjectPtr?].

How can I insert a character, like the example above, in the world through code?
04-16-2021 01:33 PM
Find all posts by this user Quote this message in a reply
Dwight Offline
Member

Post: #2
RE: Inserting character in world
Hi Zervox,

Thanks for the information! I should now just debug why spawning that NPC makes my client crash, but it's progress! grin

Good to see you lurking and posting here sometimes!
04-17-2021 05:15 PM
Find all posts by this user Quote this message in a reply
Dwight Offline
Member

Post: #3
RE: Inserting character in world
(04-18-2021 07:52 AM)Zervox Wrote:  
(04-17-2021 05:15 PM)Dwight Wrote:  Hi Zervox,

Thanks for the information! I should now just debug why spawning that NPC makes my client crash, but it's progress! grin

Good to see you lurking and posting here sometimes!

I regularly lurk around, just very little time to actual post or do development with the engine, but still keeping track of updates and posts, life and all that. smile

Life is a bit boring and so... Game Engine development and game development never stops!

I have succesfully, manually, inserted the char into a worl without the MMO foundation framework, and I tracked the issue down to server-client communication that is causing the crash now. Getting there! smile
04-18-2021 08:38 AM
Find all posts by this user Quote this message in a reply
Post Reply