Soulmachine's Recent Forum Activity

  • Hello

    I need to have access to a specific objects instance variable when it's put in a Family. But I do not manage to do it.

    My problem is like this:

    I have two different sprite objects ( it's a bot and a human player ) and have put them in a Family.

    The objects has an individual instance variable called (Team).

    I need to have access to this variable to determine which team a bot/player is in. I need this so the bots does not attack a bot/player from same team.

    I've managed to select the two different objects individually by identify them by their .UID... So I can perform operations on objects independently, for example a bot attacking another bot OR player, even though they are different sprite-objects.

    But I need determine on which team a bot/player is in. I need to be able to access the sprite-objects instance variable somehow?

    You should know I'm making a Multi-player game. And I have human-players connected on the network and then I have bots.

    I have two teams. Blue and Purple.

    I could not use the Peer-object ( the human players object ) for the bots. Cause in multi-player it needs to be associated with a connected peer. So I had to create another separate sprite-object for the bots.

    I needed the bots be able to target both the other teams human players and the other teams bots.

    I make this happen by using the turret-behaviour. Cause then I can get the objects UID that a certain bot has targeted.

    This way I can make a Function and perform things to that object - and with the Family option in Construct I can do things in-spite they are different objects.

    I cannot have the turret behaviour do everything automatically - cause I have an intricate Finite State Machine working as the AI for the bots. And in certain situations the turret behaviour just don't work.

    I know I can use the the turret behaviour it self and add objects to the turret ( Add object to target ). But I can not do this in this situation cause it's very specific conditions and other things in play on how the bots attack ( the enemy )

    And it would not work anyway - cause how would the turret know which team he is firing on?

    Perhaps I could do something when a bot or player gets created and add that to the turrets targets - but... don't know.

    Or make an Array with a teams enemy-players and -bots that contains their UID and SelectedTeam.

    ...It would be much easier if I just could access the objects instance variable: Team

    Anyhow, thanks for reading this far At least I got to evaluate my problem even further when writing this topic.

    Thanks!

  • Thanks for the reply oosyrag

    I've done similar to what you explain and the Host is controlling all that the bots do. And I also thought similar to you with the boolean "Bot" active on my bots. It worked very nice for only the Host, but not the clients.

    ...I did not manage to use the Peer-object for the bots, cause the clients could only see them if the Peer-object got a real Multiplayer.MyID ( even though all Peer.Objects are synced )

    The reason I wanted to use the Peer-objects is that then I did not have to recreate a new object and insert all instance variables (again) and so on. If I have the Peer-object and a separate Bot-Object I have to make multiple events in a lot of places, first checking something with the Peer and then checking something with the Bot.

    I decided to make a dedicated Bot-object and have been moving forward quite a bit. I got it to work pretty ok and managed to keep things relatively comprehensible.

    I'm not sure if it is possible to use the Peer-object if it's not associated with a real Multiplayer.MyID ( a connected client ) ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello

    I was wondering if it's possible to use the Peer-Object when creating bots in your multi-player game?

    Or is it better to create a stand alone object dedicated for bots?

    I've been experimenting a little with this, and everything looks fine for the host but not for the other connected peers.

    I think that the peers cannot see another peer if it has not been properly associated with a Multiplayer.PeerID

    ...It must be another connected multiplayer, I think??

    It would have been great if there was a way to use the Peer-Object for bots because of the programming is already finished for the peers.

  • Yes it is pretty good

    I'm working on my real app right now and I think I got a good result both on the Computer and touch-devices.

    ...Using the "wallclocktime" seems to work the best.

  • Soulmachine be so nice 2 test this 4 me ?

    https://www.dropbox.com/s/jva90n2bq76qt ... .capx?dl=0

    Hello!

    Interesting capx <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    I did some testing, but only on my computer, in the Chrome webbrowser. Forgot my phone at my neighbour. I can test on it also later if you want?

    -

    I've been thinking and I think if I round my value to the nearest 10th I can get a pretty good result.

  • I see that you talk about milliseconds.

    So ... Also .. C2 works as a sorta kinda sampling machine.

    At a steady 50 FPS the events run 50 times a second.

    Then the 'measuring' happens every 0.02 seconds. Or, you have a random uncertainty between zero and 0.04 seconds.

    At a steady 25 FPS (never happens, dt is always dancing) this is already 0.08 seconds.

    That means nothing in normal circumstances. It does when you want exact measuring, in milliseconds. I think it is impossible to compare devices in that 'quantised' range.

    It's a bit sensitive with beats and music, cause there's a big difference between lets say 0.5s and 0.51s ( 0.5s = 500ms ) (0.51s = 510ms)

    So 0.5s is 120 beats per minute

    ...and 0.51 is 117.64 beats per minute

    so its a big difference that is very audible (noticeable) when it comes to music

  • Hi, thanks for the responses

    Overall it seems to me that the small latency that always is when you use a touch screen is in play somehow.

    Interesting capx you've sent me

    I've tested it on my computer and on my iPhone - and I get different times depending on witch one I use

    PC -TEST

    iPhone - TEST

    I edited your capx a little so I could read the text on my iPhone and I added so you can see the FPS too. http://www.lindsjael.se/soulgames/TapABeat%202.capx

    If anyone would like to also try and see what they get as a result - feel free... I think about 16 taps is good enough for a test. I used a metronome at 120 BPM that I listened to while I tapped - so I could get as consistent readings as possible. Here's a free on-line metronome https://www.starsandcatz.com.au/metronome/

    I tested a couple of times to get into the beat.

    You used the "On tap gesture" that's different from my own tests. I've used "Touching object" or "Is in touch" or "Touch start". I've also tried "On tap object"

    It was interesting with the "On tap gesture"... If I tapped at 120 BPM I only got a tap registered every other tap. So My time between taps are about 1s.

    But if I tapped much slower, like 60 BPM . Every tap got registered? ...thats also 1s between taps.

    If all taps are registered at 120 BPM the time should be around 0.5s.

    I felt it got a little bit more consistent... or should I say less random. Where I got fairly same readings when I used my iPhone ( a touch device ). However the time differs from the Computer readings.

    I looked at the FPS and it stayed between 45-60 all the time.

    I've been thinking of what's the best way to measure the time. I've both tried using delta time and the system expression time.

    Interesting suggestion about the wallclocktime 99Instances2Go I will try it out.

    lamar

    On my own testing I've both used the measurement cleanly as it is ... and used Round. And rounded it up to nearest 0.1 (tenth)

    I get better results rounding I think.

  • Hello!

    I'm measuring the time between taps ( touches ) when I'm making a Bpm-tap function. Bpm = Beats Per Minute, like you use for tempo in music.

    But I'm getting inconsistent results on touch-devices. However it works very nice on a computer, using a mouse.

    I'm wondering if I missed an important mechanic with the Touch-plugin or something that causes problems?

    The main thing I'm interested in is: What's the best way to measure time between two taps in Construct 2?

    My function works like this:

    When the user touches/tap/click a sprite I measure the time between taps.

    I also count each tap so I can calculate an Average value.

    To calculate the BPM I only need a time... for-example 0.5s or 500ms is a Quarternote at 120 BPM.

    I have tried several of the touch-conditions but the one that seem to work best is "Is touching object" or "Is in touch"

    I use this condition followed by a "Trigger once"

    The result is great if I try the app in my computers web browser.

    I have two BPM-values... First the value calculated with the time between the last two taps. Secondly the BPM calculated from an average from all the taps made.

    On a touch-device... I have tested on an iPhone 4S and also on an android-system: Samsung S3. I also did some testing on a Sony, don't remember the model.

    I seem to get the same results from all of them - where the end result is that they give me a BPM-value 1-2 bpms higher than on the computer.

    It seems like overall the measured time between taps is getting a bit higher than on the computer.

    So both my BPM-values the (real) one and the (average) one... gets misleading values.

    I wont get into more details, for now, unless someone asks for more.

  • Sorry, I'll explain a little better.

    In this particular case I have a situation with several players in a multiplayer game.

    One issue with the animations is for example when a player walk ( or move ). Then the player have a walking animation... So if a player walks and other players see that player they all need to see the animation of the legs.

    ...So, when a player walks, I want to start the walking-animation, and when the player stops, I want to stop the animation. And all the other player's needs to see this. Not only the host - and the Peer (client) that is currently walking.

    In short - all the clients needs to know when a player is moving - and if they do, they need to know to start that players walking animation.

  • I see...

    Hmm thats ALOT of "orders" to send and lot of programming. I did this a while ago in another game. The bright side is that if It's set it up well and once it's set up it's pretty easy to send such info to the clients.

    These animations I have in mind for this game has to be changed for all the clients at the same time. It is things like when another player move, they need to see the animation for the legs, and so on...

    I guess I'm kind of forced to do this anyway since it does not work for the clients if I mess with animations in the Common-group.

  • Hello!

    What's the best way to:

    start stop

    change

    ...Animations in a multiplayer game?

    I always start from the multiplayer-template and I use the Groups created for you in that template.

    Should I try to do this in the Common-group or should I do it in the Host-group and send "orders" to the Peer-group so that the peer's also do the animation-changes?

    What's the best way to do it?

  • Ok, thanks...

    Then this is my problem.

    Yep That's pretty much what I did.

    I called a function and sent the local variable as a parameter - the function got 0

Soulmachine's avatar

Soulmachine

Member since 27 Oct, 2013

None one is following Soulmachine yet!

Connect with Soulmachine

Trophy Case

  • 11-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

13/44
How to earn trophies