Modding Q&A [For Quick Questions and Answers]

正在查看此主题的用户

状态
不接受进一步回复。
Vornne 说:
DOMA_ 说:
  (multiplayer_send_3_int_to_server, multiplayer_event_prop_instance_animating, ":instance_no", pos3, 200),
You can't do this: pos3 is simply a fancy name for 3 (as you can see in header_common.py), so this will just send the instance id, 3, and 200 to the server (which is useless because the position registers are not syncronised). To send positions to the server you need to extract the various numbers converted to fixed point and send them separately, which means loss of precision and packed or multiple messages.

However, you are going about it in the wrong way: you shouldn't be doing position and distance checks on the client, as people could just mod the checks right out and the server wouldn't do anything about it. Instead you should send "input" messages from the client to the server, and then do all the checks on the server; though the code can sometimes be optimised further by running some checks on both the client and the server, so if a player is bashing a key to activate something when far out of range, the client doesn't spam the server with messages that might make it waste time with expensive checks. Bonus points if you share the same scripts for server and client checks.

Would you give me more hints..?

I don't fully understand a server side and a client side,, I just know that 'sth' are divided into a server side and a  client side, but actually I don't know 'what' is seperated, and what should I consider.

Anyway, are you saying that I should combine many things, then 'server' get them and calculate them as a server side..? Now what I don't know exactly is 'what' I should make server calculate..
 
MadocComadrin 说:
When a player selects a troop/equipment, a network message is sent. So check that message and mimic what it does in the url_response script (You want to assign gear based on data from a database right?).

As for weapon proficiencies and the rest, they're set via troops, ie. you can't set them per agent. If you want to set them per player, you're going to have to get creative. If the cRPG source is still open, look there.

Thanks :smile:

I'm already reading and writing equipment data to and from my database but I wanted to separate the selections a little bit and I thought doing it by class would be easiest.  I think I know exactly which network message you're referring to so thanks for that hint there.

I tried getting the old crpg souce but the link is no longer working :sad:  Anyone have a copy of it by chance?   
 
DOMA_ 说:
I don't fully understand a server side and a client side,, I just know that 'sth' are divided into a server side and a  client side, but actually I don't know 'what' is seperated, and what should I consider.

Anyway, are you saying that I should combine many things, then 'server' get them and calculate them as a server side..? Now what I don't know exactly is 'what' I should make server calculate..
"Server side" and "client side" just means code that runs on the server and client respectively; since the same module system is loaded for the player clients and the dedicated server, you use the (multiplayer_is_server) operation to stop code from running on the client, and use (neg|multiplayer_is_server) to only run it on the client; though in some cases it isn't necessary, like after a key_pressed operation - since that will never be true on a server.

To be more plain: I would combine all the triggers you listed into one, having it start with:
插入代码块:
(this_or_next|key_clicked, key_up),
(this_or_next|key_clicked, key_down),
(this_or_next|key_clicked, key_left),
(this_or_next|key_clicked, key_right),
then check the distance to the scene prop is close enough (only as a check to avoid sending the server unnecessary messages), then something like this:
插入代码块:
(try_begin),
  (key_clicked, key_up),
  (assign, ":movement", 1),
(else_try),
  (key_clicked, key_down),
  (assign, ":movement", 2),
(else_try),
  ...
And then send ":movement" in a network message to the server, which does another distance check from the sender player's agent to the scene prop, then moves it according to the movement parameter (which could be any range of numbers, I just used 1 and 2 as examples).
 
Vornne 说:
DOMA_ 说:
I don't fully understand a server side and a client side,, I just know that 'sth' are divided into a server side and a  client side, but actually I don't know 'what' is seperated, and what should I consider.

Anyway, are you saying that I should combine many things, then 'server' get them and calculate them as a server side..? Now what I don't know exactly is 'what' I should make server calculate..
"Server side" and "client side" just means code that runs on the server and client respectively; since the same module system is loaded for the player clients and the dedicated server, you use the (multiplayer_is_server) operation to stop code from running on the client, and use (neg|multiplayer_is_server) to only run it on the client; though in some cases it isn't necessary, like after a key_pressed operation - since that will never be true on a server.

To be more plain: I would combine all the triggers you listed into one, having it start with:
插入代码块:
(this_or_next|key_clicked, key_up),
(this_or_next|key_clicked, key_down),
(this_or_next|key_clicked, key_left),
(this_or_next|key_clicked, key_right),
then check the distance to the scene prop is close enough (only as a check to avoid sending the server unnecessary messages), then something like this:
插入代码块:
(try_begin),
  (key_clicked, key_up),
  (assign, ":movement", 1),
(else_try),
  (key_clicked, key_down),
  (assign, ":movement", 2),
(else_try),
  ...
And then send ":movement" in a network message to the server, which does another distance check from the sender player's agent to the scene prop, then moves it according to the movement parameter (which could be any range of numbers, I just used 1 and 2 as examples).


Wow. Thx..! It really helps me.

And. another noob question. What is different from '(multiplayer_is_server) ' and 'sending messages to server side' ? It looks simillar that they calculate sth on a server side (am I right?). Or, do I misunderstand them?
 
DOMA_ 说:
And. another noob question. What is different from '(multiplayer_is_server) ' and 'sending messages to server side' ? It looks simillar that they calculate sth on a server side (am I right?). Or, do I misunderstand them?
Those two things are totally unrelated: multiplayer_is_server is simply an operation that always succeeds on a server, and fails on a client unless it is also hosting a server (from "Host a Game"). You could think of it as "(only_continue_in_this_block_if_this_is_a_server)".

If you are trying to test your mod with a client hosted server, I strongly suggest you forget about that and use a proper dedicated server executable separate from the client - there are many traps for the unwary when using client hosted servers to test.
 
Vornne 说:
DOMA_ 说:
And. another noob question. What is different from '(multiplayer_is_server) ' and 'sending messages to server side' ? It looks simillar that they calculate sth on a server side (am I right?). Or, do I misunderstand them?
Those two things are totally unrelated: multiplayer_is_server is simply an operation that always succeeds on a server, and fails on a client unless it is also hosting a server (from "Host a Game"). You could think of it as "(only_continue_in_this_block_if_this_is_a_server)".

If you are trying to test your mod with a client hosted server, I strongly suggest you forget about that and use a proper dedicated server executable separate from the client - there are many traps for the unwary when using client hosted servers to test.

Oh, Now I get it.

and yes, I am testing it on a dedicated server.

Thx a lot. You always help poor people :grin: ! what a good man.

oh, sry, but the last question: It seems 'props' work differently from other things, cuz when I just apply '(play_sound) or other things' to props, they just work. But other things (agent sound or so..) don't work, and they need 'send to server things'. What makes them different..?
 
Vornne 说:
插入代码块:
(this_or_next|key_clicked, key_up),
(this_or_next|key_clicked, key_down),
(this_or_next|key_clicked, key_left),
(this_or_next|key_clicked, key_right),
Oops, just noticed a mistake: the last line shouldn't have "this_or_next|" or it will involve the next line in the test.
DOMA_ 说:
oh, sry, but the last question: It seems 'props' work differently from other things, cuz when I just apply '(play_sound) or other things' to props, they just work. But other things (agent sound or so..) don't work, and they need 'send to server things'. What makes them different..?
Strangely enough, you seem to have got it backwards: agent_play_sound does work on clients if it is run on the server, but scene props don't have an operation to play sounds. Or do you mean adding a looping sound in the ti_on_scene_prop_init trigger? That's because the same trigger is run on server and client, so each client starts the sound loop whenever it loads the scene prop.
 
Vornne 说:
Vornne 说:
插入代码块:
(this_or_next|key_clicked, key_up),
(this_or_next|key_clicked, key_down),
(this_or_next|key_clicked, key_left),
(this_or_next|key_clicked, key_right),
Oops, just noticed a mistake: the last line shouldn't have "this_or_next|" or it will involve the next line in the test.
DOMA_ 说:
oh, sry, but the last question: It seems 'props' work differently from other things, cuz when I just apply '(play_sound) or other things' to props, they just work. But other things (agent sound or so..) don't work, and they need 'send to server things'. What makes them different..?
Strangely enough, you seem to have got it backwards: agent_play_sound does work on clients if it is run on the server, but scene props don't have an operation to play sounds. Or do you mean adding a looping sound in the ti_on_scene_prop_init trigger? That's because the same trigger is run on server and client, so each client starts the sound loop whenever it loads the scene prop.

Um. Yeh I think ti_sth caused what I said. For example, ti_on_scene_prop_hit and ti_on_scene_prop_destroy, I can hear sounds that props make though I just applied 'play_sound'(and so other ppl do ). I think it is because of 'ti_things' as what you said..
 
Just a quick question, Ctrl+E on the map to show the coordinates?  Do they appear at 0,0?  (Or around there?)
 
Crazy-Q 说:
Just a quick question, Ctrl+E on the map to show the coordinates?  Do they appear at 0,0?  (Or around there?)

It just tells you the coords of your party. I think they appear near the compass...
 
Struggling to find the animation frames for the agent when standing back up [IE, after being flung from the horse due to steed death]. Mebbe I'm just being dense today.

Nevermind, found it after a shower.  :razz:
 
状态
不接受进一步回复。
后退
顶部 底部