Jump to content
  • Advertisement
Sign in to follow this  
CarloSpain

Sending the map

This topic is 3873 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, first at all, I search on the web some info about sending the map to the client, but I dont found nothing interesant. I need to give to the client my map, now there is the problem. I need to send big maps, about... more than 10000 tiles without objects. I have 5 ways (that I know) 1.- Save the map in the client (not in the server) and load all the map at start. With this method the map can load faster, but its not secure, and require a good ram (isnt it?) 2.- Save the map in the client (not in the server), and load the map while character is walking. With this, its fast and require less ram than method 1, but this is more difficult to code, and is not secure. 3.- Save the map in the server (and not in the client), and send tiles id when I connect to the server. This is more secure, its less fast then method 1 and 2, and requires more ram too. This requires too a big buffer. 4.- Save the map in the server (and not in the client), and send 1 packet for 1 y eye. With this I can send all my map, this is secure, less fast, require ram, and just a few packets when the client connects. 5.- Save the map in the server (and not in the client), send just a few tiles when I connect to the server, and while the player walks, send more tiles. This is more secure, more fast, requires less ram but this is the most difficult and takes a lot of connections to the server (1 packet for 1 tile... doing maths... A LOT) Are this method true? I forgot something? What you think its the best method? Can you say me more methods to load my map in the client? See you

Share this post


Link to post
Share on other sites
Advertisement
If I save the map in the client the user can change the map, isnt he?
There is a method to check if a user change the content of a file?

See you!

Share this post


Link to post
Share on other sites
Quote:
Original post by CarloSpain
If I save the map in the client the user can change the map, isnt he?

Sure, but that just means the client no longer knows what the real map is. The security issue would only arise if the server allowed the client to make moves which were incompatible with the map, like moving onto a tile where the server thinks there's a wall. The key to multiplayer security is this: don't trust the client. Let the client tell the server anything it wants, but make the server check that all actions are actually valid, and not allow actions which are not.

Share this post


Link to post
Share on other sites
Thanks you, you are helping me a lot.
Then you think save the map in the client its the best method?
What you think is better? Load all the map at the start, or load while walking?

Really thanks to you,
See you

Share this post


Link to post
Share on other sites
How is the map generated? Is it hand made or randomly generated. If it is random, you could just send the seed value for the random number generator and let the map build on the client. Anyway, what does 10000 tiles equate to in MB. I can't imagine it is more than a few megabytes. Just do what many games do, when the client connects, check to see if the client has the map, and if not have the server send it. You can make sure the client version matches the server version using a checksum.

Share this post


Link to post
Share on other sites
Just to clarify on what Sneftel said: both the server and the client should load the map themselves. The server loads the map because it needs to check if the clients actions are actually valid, and the client loads the map because it needs to display it, and check what actions it can take.

As for using a lot of memory, tile data is often pretty compact. In many cases, the data contains only image indices or references. You're only going to load every unique tile image once and reuse them for every tile that uses that image, after all. If every tile is a simple integer, then your total map data would likely be 40 KB. That's really just very little memory. Let's then say that each tile is 32x32, 32bits image... that's 4 KB per image. If your map uses 200 unique tile images, then that's 800 Kb. All in all, less then a single MB.

In other words, are you sure that your maps will use a lot of memory, or are you simply assuming that they will, because 10.000 just sounds like an awfull lot?

Share this post


Link to post
Share on other sites
I make my map by hand.
And I assuming, that this will take a lot of memory, maybe because its not just the tiles, the objects too and important points... all this information, what do you think is better? Load all at start, or load while walking?

Thanks,
See you

Share this post


Link to post
Share on other sites
Personally i think it would be better to have the map load as the player walked around. Games get really annoying when they have to load the entire map and besides, unless im very mistaken, it will take a lot of memory to store the map. The method i'm using is that the map tiles are stored on the client but the server has to send the location of the tiles and objects and the client just draws them. The tiles can be hacked it's true but the only way to prevent that that would be to send the tiles and the models over the server connection. I check the tiles by checking a number that is based on the values of several points of the tile so it cant be modified drastically without the server knowing about it. If someone beats my system good for them. If someone wants to ruin the game for themselves I dont care.

so to answer the question without a whole thing, go with the loading as the player moved, it will cut down on the overall loading as the player wont go everywhere so places he avoids wont be loaded.

Share this post


Link to post
Share on other sites
I think this too, but at the moment, I draw all the map in a auxiliar surface, and then I blit from that surface, to the primary surface, and then flip.
What is the difference between load all at start, and load while walking.
Thinking...
Load all at start: Takes a lot of memory cause I read ALL the map, not mind if I visit a part of it or not.
Load while walking: Its difficult, while a player is moving, the client is saving tiles in memory, while more steps, more memory, because I dont know how can I delete a tile saved in my auxiliar surface. If I blit a black rectangule in tiles that I dont use, this will delete some kbs of the ram?

I choose to save the map in the client too, but how can I encrypt my maps, making my own map format, to difficult the map edition?

And what about send the map from server to client while walking. This will slow the server a lot?

Thanks you,
Carlos

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!