Vallar's Forum Posts

  • Add "For each BasicMeleeFollowEnemy" as a second condition, directly under "BasicMeleeFollowEnemy has LOS.." in event #3. It should fix the issue with attacking and chasing.

    Gotcha, thank you very much! Would you know why the enemies won't stop where the distance is set and they go directly to the player location?

  • In your screenshot you need to add "For each BasicMeleeFollowEnemy" condition to event #3.

    > Your dropbox links won't download.

    This is odd, I checked on another machine and they are working. Try direct links:

    https://www.dropbox.com/s/nndzbogyc0dz2wt/Pathfinding_NoOverlapOnDestination.c3p?dl=0

    https://www.dropbox.com/s/gmvzgg6trvsfipu/Pathfinding_NoOverlapWhileMoving.c3p?dl=0

    Still not working, I think it might be something on my end with Dropbox; One Drive and Google Drive work just fine.

    Wouldn't the For Each BasicMeleeFollowEnemy" pick all of the enemies whether they are nearby or not? Do I have to do a Pick All condition first?

  • I don't see the image of your event sheet.

    There are many ways to do all this, try searching the forum and tutorials.

    Here is a recent topic:

    https://www.construct.net/en/forum/construct-3/how-do-i-8/keep-followers-spaced-one-153220

    I also have a few demos, they are for Construct 3, you should be able to open them in the free version and maybe copy some ideas to your game.

    https://howtoconstructdemos.com/avoid-overlapping-while-moving-with-pathfinding/

    I have updated the original post with a link from imgur so you can see the event sheet now. Not sure what is up with Construct's website.

    I checked the first link you posted and that is something I did at one point and it just still overlapped most of the time. Even when I added a delay at the start (before they start pathfinding) and providing a random X and Y offset that is deducted from the player's position.

    I'll see if I can recalculate a position if they are going to overlap with another agent.

    Your dropbox links won't download. I tried on multiple browsers but I get the same exact error message saying "There was an error trying to download this file" even after clearing my Chrome's cache not sure what is up with that.

  • Hi all,

    Recently I got back to using Construct 2 and I am playing around with enemy AI. I am trying to create an enemy that basically does this:

    - On spawn, it pathfinds to player.

    - When it sees player it checks distance; if it is within attack range.

    --- if yes, then attacks the player periodically (i.e. every x seconds based on its attack speed).

    --- if no, then continue to pathfinds till it reaches its attack range.

    - If player moves away (further than attack range) from the enemies, they go back to pathfinding towards the player.

    Another thing I'd like to do is not have enemies overlap on each other when they reach the player (like you see them in the GIF below). I haven't addressed that yet, because I am not sure exactly how to do that in Construct 2.

    This the event sheet:

    i.imgur.com/FYmzmqh.png

    This is the bahaviour I get:

    i.imgur.com/fZ6wRxj.gif

    First off they don't stop at the range I set in LoS (50) they stop RIGHT on top of the player. Second thing is that if I watch the player's HP to check the attacks, all I find is that the HP is being deducted as if one enemy is attacking. In the GIF there are 4 enemies (2 are overlapping each other) and yet when an attack happens HP goes down from say 10 to 8 instead of instantly to 2. Do I have to use a for loop for the attack?

    Not sure what I am doing wrong exactly. Any ideas?

    Thanks in advance.

  • You do not have permission to view this post

  • You might be able to accomplish this by storing a list of object positions (for things that can be destroyed or moved), a section for specific user data (for battles and trading) , and a small part to store an array of the land data (water, land, bridges, stuff that doesn't move) When the user logs in you could download everything from the database and set up "Child changed", "Child removed", and "Child added" listeners for the locations directory. That way if something is moved or changed you can update the change the graphics on the map. I also recommend putting the item name as the item type followed by a uid. An example for the locations directory:

    "locations"

    ..."user097610" <Id for user is their userid

    ......"x":0

    ......"y":0

    ..."tree190801"

    ......"x":0

    ......"y":1

    ......"other data":?

    As for displaying all this data, you could use different tilemaps, one for objects and one for terrain.

    I was thinking of something the other day but I am unsure of how practical what I am saying it is. I was thinking that perhaps on the active parts of the game (i.e. map exploration) the mutliplayer plugin would handle everything. That way I don't have to store every single piece of data related to the players in Firebase's database.

    Of course the world has to persist, in that case, when a player exits (be it through closing a tab or he just gets disconnected somehow), the game would store the relevant data in Firebase's database to be used when he logs back in.

    Wouldn't that circumvent the need to continuously store data in the database? After all the game doesn't run on a client and is hosted online just like the old RuneScape for example where you open a tab in the browser and play the game or A Dark Room. You open a tab and start playing and there is your data from the last session when you closed the tab abruptly. Although I know A Dark Room stores the data locally rather than online.

  • Are you thinking about my game Tank Trouble 2? I was talking about space arena...

    I didn't know you had another game. I only saw the space one.

    The best way to describe the game is to link it to A Dark Room really. It is a similar in concept. You have essentially a web page with multiple buttons, you click on a button that does a certain action. For example, you might have a button similar to Dark Room where you click on it to get iron for example. The button has a loading sequence that displays the time it takes to gather the iron. When it is done the iron is added to your inventory.

    However there is an exploration part where you have this world map that looks similar to this. Each square in that grid is a room (not a multiplayer room, but a location in the game) where if you click on it (or perhaps using WASD) you can move there. This means movement is grid based.

    Combat in the game happens automatically with some interaction from the user. A somewhat similar example is the combat that occurs in

    Subscribe to Construct videos now

    but you press buttons for your skills rather than type the commands.

    As for the interaction between players, it would probably be restricted to trade and chat.

    After a few hours, I was able to fix the problem where the database was inaccessible even when I was authenticated. It turned out I changed the rules on the database to Authenticated Users not public or default. Which seems to require that when I update the database or write to it to use the path "users/" "userID" to write into the database. I was only using the userID directly without the first part. So now I can write to the database using the userID specifically.

  • I have built my online space arena game around firebase, and I can help you create your game around it. Firebase works so well for me mainly because it's so simple. The free pricing plan is great for beginners and includes enough bandwidth for almost everything you would use it for. For your game, you could set up a custom email and password login page, then after they are signed in you can load their data from the database (using the generated userid). I haven't dealt with the custom email/password login in firebase but all of the different login methods work the same way and all can be used to get a userid. Other options for the login include: Google, Facebook, Twitter, and GitHub. After this you could sync their progress to the database periodically or however you would like the save function to work. If you would like to go this route you can find info on the firebase plugins as well as sample capx's here (just look for firebase in the list). You would need the firebase_apiv3, firebase, and firebase_authentication for a start. The other plugins are optional depending on what you want to do.

    Thanks for your reply. I have used Firebase before and was able to get the Authentication part working fine, I had a huge problem with actually getting anything written in the database based on the authentication. If I go that route, I definitely would need help in that, if you don't mind.

    The login system I created back then was based on getting an email and password from the user just like any website/forum would. It worked fine, but when I implemented a chat, it didn't work. I even got Rex's chat example and changed the API key and all that and replaced them with my own test app and it didn't work.

    Aside from that, It is daunting that I'll have to do all the syncing manually. A Dark Room has elements where you play real time controlling an "@" symbol type character through a map. Would Firebase be a good fit for that?

    I tried your game out and that is a unique idea you have there. Interesting. I saw that you have multiplayer with the "coming soon" poster. Are you working on a Firebase multiplayer?

  • I didn't use the plugin but I did a quite search and found it. As Aphrodite has said, the idea is to log the date and time when the game quits and then compare it to when the user opens the game again. Subtract both and the amount of time passed should be available. Through that you can do whatever you want.

  • Hello,

    I think your best bet would be to use Rex's plugin located here:

  • Hey guys,

    Background:

    I have been on and off working on the design for a game similar to A Dark Room; a game that is mostly text but you get to a point in the game where you have this world map that you traverse by moving around. Fighting or events are handled through stats in a turn based fashion. The multiplayer part should functions similar to Kingdom of Loathing; you login and play in your browser, no client to distribute, nothing... just login to a webpage hosting the game.

    I have also been using Construct 2 on and off for quite a while now. I have managed to read and understand the multiplayer general tutorial as well as the chat one. I tried to follow the other ones, but they felt less like tutorials and more like describing what is being done. Unfortunately, I don't get along well with these kind of tutorials so I couldn't finish them or understand much from them. I am one of those people that like hand holding at first (a detailed step by step; do that and do this with explanation) and then I am left to my own devices at the end.

    The problem

    I would like to use Construct 2 for this project instead of let's say Unity (I have used it for almost a year) as I really like using it and I can get things done MUCH faster than in Unity (I am not a coder at the end of the day). My problems are:

    • My guess is the multiplayer aspect of the game isn't done by connecting hosts to peers; you login, find a page and start playing. You can see others around you (think the old, old RuneScape but far less flashy and more primitive of course). So could I do it using Firebase only? Would it be too complicated?
    • Which framework works best with this kind of multiplayer; Photon, C2 Muliplayer or Firebase? Why?
    • Anyone knows of a tutorial that is written for idiots? I searched high and low for Photon and only found 1 that shows a setup no more. Firebase has no tutorial outside of the setup as well and C2's Multiplayer tutorial aren't step by step at all.

    What I am looking for -- not a recruiting request, trust me!

    I am looking for help really from the veterans and experts or anyone that knows well what I am talking about. I really, would like someone to put me on the correct road and have a discussion on how this can be done in the least complicated of ways. Aside from the obvious reason that I want to build this for myself, I also would like to use this as a showcase for a course I would like to teach for students in an international school. To cut the story short, I already taught a similar curriculum and I am trying a different method for motivational purposes this time.

    Thank you very much in advance and looking forward to your help and discussions.

  • I think it is to do with the size of your background and the location you reset it to. I would recommend you use a square based tiled background and set the reset location to the size of the sprite.

    This video is a step by step how to do it albeit horizontally rather than vertically:

    Subscribe to Construct videos now
  • I see, thanks for pointing out the issue. I will try to follow the tutorials you mentioned closer, sorry for the idiocy.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There are so many things that can go wrong with a multiplayer game it will be impossible to give you advice without a capx. It would also help if you linked the tutorial you are referencing.

    But first to confirm it's not a routing issue, are you testing locally with multiple browser windows or are you testing across a network?

    Also have you done all the official multiplayer tutorials and understood them? You will find it painfully difficult to progress otherwise.

    I am testing locally using Chrome on different tabs and incognito mode.

    As for the tutorial I am following it is

    Subscribe to Construct videos now

    . Here is the capx I have made.

    I did follow most of the tutorials that are on the website and understood them. I didn't follow every tutorial, I just followed the first 2 (the general concepts one and the chat one). That said, like I said, I am only following what the guy does in the video, step by step. Perhaps changing a few minor things. The tutorial on the website while great to explain concepts, they aren't quite good in the "step by step" department. I learn best with a "Monkey see, monkey do" approach, then let me do my own thing afterwards.

  • Bump, any ideas? I still can't solve the problem!

    Thanks!