About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
Map and Memx
Author Message
Chris Offline
Member

Post: #1
Map and Memx
Hi,

I have a map of RakNet SystemAddresses and Actors : Game::Chr like this:
Code:
Map<SystemAddress, Actor> Characters(Create, Compare, NULL);

Previously, I was using Game::ObjMemx<Actor> Characters, and this code worked:
Code:
.setObjType(Characters,OBJ_CHR)
.New("world/sample.world");

This is drawn with:
Code:
void onPlayerEnter(unsigned short networkID, Str8 name, Vec pos)
{
    Game::ObjParams &player = *Game::Objs("Obj/chr/Human/0.obj");
    Game::World.objCreate(player,Matrix(player.scale(),pos));
}

But now i'm using a Map, I can't do .setObjType(Map<...>,...) - is there a way I can make this work? Or do I have to iterate the map each render frame to draw the players? If I have to do the later, do I have to cull them manually?

Edit: And Dynad and I were discussing the next version of the RakNet tutorial, and wondered if it would it be too much to ask for velocity-time Interpolation and Extrapolation, as with http://www.mindcontrol.org/~hplus/interpolation.html as a feature request for an engine feature, on some low level which lets us use it in players, physics primitives, etc.

Thanks,
Chris
(This post was last modified: 02-21-2010 12:29 AM by Chris.)
02-20-2010 04:13 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Map and Memx
Hi,

No you can't use Map for storing world objects,
but you can store references to objects:

ObjMemx<Game::Chr>

Map<key, Reference<Game::Chr>>

maybe this will help you.

as for interp/extrap I don't know exactly what you mean/what you need.
you can try recording positions of each character in the previous frame, compare it to the current. and do some math on it.
02-22-2010 04:56 PM
Find all posts by this user Quote this message in a reply
Chris Offline
Member

Post: #3
RE: Map and Memx
Hi,

Thanks for your reply. Okay, i'll do that with the Map.

Some game engines, e.g. Torque and Source engine address interpolation/extrapolation by offering tools for interpolation and extrapolating network objects. When you do the multiplayer 1-16 support, will you code in this math? If so, can interpolation / extrapolation be an engine feature that we can use?

Thanks,
Chris
02-22-2010 05:09 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Map and Memx
yes I'm sure I'll try to handle this when I will be adding multiplayer functionality.
02-22-2010 05:13 PM
Find all posts by this user Quote this message in a reply
Post Reply