Soulmachine's Recent Forum Activity

  • I understand...

    So you think it's better to dedicate a whole group for mouse or touch? Yes that may solve it perhaps. I will try it out.

    At the moment I have mouse/touch detection at the first layout and I set a variable "Mouse" or "Touch" - that I use to distinguish between the two.

  • I have a bug/issue in my game - that I'm having troubles to sort out.

    My game rely on the coordinates for the Mouse or Touch - but their mechanics are a bit different.

    I have a 2 player realtime multiplayer game - and I've used the Multiplayer - Real-time game, Example in Construct as a template when I created my game.

    It works basically like this:

    When it's a players turn, they supposed to throw something. They aim by clicking and holding down mouse-button and drags in a direction. When they let go of the mouse-button they throw their object.

    What happens are that a small cross (sprite) gets positioned where the mouse clicked, then a line (sprite) gets positioned at the same position - and the line.angle gets pointed towards the Mouse.X & Mouse.Y ..The line.width also get set, and it's the distance between where the mouse clicked, and where the Mouse.X & Mouse.Y are. If the player are on a touch-device it's the Touch.X & Touch.Y instead of the Mouse.X and Mouse.Y

    When the player release mouse-button OR stop touching the touch-device: an object gets thrown. The object gets thrown in a direction and uses the line.angle for that, and the force to throw the object it uses the width of the line.

    So the angle and the width are very important for this to work.

    This works very nice, both for Player 1 (the host) and Player 2 (the peer) but NOT if Player 2 are on a Touch-Device?

    However it works on a touch-device if you Host the game ( you are the Player 1). But it does not work if the touch-device are the Peer ( Player 2 ).

    My problem - when I've researched this is that the way the Mouse-mechanics vs the Touch-mechanics works is that: On a Mouse button released - the mouse-cursor ( the Mouse.X and Mouse.Y ) are at the same place ...just where you released the mouse-button.

    But on a touch device: On touch end the Touch.X and Touch.Y get's set to Touch.X = 0 Touch.Y = 0

    This is a problem for me in my game, as I use the angle of my line for the direction to throw my object. And I use the width of the line as a Force to throw the object.

    If the Touch.X & Y gets set to 0,0 before I may throw my object, it's not good.

    I believe it may have to do with an multiplayer on client update issue.

    The Peer manages to set the Touch.X & Y back to 0,0 before construct can perform the actions for throwing the object.

    As the line.width and line.angle uses the Touch.X & Y coordinates ...This phenomenon really screws things up.

    As the multiplayer example, I use lookx and looky input values for the Mouse.X & Y. And I've done the same, but created other input-value-tags, for the Touch.X & Y

    I use the Common group, as in the multiplayer example, to perform my actions when the input-bit are set to 1 or 0. ( In the example you fire your laser )

    It have been easier, and worked so good but I may have to do this somehow in the Host group - cause I may feel construct will not be able to sync stuff correctly. But it will be much more troublesome to sort all the things out that needs to be done. For example I have things that needs to get flipped and mirrored, depending on if you are the Host or Peer ( Player 1 or 2 ). Also I need to use the pin behaviour. And some more stuff, that's hard to make work for the peer unless you broadcast multiplayer-messages from the Host to the Peer. And this gets very disorderly so quickly, I rather avoid it.

    Has anyone had similar issues like this or having idea´s on how to do this in a better way?

    Thanks a Million!

  • It worked...

    I couldn't open your capx, cause it was Construct release 208 and I'm currently on 206. I downloaded the 208 and in the meanwhile, while I waited for the download, I tried to solve the problem with your info in your reply. And I got it to work, both for the Host and Peer... This is GREAT thanks.

    ...was a bit tricky as the host and peer update their values a bit different. I got the peer to work instantly, but had to tweak some more with the host.

    Now all I have to do is finish the rest, and actually put in what's gonna happen after they aimed... It's tricky with multiplayer to do stuff, but the more I work on it, the more I'm getting the hang of it. This is my third multiplayer game, and I'm still having problems and getting confused.

  • Thanks Lennaert.

    I will research this you've sent me, and see if I can use it. It looks promising.

  • Hello Lennaert, thanks for the reply

    The problem gets tricky this way, cause in my game I need to do things separately on certain conditions with the inputs.

    I'll try explain...

    I have a player that are going to aim something. The way he do it is that he click and hold down the mouse and then drags in a direction.

    What the player see, is a small cross where the mouse-pointer was when he first clicked. ... then he still holds down the mouse and drag in a direction. Then he see a line between the cross, and where he now has his mouse pointer. ... it's kind of drawing a bow and aiming.

    So when I did this game as a single player at first. I used 3 conditions.

    * On Left button clicked - I created the cross, and a line, at the mouse pointer position, and saved the coordinates in a variable.

    * Left button is down - I use the distance to set the width on the aiming-line and also sets the angle pointing towards the cross ( coordinates )

    * Left button is released - the projectile gets shot away.

  • Hello!

    How do I use "On Left button released" in multiplayer - for the peer inputs?

    I use the Example for the Multiplayer - real-time game in construct as a starting point when I do my multiplayer games.

    In the Peer-Group where the peer send it's inputs to the host, there is an "On client update" and "peerid = Multiplayer.MyID" - condition. Then below that there's the sub-events that test the condition for an input. For example: Mouse - Left button is down... or Keyboard - Left arrow is down... and so on.

    However I can not choose "On Left button released".

    I'm allowed to choose it though in the Hosts Group.

    I know it's about the way constructs events work and why I'm not allowed as the event-sheet are set up this way in the example. But I would like to know if there's a workaround somehow to be able to use the input-condition "On Left button released"? Should I perhaps try to do it in the common group?

    The only thing I can think of at the moment - to be able to still have something in the inputs in the Peer-Group - is to design some kind of boolean-variable that get set as soon the mouse button is down, and then resets when the button is not. ... And use that somehow.

  • I apologize for my not so crystal clearness, but I'm stuck and do need some pointers to a direction where I can learn more and get un-stuck.

    I've read and done the Multiplayer tuts backwards and forwards, especially the real-time tutorial. Even though I do not completely understand it to 100% - I understand most of what the events do but not always WHY it needs to be set the way it is.

    I've used the multiplayer-real-time tut way of constructing a game and I've come pretty far with my game. The problem is... I can do all the functions and things I want the game to have if it were a single player game, but now I can not work out how I should place these functions.

    I've managed just the basics so far... to make the players move with direction animations. To be able to shoot using a Finite State Machine. To explode when they die. To change the speed in different wind-conditions. I made the controls for both mouse-control the player-objects, and to control on a touch-device. And some other things so I have the basics for the players like, move/turn, shoot, kill, get killed.

    I have lot's of needs but I'm not sure the best way to implement them, or if it's even possible?

      I need to make the players spawn at different spawn-places. Using sprites for players to spawn on. I need to make the player invisible when they die cause there is spawning an explosion on top of them. I would like to have some things fade in or out. Some things to flash some things to get pinned to other objects I would like some objects and information be showing for the peers but dont be forced to sync them I would like to use the behaviour timer for objects. I want a fast network-multiplayer-game and do not waste bandwidth if I can avoid it.

    This game is meant to be able to have up to 10 players at the same time. So to avoid game lagging is a priority.

    I need pointers to work out how to know where to put events in the right places. How should I think and can anyone help me to places or tutorials where I can get the information? What's the approach of thinking here?

    What is possible to do in the HOST group and what is not? So it will show not only on the host but with the peers also.

      I know I can move my player (peer) to different positions. I can set the peers variables I can change arrays I can test if things are overlapping or collisions. I can make the peer see a variable if I synced it. I seem to NOT be able to... set a sprite invisible use many of the behaviours like flash or pin to. Set animation frames so the peer can see set the animation

    I get crazy

    I can't figure out the route... the pathway to think - if I want a function in the game.

    It feels like all I do in the host group - the peers can not see.

    If I for example want the peer to see a change of a sprites animation I need to like set a variable at the Host-Group then at the Common-Group make the peer change the animation. Or make an input in the peer-group

    It's completely mind boiling up to 500 Fahrenheit exploding brain kind of thing - this...

    but I don't want to give up have I come this far.

    I have a learning by doing - do some research - way of doing things, but this multiplayer thing are pretty advanced and sometimes I just cant find the right info anywhere. Like sometimes I do not know what I need ask. So any pointers here to get me on the right track are so appreciated.

    Thanks!

    ///Soulmachine!

  • Hi guys!

    Just a quick question... ( I hope )

    Do the pin to behaviour work in multiplayer for the peer? With the peer meaning not the host.

    I have a peer-object for all players and in that object I have a container with an object (sprite) that I want to pin to the peer.

    Do I need to sync the pinned objects when they are in a container and are pinned? I do not need see them if I play as a peer. Only the host need see them. They DO need to move with the player ( to be pinned ) for the host but the peer do not need see them visually.

    I ask this cause I need to pin some invisible sprites on the player for detecting where a mouse/touch-device has clicked/tapped.

    And I was thinking... as long as the host can see/keep track of the objects, the host could decide for the peer if the pinned sprites are clicked on. Am I thinking totally wrong here?

    I wanted to save some bandwidth and not being forced sync these pinned sprites. And also these sprites does not need to be visible for the game plays sake.

    I have a solution where I every tick position the sprites, but it would be nice to be able to when peers connected pin those sprites to the peer-object.

    At the moment it works for the host, but not the peers.

    I'm a bit lost sometimes with the multiplayer awkward thinking. Like If I for example place a normal button on my HUD. Both the host and peers can see it. I do not need sync it. Then in my (Common) - event-group I can use that button for example menu operations and so on.

    But if I have these sprites I want to pin. I can see them on the peer, when I'm looking in the host game-window. But they do not get pinned? They just stay at the position where the peer got created.

    But the hosts- sprites do get pinned.

    Thanks for listening so far.

    In the future I will post some more questions about multiplayer. When I have a bit more structure on what I need ask. Sorry for my disorderly questions.

    Right now I'm learning by doing with the multiplayer, using the tutorials.

    Later on I'm encouraging everybody to help out straighten out some questions and give good pointers to what direction yo need to go, when starting to program multiplayer projects. Especially the thinking.

    Some general praxis on the workflow and planning is needed - to convert a good working game you've made in singleplayer - into a multiplayer.

  • That is correct.

    ...That's pretty much what I did.

    But instead I have it in a Function called "Initialize" And that function is the first thing (the first Action) in the Start of layout.

    "On start of layout" - Function | Call "Initialize"

    and in the function On "Initialize" I have - Player | Destroy

    Directly after I then have Create | Player ( or I have an Object on the layout called SpawnPlayer that then spawns the player )

    If you simply put Player | Destroy in start of layout it should do the same I think. Instead having it in a INIT-function like I have.

    At least that fixed my problem.

    The problem I had was that all my towers, and also normal enemies that use the Tower and/or LineOfSight behaviour, targeted the Player object OUTSIDE the layout.

    And after the Destroy Player fix, my game have worked fine.

    I recommend all people, if you plan to use restart layout in your project - to test often what happen when you restart.. after you did some work, cause unexpected things could happen.

    I'm glad I could help.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've solved some of the problems.

    It helped alot by having "Destroy Player" at the start of the layout. And then creating the Player again.

    I have the player Outside layout, and has the behaviour "Destroy outside layout". but for some reason when I restart the layout I get 2 player objects? :/ And the enemies are targeting the one outside of the layout

    Perhaps if I run into more problems, I could try destroy all objects that are affected at start of layout, and then create them again.

  • Hello.

    I have problems with the instance variables, and the behaviour-functions not working as expected after restarting a Layout.

    Before I get into the depth explaining my problems I gladly accept all suggestion of 'what to think of when restarting a Layout.' If you like me have built a Level in a game that needs get restarted for the player to start from it's original starting point.

    ...

    What I have done is that I have made a Level on a layout. If the player gets killed he needs to start over from his original starting point. The reason I need to restart the layout is that I have made a kind of system, a kind of editor in Construct, where I've placed different objects (Sprites) on the layout to build the level. The sprites (lets call them spawning-sprites) spawn different things, like... Enemies, and Towers. The spawning-sprites gives different properties to the Enemies and so on. To do so the spawning-sprites uses it's instance variables and sets the thing that gets spawned - it's own instance-variables.

    I hope you follow me so far.

    To sum up. I've made a level on the Layout, placing out all the stuff and mobs - setting their properties.

    To explain more about the mechanics...

    When a spawning-sprite Is On Screen, they spawn for example an Enemy. Sets their amount of Ammo, their bulletspeed, the attackspeed, range, points, their state, what animation to use, and so on. All this comes from instance variables from the spawning-sprite.

    Some things sets the Enemy's own instance variables, and other things that are set are different behaviour properties, like Range for the LOS behaviour.

    Its HERE i get problems.

    The reason I've done this is that By placing a spawning-sprite. I can trigger a function that spawn an entire wave of enemies, making them move in patterns and so on. The enemies uses the spawning-sprite for different things. For example uses it's image-points to move in different patterns. I've also made a figure (picture) showing the way the enemy should move. This way I've made a kind of pool, with spawning-sprites that makes the enemy do different things. I can then Place them in a nice way in Construct building up my level. And the benefits are that I can see in Construct roughly how the level should look like and this way I can use the Layouts to make different levels, using the same components, just setting them up differently.

    If I preview the game from Construct. Everything runs perfectly. The player spawns at the right place, the screen moves to the player. All stuff at the map spawns, and they have the right properties and do the right things.

    However, if I get killed, and are supposed to start from the beginning. ( I restart the layout.) The stuff on the map does not perform as they are meant to.

    When I run the game in Debug-Layout-mode I try to find the problems. But all the instance-variables for the different objects seems fine. I cant find the problem.

    For example. If an Enemy has more than 0 ammo ( ammo > 0 ). The enemy are in range to the player, enemy has Line Of Sight. And finally are the right "Type" they should fire at the Player.

    They do not do so? Even though when I check the variables, and other properties for the enemy at the debug-layout. And all things are set correctly.

    I have not used a single global or local variable in the game.

    I also, the global property you can set for Sprites. They are not set to "global", except for one. That only one are the Score-Sprite, with 2 instance variables: Score and Lifes.

    In the Construct manual. it says:

    [quote:2fn4j75h]Restart layout

    Restart the current layout. Note that unlike Go to layout, this action resets all event groups to their initial activation state. Global variables keep their current value - they are not reset. To reset them use the system action Reset global variables.

    I'm not sure how to interpret this. If it means all variables, instance or not, get reset unless they are Global?

    Right now, it feels like it's something with the LOS-behaviour. It feels like even though the enemy are in range, the LOS cant sense it? It could be the cone-of-view or the range. I dont know.

    I'm working on placing some sprites as indicators, to see visually how far the range are, and how the cone of view are set.

    Enough of explaining.

    Anyhow, I appreciate any input you can have about what you think could solve this problem.

    Thanks.

    ///Soulmachine!

  • Interfaces are hard

    When working in Construct 2 the no:1 thing I miss the most are a kind of "Windowed Interface"

    Which means for example:

    something to be able to create simple menus, "OK,Cancel" menus that pop up. Or to make an easy Options Menu without having creating so many single objects. Like a X-button (to close a window), all the mouse over sprites for the options in the menu.

    It would be nice to have something that you can create on top over your game to avoid having to use a dedicated layout for a simple Pause-Menu or something similar like that.

    Basically something which allows you to create a simple User Interface to control things in your game. Imagine you had a big RealTimeStrategy game, with tons of options for your buildings, units, cities and so on...

    The no:2 thing I miss

    To develop the "Drag and Drop" behaviour with things like:

    select an object, using selecting boxes to select multiple objects

    to be able to have a "Is Selected" condition in your Event Sheet

    Sometimes you want to have a game that uses a lot of point-click from the player. Select a building, a card, "destroy" an object ( by clicking on an X-button ), select several units drawing a selection-box with your mouse/touch.

    The no3

    Something to help programming AI - like a built in Finite State Machine.

    The no3-1/2

    A behaviour for NonPlayerCharacters

    This could be: Chase, Flee, Wandering, Patrolling...

    The no4

    More inputs like sliders, check-boxes, radio-buttons.

    As I am a sound-artist and composer that works a lot with sound I feel I miss this. I'm not sure if anyone else do

    I rather prefer to add new functions that simplify complicated or time consuming processes in your programming - over flashy effects. Of course I like both worlds But if I had to choose one...

    Thanks for such a Creative and Inspiring editor.

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