Sign in to follow this  
Drakath

Map resources

Recommended Posts

Are the objects created in the .map file equivalent to serverside createObject or clientside createObject?

Share this post


Link to post

Yes, it is equivalent,

If you create object on server side - synced for all players. If you create on client side - synced only for local player.

You CAN create an object on client side but would affect sync i think, so my recommendation would be to make it server-sided.

Share this post


Link to post

What I really meant with my question is whether the map resource creates those objects clientside or serverside.

Share this post


Link to post
What I really meant with my question is whether the map resource creates those objects clientside or serverside.

It creates the objects server sided (for everyone).

Share this post


Link to post
What I really meant with my question is whether the map resource creates those objects clientside or serverside.

It creates the objects server sided (for everyone).

How do you know this? Did you read it somewhere? Objects created clientside are also seen by everyone because the script is executed for everyone.

Share this post


Link to post

How do you know this? Did you read it somewhere? Objects created clientside are also seen by everyone because the script is executed for everyone.

Nope, objects created in client side are only seen by the client.

  
bindKey ("k","down", 
function () 
createObject ( ... ) 
end ) 
  

Test this in client side. If you press "k" then you will see the object only. Other people won't.

btw YES, objects are created server side from map. Check wiki documentation for .map format.

Share this post


Link to post

@Saml1er what I was saying was that clientside objects can be seen by everyone because the script is executed for everyone which means, you can't assume that .map is serverside just because everyone sees the object.

addEventHandler("onClientResourceStart", root, 
function () 
createObject ( ... ) --Creates an object when resource starts which means everyone will see this object. 
end ) 
  
  

Also, can you link me to the wiki page that you are reading? If .map is serverside, why is it downloaded?

@Simple01 good point but this leaves me to a thought why would MTA devs make it clientside if serverside would not require any download and is basically the same thing.

Share this post


Link to post
@Saml1er what I was saying was that clientside objects can be seen by everyone because the script is executed for everyone which means, you can't assume that .map is serverside just because everyone sees the object.
addEventHandler("onClientResourceStart", root, 
function () 
createObject ( ... ) --Creates an object when resource starts which means everyone will see this object. 
end ) 
  
  

Also, can you link me to the wiki page that you are reading? If .map is serverside, why is it downloaded?

@Simple01 good point but this leaves me to a thought why would MTA devs make it clientside if serverside would not require any download and is basically the same thing.

Objects created by server cannot be destroyed in client side.

After .map is loaded then run this in client side:

  
for _,v pairs (getElementsByType("object")) do 
destroyElement (v) 
end 

You will see that objects cannot be destroyed because they are not created client side. Also .map is downloaded btw Objects are created client side but in different sense that they are created server side and server side controls them not client side. Basically if object is created client side then it cannot be controlled from server side because it does not exist there. If you work with RakNet library in c++, you will learn how this works. MTA doesn't explain this so majority new programmers don't get this part.

Edited by Guest

Share this post


Link to post

If you start a map, you can see a download bar saying that the map is downloading. Why is that?

Share this post


Link to post
If you start a map, you can see a download bar saying that the map is downloading. Why is that?

.map is not downloaded itself. Only other files like .txd, .dff, music, images etc are downloaded. Objects are created clientside in MGM scripts because it will put stress on server if there are too many arenas.

Share this post


Link to post

I know your concern about the .map files, if you're creating a zillion objects in a .map file it'll download it and I guess that it'll download it for the client and creates them on the client side. Every player that joins, or when a map gets started, downloads these files and this only happens when the client needs access to these files. Server files are only being loaded and never downloaded nor even loaded by the client.

If you're going to think about it, all I can say is; a .map file is downloaded by the client and the objects are created on the client's side. If you want to avoid that, so that clients don't get these files nor get the download bar or something like that, create your own map system. Retrieve the maps from either xml files on the server or a database, spawn them all on the resource start and be done with it.

Share this post


Link to post

I don't even understand anymore. Some say it's clientside, others say it's serverside.

Is there any real documentation about this?

@Saml1er I don't put any stuff other than a .map file and when I start it, the download bar appears. I'm pretty sure it downloads the .map file but simply doesn't use cache since it re-downloads it everytime.

If you don't believe me: http://i.imgur.com/DMSwjbk.jpg

Is creating objects clientside more efficient then doing it serverside? I guess it puts less stress on the server...

Share this post


Link to post
I don't even understand anymore. Some say it's clientside, others say it's serverside.

Is there any real documentation about this?

@Saml1er I don't put any stuff other than a .map file and when I start it, the download bar appears. I'm pretty sure it downloads the .map file but simply doesn't use cache since it re-downloads it everytime.

If you don't believe me: http://i.imgur.com/DMSwjbk.jpg

Is creating objects clientside more efficient then doing it serverside? I guess it puts less stress on the server...

Simple answer: It is equivalent to server side function createObject.

EDIT: You really spinned my head. I will check whether if I see that download bar when using server side scripts.

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.