[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: 2 Player mode



On Monday 09 October 2006 10:46 am, Jens Granseuer wrote:
> It looks like to do this properly we need NetBuffer to allocate
> memory dynamically (so we can do history->Save( NetBuffer )).
> However, the standard STL classes (vector, string) are not really
> suited for this purpose since we also need raw data access for
> the SDL_net API. Do we really need to implement our own buffer
> class? Any clever ideas?

Doesn't string have something like string::c_str() or something that gives 
access to the underlying char*?

Failing that, you could rip the tList class out of Armagetron Advanced.  Or 
maybe it's tArray you want, one of the two.

What I'm thinking is you want a class that just stores each turn internally in 
like a std::deque or something, and then encodes it right before sending it 
to the network.  Obviously it would decode it when it gets it from the 
network.  Maybe that's what you meant and I"m still half asleep (likely, heh, 
I slept the sleep of the dead last night, took me an hour to remember my name 
this morning).

Dave

> Jens