Mirage Source
http://www.miragesource.net/forums/

Need the MS community's help with packets
http://www.miragesource.net/forums/viewtopic.php?f=201&t=1058
Page 1 of 24

Author:  Spodi [ Fri Jan 05, 2007 10:40 am ]
Post subject:  Need the MS community's help with packets

We have some smart programmers here, but more importantly, there are a lot of creative people here, so I wanted to know if I can get some of your guys's help. I am currently facing a problem with updating packets for movement. Why movement? Well movement is something that happens a hell of a lot, so it suffers a hell of a lot from packet headers. If you move 3 tiles in a second, which isn't that fast, that is 120 bytes in a second from just TCP and IPv4 packet headers.

Anyways, heres the link:
http://www.vbgore.com/forums/viewtopic.php?t=1406

Sorry it is lengthy, I tried my best to explain things (though probably didn't do a great job). Anyways, please post your suggestions here or there. Any suggestions are helpful.

Thanks for your help! :D

Author:  Dragoons Master [ Fri Jan 05, 2007 12:18 pm ]
Post subject: 

What I think you can do, and is actualy what I am doing is to make the distance checks server side, the way you didn't want to do becouse you said it uses to much CPU. I don't think it is that much CPU. I know the check would be used thousand of times each second if there are a lot of players online but you should do a speed test to see how many of this tests can be done with out any speed problem. Is a simple:
Code:
ok=0
If getplayerx(a)<getplayerx(b) then
    If getplayerx(a)+(mapxsize/2)+1>=getplayerx(b) then
        If getplayery(a)<getplayery(b) then
            If getplayery(a)+(mapysize/2)+1>=getplayery(b) then
                ok=1
            end if
        elseif getplayery(a)<getplayery(b) then
            If getplayery(a)-(mapysize/2)-1<=getplayery(b) then
                ok=1
            end if
        end if
    endif
elseif getplayerx(a)>getplayerx(b) then
    if getplayerx(a)-(mapxsize/2)-1<=getplayerx(b) then
        If getplayery(a)<getplayery(b) then
            If getplayery(a)+(mapysize/2)+1>=getplayery(b) then
                ok=1
            end if
        elseif getplayery(a)<getplayery(b) then
            If getplayery(a)-(mapysize/2)-1<=getplayery(b) then
                ok=1
            end if
        end if
    end if
end if
if ok = 1 then
    SENDPLAYERPOSITION
end if

Just quickly did this, not sure if is the best code and with less checks but I realy don't think that this cpu usage will be so big that it may stuck the server.

Author:  William [ Fri Jan 05, 2007 12:50 pm ]
Post subject: 

All that checking just to make sure if you should send the players positions to the other players seems useless. I will think about this and see if I get an idea or something.

But concerning the sending of the location to other online players, that should probably be map-wise, and not be divided up even if scrolling is used.

Moved to "Advanced Questions".

Author:  Spodi [ Sat Jan 06, 2007 12:35 am ]
Post subject: 

Oops, sorry about the wrong section, William. :oops:

Problem with that, Dragoons Master, is you either end up with the 2nd routine I listed (the vbGORE v0.2.2 method) and you get many "ghosts" since you don't update their position again until they are back in the screen (so you will see them at their old position until you run into their real position, then they will warp over there).

Either that, or you have to check if they move out of the screen (so extra checks to see if they are moving away from you, and if they moved out of the view area), then delete the character, then remake them when they come back into view (which means you have to constantly do distance checks to see if they are in range and make and "update row" when the user is moving to force update any character that enters their view when they move). See how bulky it gets? :wink:

Author:  Misunderstood [ Sat Jan 06, 2007 12:48 am ]
Post subject: 

Does vbGore have scrolling? Otherwise I'm not sure what the diff is between the screen and the map is.
How does the scrolling work, what is the map size in relation to the viewable screen?

Author:  wanai [ Tue Jan 25, 2022 7:15 am ]
Post subject:  Re: Need the MS community's help with packets

Alie

Author:  wanai [ Tue Jan 25, 2022 7:16 am ]
Post subject:  Re: Need the MS community's help with packets

174.7

Author:  wanai [ Tue Jan 25, 2022 7:17 am ]
Post subject:  Re: Need the MS community's help with packets

PERF

Author:  wanai [ Tue Jan 25, 2022 7:18 am ]
Post subject:  Re: Need the MS community's help with packets

PERF

Author:  wanai [ Tue Jan 25, 2022 7:19 am ]
Post subject:  Re: Need the MS community's help with packets

NIRV

Author:  wanai [ Tue Jan 25, 2022 7:20 am ]
Post subject:  Re: Need the MS community's help with packets

Ding

Author:  wanai [ Tue Jan 25, 2022 7:21 am ]
Post subject:  Re: Need the MS community's help with packets

Radi

Author:  wanai [ Tue Jan 25, 2022 7:23 am ]
Post subject:  Re: Need the MS community's help with packets

Davi

Author:  wanai [ Tue Jan 25, 2022 7:24 am ]
Post subject:  Re: Need the MS community's help with packets

Gall

Author:  wanai [ Tue Jan 25, 2022 7:25 am ]
Post subject:  Re: Need the MS community's help with packets

Emil

Author:  wanai [ Tue Jan 25, 2022 7:26 am ]
Post subject:  Re: Need the MS community's help with packets

Retu

Author:  wanai [ Tue Jan 25, 2022 7:27 am ]
Post subject:  Re: Need the MS community's help with packets

John

Author:  wanai [ Tue Jan 25, 2022 7:28 am ]
Post subject:  Re: Need the MS community's help with packets

Capc

Author:  wanai [ Tue Jan 25, 2022 7:29 am ]
Post subject:  Re: Need the MS community's help with packets

Bora

Author:  wanai [ Tue Jan 25, 2022 7:30 am ]
Post subject:  Re: Need the MS community's help with packets

dili

Author:  wanai [ Tue Jan 25, 2022 7:31 am ]
Post subject:  Re: Need the MS community's help with packets

Deko

Author:  wanai [ Tue Jan 25, 2022 7:33 am ]
Post subject:  Re: Need the MS community's help with packets

Thom

Author:  wanai [ Tue Jan 25, 2022 7:34 am ]
Post subject:  Re: Need the MS community's help with packets

Roco

Author:  wanai [ Tue Jan 25, 2022 7:35 am ]
Post subject:  Re: Need the MS community's help with packets

Micr

Author:  wanai [ Tue Jan 25, 2022 7:36 am ]
Post subject:  Re: Need the MS community's help with packets

Tuli

Page 1 of 24 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/