User Tag List

Results 1 to 6 of 6

Thread: Subchannels and object position in lacewing

  1. #1
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)

    Join Date
    Jan 2015
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Subchannels and object position in lacewing

    Hello everyone!

    I'm making a multiplayer game and I'm stuck. There are two applications, the server and the client. Players can move and see eachother (the movement is server side) but I don't know how should I send objects position and data from the server to all the clients. Should I use blast to channel or blast to client? There are 256 subchannels, does that mean the maximum number of different objects I can make is 256 (because I can't send more)?

  2. #2
    Clicker Fusion 2.5Fusion 2.5+ DLC
    casleziro's Avatar
    Join Date
    Mar 2013
    Location
    United States
    Posts
    679
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    You can send data directly to a client by selecting them via their peer ID. Same for client to server. Then you would check for a message exclusively from the server or exclusively from the client etc. This lets you have 256 subchannels per client.

    And as for your question on blasting/sending: blast position coordinates, and send important data that you need to make sure gets there. Blasting is quick but has a chance to drop packets. Sending is slower but usually makes sure data gets there.

  3. #3
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)

    Join Date
    Jan 2015
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm but for example I have an active called "Object 1" on the server. When I click somewhere in the server it creates an "Object 1" there. So if I have 1 of these objects I blast x and y position on 2 different channels to the client with the all client loop. But what if I have 2 of these objects? (they already have an object ID in the server with a for each loop). Also is there an "Object created" event?

  4. #4
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)

    Join Date
    Jan 2015
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you

  5. #5
    Clicker Fusion 2.5Fusion 2.5+ DLC
    casleziro's Avatar
    Join Date
    Mar 2013
    Location
    United States
    Posts
    679
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    Triple post, because i'm stupid as well as tired and didn't pay attention. I'll delete the other two.

    You want to know how to update each object's position constantly as well as create them, right?

    -Dedicate 1 subchannel (we'll use 0) as the channel that all object creation/repositioning comes from.
    -Define a value, this will be either 0 (create a new object) or 1 (update an existing object)
    -Give each object a unique ID, be they actual players or monsters.
    -Every time you need to update an object, you need to compile all of this together in your stack: Create/Destroy value (as a byte), Unique ID (as a byte, unless you'll be having over 254 unique objects), X position (as a short), Y position (as a short)
    -Update via looping through each object that needs one.

    Now, all you have to do is send data on 1 subchannel. I think your problems are coming from not realizing you can add data to "stacks". This lets you compile whole tables of data to send over, and these stacks can be received on a single subchannel. All you have to do is use the "add data to stack" then "send/blast binary stack".

    When adding values to stacks, they get unique indexes in the table, starting at 0. Bytes take up 1 space. Shorts take up 2. So if you use the stack I posted, the index of each element will be:

    -Creation value (0)
    -Unique ID (1)
    -X position (3)
    -Y position (5)

    Then you simply need to retrieve the element correctly when lacewing sends it on client side:

    Message > Blasted/Sent > On Binary Message From Server > To Me/Channel for receiving, then to actually check each index or set an object to a value from the index, you would use:

    Recieved > Get Binary Data > Byte/Short/etc and input the proper index to retrieve the value.

    So in this example, when you get a message from subchannel 0, you want to compare to the Creation Value (index 0) and see if it's 0 or 1. If it's 0, create an object by using the Unique ID value (1), then set the position with (3) and (5).

    If you get 1, you need to find out which object matches the received ID (1), and once you've found the correct object, you update their position to (3) and (5).

  6. #6
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)

    Join Date
    Jan 2015
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    WOW this is so much easier now that I know these stacks exist thank you!

Similar Threads

  1. Lacewing Blasting position help?
    By BtheDestroyer in forum Fusion 2.5
    Replies: 6
    Last Post: 17th February 2015, 04:59 PM
  2. How to make an object always stay at a position relative to another object when yo...
    By StardustSpeedman in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 2nd June 2012, 01:13 PM
  3. set position of object to position of rotating object
    By Bogeyman in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 18th March 2012, 03:24 PM
  4. Lacewing - get a value subchannels?
    By DJ_Wild in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 30th March 2010, 03:24 AM
  5. On Message subchannels idea
    By Jeff in forum Lacewing
    Replies: 1
    Last Post: 18th September 2008, 06:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •