Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Multiplayer cameras

Author
Message
Numisi
13
Years of Service
User Offline
Joined: 27th Jul 2012
Location:
Posted: 26th Jun 2013 00:26
Another nooby question...
I can't figure out how to use cameras in a 3d multiplayer game. Have I to send continuous images as messages, or is there a way to "connect" cameras between host and client?
Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 26th Jun 2013 01:00
what exactly you trying to make?

an online fps game where each user controls his own char and u want to swich between the users to see what they up to on their camera view?
if thats the case, just use the same camera coordinates of other users on your own camera.

you dont need more than 1 camera for all of that..

Stream SnifferTools/Plugins/Models/Games and more!
Numisi
13
Years of Service
User Offline
Joined: 27th Jul 2012
Location:
Posted: 26th Jun 2013 12:00
I want to make a small online game, where each user has it's own character, so it's own camera too.
I've not understood yet how it works: only the host has the world generated, the clients send data on what they are pressing and the host updates the data in the world sending camera information to the clients, or the world is generated in every client, the client sends data to the host wich updates world data and sends updates to the client worlds?
I know it is the very basic understandig of the 3d multiplayer, but I haven't found a tutorial yet.
Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 26th Jun 2013 14:20
im not sure wich protocol u using for that multiplayer game, but lets assume u using TCP/IP

you just creating word inside a client, and sending your character X,Y,Z positions to server wich then delivering to the rest of the users that online excluding your self.

that your client knows where to place online characters

here is a typical data pocket that sending your own positions to server

PutInteger MyCharPosX()
PutInteger MyCharPosy()
PutInteger MyCharPosZ()
NetSend 0 //sending to server


here is a typical reciving commands that at the server..

if NetMsgExists()>0
PlayerID = NetGetPlayerID()
PosX = GetInteger()
PosY = GetInteger()
PosZ = GetInteger()

//Send this info to all other players
for a = 1 to AllOnlinePlayers
if a <> PlayerID
PutInteger 10 //lets say its your msg ID
PutInteger PlayerID
PutInteger PosX
PutInteger PosY
PutInteger PosZ
NetSendTo a
endif
next a
endif


and finally, your client getting this data and syncing the player position
Client side (reciving after server)
if MsgExists()>0
MsgID = NetGetInteger()
if MsgID = 10
OtherPlayerObjNum = NetGetInteger()
PosX = NetGetInteger()
PosY = NetGetInteger()
PosZ = NetGetInteger()
position object OtherPlayerObjNum,PosX,PosY,PosZ
endif
endif


this is a very basic structure of online data exchanging.
i know you were talking about cameras and i gave you an example of player positions, but it basicly goes the same.. just change the player positions to camera positions on sending and reciving

i also didnt mentioned whats MsgID and whats that for, but it will be up to you to understand all of that.

good luck

Stream SnifferTools/Plugins/Models/Games and more!
Numisi
13
Years of Service
User Offline
Joined: 27th Jul 2012
Location:
Posted: 27th Jun 2013 13:00
So the game world is created in every client, every client sends updates to the host, and the host sends the single client updates to all the clients? Thank you, I suspected the functioning was this, but I wasn't sure.
Last question: if every client creates it's own world, when a client disconnects, and then connects again with the host, all the world data has to be re-downloaded completely because the client misses every update, so if a world is big it has to be separated in a lot of smaller areas to be downloaded quickly, or it would be too long to download. Is this right or am I missing something?
Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 27th Jun 2013 20:49
too long to download?
lets say the complete map is stored inside the server and its a map of blocks (like mincraft or whatever u trying to make)
u just sending to the new joined player ONLY the map that surrounds him. and keep syncing his position with the rest of the map

if the player moves, server giving to client the order to erace the blocks that too far from him and create new ones if its on view ranage.

its massive data i know, thats why u need a good pc to handle the server stuff for you.

but dont expect me to teach you about all the other twicks on multiplayer network that u can do to handle those massive data.
those stuff you must learn by ur self..
just start experiancing and good luck

Stream SnifferTools/Plugins/Models/Games and more!
Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 27th Jun 2013 21:20
i have made this code snippet long time ago that creates and destroys objects dynamicly.
its not online or multiplayer or somethign like that
it will just give you the idea oh map generation that you can use on your server side.




Stream SnifferTools/Plugins/Models/Games and more!
Numisi
13
Years of Service
User Offline
Joined: 27th Jul 2012
Location:
Posted: 28th Jun 2013 11:50
Yes, thank you, I have already written codes to create objects near and destroy objects far, but I didn't think on sendig only data in this way, it's a good idea!
I'm not totally a noob as I look, it's only my first experience with online programs...
Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 28th Jun 2013 12:03
i have made an MMORPG game some time ago that i didnt showed on the forums.
but the method was just like that
im not using blocks to make the map, but my server has the whole map and it sends only the object IDs of the maps that needs to be loaded on each client.

its not block based map, but its area based much easyer to handle.

but you can be sure it all works and v. smooth!

Stream SnifferTools/Plugins/Models/Games and more!

Login to post a reply

Server time is: 2026-07-06 16:50:20
Your offset time is: 2026-07-06 16:50:20