lennaert's Recent Forum Activity

  • You do not have permission to view this post

  • Are the UIDs ? the same ? I think not, you will require an ID thats the same on both ends.

    Several approaches:

    1. easy

    loop through your trees in a specific order, on both host and peer, during the loop, have the trees set an a variable, TreeID (number)

    This requires the loop method to be identical to get the same numbering on both ends.

    2. hard.

    -Destroy all trees on peer.

    -host loops through Trees, adding an ID, or reusing the UID to set a new ID

    Each tree gets broadcasted, wit X, Y, size, angle in 1 message per tree during game start; just once.

    -peers received the info during game start up and generate all the trees broadcasted by the host.

    After one of these, you can apply the mechanic from the previous post.

  • Here's a bit of a different thought of approach.

    Currently, with what you are attempting, there is a potential high bandwidth usage, with you trying to tell another player, at high interval, that something (a tree) is somewhere, and you will be trying to communicate regularly (sync) where its position and what its angle is.

    By any means, this is most inefficient.

    The tree wont move (at least, thats my expectation of a tree) so, telling other players its angle and position continuously is not helping aiding the mechanic of the game.

    You could try and have some a variable synced, telling the other player the state of the tree ... but this too .. is .. still too much. As it would continously check if some state has changed, and inform the other player.

    My apporach would be:

    If the map has been made in advance (on the layout editor), on both the host and the peer, then both the host and the peer already know where this static object is, the tree.

    Requiring the destruction of the tree on both ends, would only require 1 side, telling the other side, that a certain tree has been destroyed.

    Now, in actions and conditions: if I destroy a tree, send a message to the other player, containing ID of said tree, in a message indicating it has been destroyed on my end. In response, the other player receives the messages, and aptly destroys the same object.

    player

    Send message "destroytree" message "xxx" (some ID) to other player.

    other player

    on received message, "destroytree" , pick tree with id of lastmessage, destroy tree

    That just about sums it up for relaying the sate of a static object, with just 1 message, instead of a synced object, greatly reducing bandwidth/overhead.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • From the manual:

    ImageWidth

    ImageHeight

    The original dimensions of the object (its current animation frame image size), in pixels. Since objects can be stretched at runtime causing the normal Width and Height expressions to return different values, these can be used to get the original size regardless of the stretched size.

    Its a matter of approach.

    perhaps, give the Templates a variable, "SelectedScale" (number)

    When sliding the slider scale, set the value of the Templates.SelectedScale, followed by setting that value in the Templates scale propperties.

    When selected the image to edit, grab their SelectedScale and set in the slider.

  • I am guessing the SelectAns.Y should be AnswerBox.Y

  • after adding header = "Content-Type" and value = "application/json" is actually working. and error "400Bad Request" is showing because server avoiding any duplicate entry. So I change data and then its submitting successfully.

    Fantastic !!

    Good luck

  • I use these two lines at the top of php pages to circumvent the cross origin policies:

    header("Access-Control-Allow-Origin: *");

    header("Access-Control-Allow-Headers: *");

  • I use arrays to store variables for settings and such, and save that array to local storage asjason.

    Perhaps that's an approach that could work for you.

  • lennaert

    I added header = "Content-Type", value = "application/json"then I got error "400Bad Request"

    "400 Bad Request

    The HyperText Transfer Protocol (HTTP) 400 Bad Request response status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error (for example, malformed request syntax, invalid request message framing, or deceptive request routing)."

    Going by this, you likely have an error in the format of your request (how its build up) Compare the output string with a working example.

    IF you test in a browser, with the browser development tools you can check the content of your actual request.

    When you have the app running, (in chrome) press ctr + shift + j, select network tab. Below should be a list or a link which performed the attempted request. When you click it, the tabs next to it have all sorts of info, from the actual headers to the content of your request.

  • Proof of success *Cheers

    https://i.gyazo.com/fe5e9679bf5b2b650e1ea8ea5d906342.mp4

    Very nice !!

    Looking good there AquarianDoll :D

  • Family objects Also have a UID (Templates.UID)

    Suggestion:

    Give that "text" an instance variable: ToDelete (number)

    Below set Text action, add:

    set value ToDelete = Templates.UID

    add a condition to that delete:

    Famlity Templates >> pick by UID (Text.ToDelete)

    Action Templates destroy

    This will leave your object name mechanic intact and add functionality to delete the template based on it's unique ID.

lennaert's avatar

lennaert

Early Adopter

Member since 8 Oct, 2013

Twitter
lennaert has 13 followers

Connect with lennaert

Trophy Case

  • 11-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • x5
    Popular Game One of your games has over 1,000 players
  • Famous Game One of your games has over 10,000 players
  • x2
    Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • Enduring Visitor Visited Construct.net 90 days in a row
  • RTFM Read the fabulous manual
  • x2
    Great Comment One of your comments gets 3 upvotes
  • Delicious Comment One of your comments gets 10 upvotes
  • Email Verified

Progress

25/44
How to earn trophies