Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[Tutorial] Super fast map loading + less lag


Fred
 Share

Recommended Posts

**Difficulty: 0/100**

This modyfication will stop downloading maps from server when there are changing and stop checking it so players can faster go trought maps and server have more power because less packets and calculations, here we go:

In Client Find:

```
If (casestring = "checkformap") Then
```
and exchange it all by this:

```
    If (casestring = "checkformap") Then
        ' Erase all players except self
        For i = 1 To MAX_PLAYERS
            If i <> MyIndex Then
                Call SetPlayerMap(i, 0)
            End If
        Next i

        ' Erase all temporary tile values
        Call ClearTempTile
        '!!!

        ' Get map num
        x = Val#(parse$(1))

        ' Get revision
        y = Val#(parse$(2))

        If FileExist("maps\map" & x & ".dat") Then

                Call SendData("needmap" & SEP_CHAR & "no" & SEP_CHAR & END_CHAR)
                Exit Sub
        End If

        Exit Sub
    End If
```
After that maps stop loading from server and that will be more faster for players.
One minus is you must add for client autoupdater who can downloading new maps, but i think  its woth it (packet with zip 100big maps are less than 200kb, player downloading it once and have no problems with changing maps)

+Faster map loading
+Less lag
-More complicated map adding
Link to comment
Share on other sites

There should be a bunch out there.

For the map download removal, another method would be to check by using CRC32 hashes. If they are equal the map are supposed to be the same, if they are different the maps are different and the new map should be downloaded, that's way faster than re-downloading the map each time.

Regards,
  Goddie, the Irresistible.
Link to comment
Share on other sites

eww ftp eww shouldnt you just have an install that installs all the maps then have smaller installs adding more maps + ftp for maps would be slow wouldnt it?
Link to comment
Share on other sites

There's already a revision system that only downloads maps with changes from the client version. Instead of removing it completely, just ship the latest maps with your game and re-upload the client every few days, so people downloading it for the first time get the more up-to-date maps, and the people who already have the game are still updated.
Link to comment
Share on other sites

@BlazeYaDeadZombie:

> What do you mean by More complicated map adding? This is a pretty cool idea though, nice.

Only that you must add it to your updater, its good for me but like Tyr says, if you have just started making game it can be complicated because you must actualize it often.
Link to comment
Share on other sites

  • 1 year later...
@pheXion:

> [
> After that maps stop loading from server and that will be more faster for players.
> One minus is you must add for client autoupdater who can downloading new maps, but I think  its woth it (packet with zip 100big maps are less than 200kb, player downloading it once and have no problems with changing maps)
>
> +Faster map loading
> +Less lag
> -More complicated map adding

But so people are able to hack this maps to get rare items.

just take one map out of thw folder. edit it with own eclipse and then you put it back.
then start the game. theres no newer map. then go to the edited map and take the item.

Thats one more "-"
Link to comment
Share on other sites

@Ryoky:

> @pheXion:
>
> > [
> > After that maps stop loading from server and that will be more faster for players.
> > One minus is you must add for client autoupdater who can downloading new maps, but I think  its woth it (packet with zip 100big maps are less than 200kb, player downloading it once and have no problems with changing maps)
> >
> > +Faster map loading
> > +Less lag
> > -More complicated map adding
>
> But so people are able to hack this maps to get rare items.
>
> just take one map out of thw folder. edit it with own eclipse and then you put it back.
> then start the game. theres no newer map. then go to the edited map and take the item.
>
> Thats one more "-"

No. Maps are loaded from the Server.
Link to comment
Share on other sites

@Soul:

> @Ryoky:
>
> > @pheXion:
> >
> > > [
> > > After that maps stop loading from server and that will be more faster for players.
> > > One minus is you must add for client autoupdater who can downloading new maps, but I think  its woth it (packet with zip 100big maps are less than 200kb, player downloading it once and have no problems with changing maps)
> > >
> > > +Faster map loading
> > > +Less lag
> > > -More complicated map adding
> >
> > But so people are able to hack this maps to get rare items.
> >
> > just take one map out of thw folder. edit it with own eclipse and then you put it back.
> > then start the game. theres no newer map. then go to the edited map and take the item.
> >
> > Thats one more "-"
>
> No. Maps are loaded from the Server.

Actually, I think that could be a problem.
How are attribute saved? Server-Side or Client-Side?
Because I thought the attribute is save to the map1.dat(or something).
So if you can remove or add attribute in map1.dat, you can cheat.

Sincerely,
Rithy
Link to comment
Share on other sites

@Rithy58:

> @Soul:
>
> > @Ryoky:
> >
> > > @pheXion:
> > >
> > > > [
> > > > After that maps stop loading from server and that will be more faster for players.
> > > > One minus is you must add for client autoupdater who can downloading new maps, but I think  its woth it (packet with zip 100big maps are less than 200kb, player downloading it once and have no problems with changing maps)
> > > >
> > > > +Faster map loading
> > > > +Less lag
> > > > -More complicated map adding
> > >
> > > But so people are able to hack this maps to get rare items.
> > >
> > > just take one map out of thw folder. edit it with own eclipse and then you put it back.
> > > then start the game. theres no newer map. then go to the edited map and take the item.
> > >
> > > Thats one more "-"
> >
> > No. Maps are loaded from the Server.
>
> Actually, I think that could be a problem.
> How are attribute saved? Server-Side or Client-Side?
> Because I thought the attribute is save to the map1.dat(or something).
> So if you can remove or add attribute in map1.dat, you can cheat.
>
> Sincerely,
> Rithy

It's the same.If you lay down a attribute from the map editor it won't change.
Link to comment
Share on other sites

@gothikaboy:

> http://gmc.yoyogames.com/index.php?showtopic=450832
> Found this by google.

Doing it wrong.

The way maps actually should be loaded is quite simple actually.

* Switch to another map in-game.
* Send CRC32-checksum of the map the client has (If there is no map, send that there is no checksum).
* The server compares the CRC32-checksum, if they're equal the client can proceed.
* In this case they aren't equal or the client doesn't have the map yet. The server should now send the map data.

The first issue of slow map loading is solved, now it only loads the map when an update occurred, but there is, however, a second issue which should be solved and that is that the server sends the wrong map data. The client only needs to know where to draw the graphics and nothing else. So the client only needs to know what tiles are used on what layers. The attributes and such are out of interest, since those should be handled by the server and not the client. So basically the only few things the client needs to know is what layers there are, what tiles are on them, the title of the map for display, the music to be played and a few other visual aspects. Not only do you reduce the stuff the client doesn't actually need and thus increase the performance, but you also increase the security, since the client only keeps track of the visual aspects and not the logic, that is supposed to be handled by the server.

Regards,
  Godlord.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...