Oni Central Forum

A forum for the Oni community

You are not logged in.

#1 12/23/16 12:12

killerbladeaex
Member
Registered: 08/13/16

How Can I send a command on Both Sides?

Hi Is there a way i can send a command from host's side that at the same time it will be sent at the client's side for example i wanna send this command chr_giveweapon Intro_Striker_4 w3_phr on both client side and host side at the  same time I tried to do this on the GMD folder and the event of the trigger was "when the striker spawns write this command" in both client and server's GMD and still no luck because the command is only sent from the first guy who is closest to the striker getting spawned is there a better event that can synchronise the command at the same time for example if host writes "doit" in console then both host and client will give "chr_giveweapon Intro_Striker_4 w3_phr" or since "doit" is not a command in original console something else like the command itself if the host writes "chr_giveweapon Intro_Striker_4 w3_phr" then the client writes at his own console at the same time the same thing

Also is there a good command like chr_draw_all_characters but on weapons and items? like chr_draw_all_powerups

Last edited by killerbladeaex (12/24/16 09:12)

Offline

#2 12/24/16 05:12

killerbladeaex
Member
Registered: 08/13/16

Re: How Can I send a command on Both Sides?

Another question can i do that in the source code? for example a code on either client's side or host's side when the code is executed it is transferred to the console of the game like  if(something happens){ConsoleExecute("kick 3");} so if something happens on client side his console will write kick 3 and if something happens on host side his console will write kick 3

The reason i wanna do that is i want certain commands to be sent once someone hosts a game so if host writes command "host" then send the command "chr_draw_all_characters = 1" to his console i know about the event "host" but i don't know about the action "send a command to his console"

Last edited by killerbladeaex (12/24/16 09:12)

Offline

#3 12/24/16 08:12

Scarlett
Member
From: Jamaica
Registered: 11/25/15

Re: How Can I send a command on Both Sides?

Is this for multiplayer?

Offline

#4 12/24/16 09:12

killerbladeaex
Member
Registered: 08/13/16

Re: How Can I send a command on Both Sides?

Yes maybe iritscreen knows he's professional at this maybe he knows something he helped me before

Last edited by killerbladeaex (12/24/16 09:12)

Offline

#5 12/24/16 10:12

Iritscen
Moderator
From: NC, USA
Registered: 10/22/07

Re: How Can I send a command on Both Sides?

I'm pretty sure that Flatline never supported sending BSL events, and my code doesn't either, at least not yet.  In theory, you could send the name of a function and the values of its parameters over the wire, and then each client would hook Oni's scripting system, call whatever parser function is responsible for reading BSL from the dev console, and pass it the text "command(parameters)", whenever the host wanted every client to run a certain BSL command.

I'm not sure if this is actually done in a lot of multiplayer games, however.  I'm pretty sure that the preferred method is for the host to run a gameplay script only on its side, and control the clients according to the script, or for all gameplay rules to simply be hardcoded into each client.  As another alternative, I believe that AlephOne (the fan builds of Marathon) hosts send the whole gameplay script to each client at match start, then the clients run those scripts independently.

You're probably better off using the approach where only the host needs to run a gameplay script, and just sends updates for location, health, etc. to clients based upon what the script does to those clients in the host's world.  That's because no client is in the same exact position on all computers (unless he's been standing still for a while).  So if Host, Client A and Client B are all running a script that causes a mine to explode when a player enters a certain trigger volume, that mine will go off at different times on all three players' computers.  If Client A enters the TV, the mine will generally explode first in his world, followed by Host's world, followed by Client B's world, due to the effects of latency.  That's why it makes sense to keep the host as the sole authority over what happens in the game world.


Check out the Anniversary Edition Seven at ae.oni2.net!

Offline

#6 12/24/16 10:12

killerbladeaex
Member
Registered: 08/13/16

Re: How Can I send a command on Both Sides?

how can i send updates from host to client or how can i send the function's parameters through wire

Offline

#7 12/24/16 11:12

Iritscen
Moderator
From: NC, USA
Registered: 10/22/07

Re: How Can I send a command on Both Sides?

Well to be honest you're not giving me a lot of context here smile  Are you working with Flatline's code?  Because in the first scenario, where the host is the only one running scripts, the host is already sending the necessary updates to clients.  If the host runs its own BSL script for driving gameplay, then when the script changes the health/ammo/whatever of a client, the host will already automatically notify the client of the change.  There's no additional work necessary, as far as I know.

As far as sending the function's parameters, you'd have to translate the numbers into character data for network transmission.  Flatline already does this for lots of other numbers such as HP and XYZ location, so you can learn from how Gumby did it.  String parameters are just strings and need no conversion.  But it will probably take a fair amount of work to add that kind of feature to Flatline, since you not only have to hook the BSL parser in a way that allows the client to send it function calls that the host sent to the client, you also have to be able to *understand* the function calls on the client side when they come in.

For instance, how do you know if you are receiving a function parameter of type float, or int, or string?  This probably requires a "type code" which announces the type of data in advance of each parameter value.  Or you could build a table of all functions' parameter types, and when you see a function come in called "GiveAmmo()", you look it up in the table, and this tells you that the first parameter received will be an int and the second will be a string (for instance).  Personally I can't really recommend this path, or spend a lot of time supporting this endeavor.  My time is best spent on improving my own multiplayer project, Zukai, and porting it over to Windows.


Check out the Anniversary Edition Seven at ae.oni2.net!

Offline

#8 12/24/16 13:12

killerbladeaex
Member
Registered: 08/13/16

Re: How Can I send a command on Both Sides?

I have no problem with host being the only one running the scripts but how do i do that if i delete the scripts from the client side then host will not automatically send the information to the client side

Offline

#9 12/24/16 14:12

Iritscen
Moderator
From: NC, USA
Registered: 10/22/07

Re: How Can I send a command on Both Sides?

You have to rely on the effects of the scripts being sent over the wire.  See the first paragraph again in my previous post.


Check out the Anniversary Edition Seven at ae.oni2.net!

Offline

#10 12/24/16 14:12

killerbladeaex
Member
Registered: 08/13/16

Re: How Can I send a command on Both Sides?

I don't think there are scripts sent over the wire without being sent in the source code if you had this problem how would you solve it you want the host to write in his console chr_draw_all_characters = 1 automatically when he uses the command "host"

Last edited by killerbladeaex (12/24/16 14:12)

Offline

#11 12/24/16 15:12

Iritscen
Moderator
From: NC, USA
Registered: 10/22/07

Re: How Can I send a command on Both Sides?

It sounds like what you're asking right now doesn't have to do with multiplayer.  You can make a global script (a .bsl file placed inside IGMD\global\) which defines a function called "host", such as:

func host
{
   chr_draw_all_characters = 1
}

Then you would be able to call that function from the dev console.  See the wiki's global page for more detail.


Check out the Anniversary Edition Seven at ae.oni2.net!

Offline

#12 12/25/16 03:12

killerbladeaex
Member
Registered: 08/13/16

Re: How Can I send a command on Both Sides?

nice thanks , but i want to do the same thing when the client successfully connects to the host not when writing "host" my mistake, how do i call that function for both sides?

Last edited by killerbladeaex (12/25/16 03:12)

Offline

#13 12/25/16 10:12

Iritscen
Moderator
From: NC, USA
Registered: 10/22/07

Re: How Can I send a command on Both Sides?

There's no built-in way, so you would have to add code to Flatline to make that happen.


Check out the Anniversary Edition Seven at ae.oni2.net!

Offline

#14 12/25/16 12:12

Scarlett
Member
From: Jamaica
Registered: 11/25/15

Re: How Can I send a command on Both Sides?

Is it possible to just create Oni multiplayer with unity or unreal engine? but then again you will need to add all animations, levels, characters, audios, etc. with better graphics and some of the levels or new levels

Last edited by Scarlett (12/25/16 12:12)

Offline

#15 12/25/16 12:12

Iritscen
Moderator
From: NC, USA
Registered: 10/22/07

Re: How Can I send a command on Both Sides?

It's been suggested many times, but personally I don't think it's worth the effort to recreate the gameplay and feel of Oni in another engine.


Check out the Anniversary Edition Seven at ae.oni2.net!

Offline

#16 12/25/16 12:12

Scarlett
Member
From: Jamaica
Registered: 11/25/15

Re: How Can I send a command on Both Sides?

I understand but if I'm in if anyone is up for it. It is like going from halo 1 to halo 3

Last edited by Scarlett (12/25/16 12:12)

Offline

#17 12/26/16 08:12

killerbladeaex
Member
Registered: 08/13/16

Re: How Can I send a command on Both Sides?

Iritscen wrote:

There's no built-in way, so you would have to add code to Flatline to make that happen.

ok thanks what's the code for doing the command when the client successfully connects i know the event of successfully connects but the problem is the host never connects to anyone it's the client who connects therefore how can i activate something on host's side if the event is started from the client's side

Last edited by killerbladeaex (12/26/16 08:12)

Offline

#18 12/26/16 11:12

Iritscen
Moderator
From: NC, USA
Registered: 10/22/07

Re: How Can I send a command on Both Sides?

Well, it's a two-way communication, even if the client initiates it.  So the host ought to be sending something back as part of an initial handshake.  I 'm not sure, since I'm not very familiar with the code.  But even if the host doesn't initially send back anything, he's constantly sending updates to the client after the client connects, right?  So if you are asking how to send a BSL command to a client at match start, it can simply be done whenever the host sends his first packet back to the client after the client connects.


Check out the Anniversary Edition Seven at ae.oni2.net!

Offline

#19 12/27/16 11:12

killerbladeaex
Member
Registered: 08/13/16

Re: How Can I send a command on Both Sides?

ok but what's the code i need to put in supposedly i found the first update packet? as previously you said i need to put in a code to flatline to make it happen

Offline

#20 12/27/16 17:12

Iritscen
Moderator
From: NC, USA
Registered: 10/22/07

Re: How Can I send a command on Both Sides?

I'm talking about source code; you would need to add some code to Flatline.  You said before that you know how to program.  If you actually don't, then this thread has just been a massive waste of time.


Check out the Anniversary Edition Seven at ae.oni2.net!

Offline

#21 12/29/16 00:12

killerbladeaex
Member
Registered: 08/13/16

Re: How Can I send a command on Both Sides?

i know its the source code but there is no possible way you said to put in a source code that will send a command to the console of the host   when the host sends his first packet so how am i gonna do it

Last edited by killerbladeaex (12/29/16 04:12)

Offline

#22 12/29/16 09:12

Iritscen
Moderator
From: NC, USA
Registered: 10/22/07

Re: How Can I send a command on Both Sides?

Anything's possible.  My Zukai code already hooks the BSL system in order to run some commands locally when the match starts, such as "ui_suppress_prompt=1".  It also sends handshake packets to clients at match start which contain data like player names, ping measurements, and other initial information.  So it would be easy for me to combine these things and add a type of data to those packets which contained BSL commands for clients to run.  Flatline may not have either of those things, so you would have to add them.  Personally, I'm not sure it's worth the time, though.


Check out the Anniversary Edition Seven at ae.oni2.net!

Offline

Board footer

Powered by FluxBB