GM:S 1.4 How would you all do this?

Discussion in 'Programming' started by Roachant, Jun 26, 2016.

  1. Roachant

    Roachant Member

    Joined:
    Jun 24, 2016
    Posts:
    12
    Hi!
    Before I start, I'm a total noob so please bear with me!
    I'm currently working on a simulation/ tycoon game where I have clients who come into a club and do different things. In order to get them where they need to go I'm using state machines and using mp_potential_step commands to make them move to their targets.
    I realize that this isn't the best way to go about moving my clients in the game but I have tried using mp_grids and for some reason it wasn't working, the objects were not making a path to their destinations, they were simply sitting there. For the time being it works ok using mp_potential_step it just looks rather...ugly..
    My question is, is there a better way to get spawned objects to their destinations in game maker other than mp_potential_step or mp grid functions? How would you go about it?
    I'm not new to GML but I am new to this kind of game mechanic as other games I have worked on had simple AI. I realize simulation type games are extremely difficult to make but I don't want to give up as I am still having fun and learning new things everyday.
    Thanks!
    Roachant
     
  2. bojack29

    bojack29 Member

    Joined:
    Jun 21, 2016
    Posts:
    407
    I have an RTS asset that may be of some help. Basically its an engine that path finds a location closest to where it is trying to go. If there is someone in the way or at the destination they are trying to go they will simply get as close to it as they possibly can. It's not a collision system but a destination system that keeps everyone from trampling over one another.

    https://marketplace.yoyogames.com/assets/4012/hdtdt-rts

    The way you mention this game it seems like there are a lot of bodies in this club and patrons have to figure out how get thru them without colliding and that sounds like hell. You could also probably start on a sytem that is similar to the real world. When trying to get thru a crowd, you asked the patron in front to move some, then if the path clears you move forward. This idea would still use the mp_potential_step functions you are already trying to do.
     
    Last edited: Jun 26, 2016
  3. Roachant

    Roachant Member

    Joined:
    Jun 24, 2016
    Posts:
    12
    Thanks for the link, I'm going to check it out!
    What I have in place so far is that when clients come in they look for a seat to sit and when another comes in they will go to another seat if one is occupied, I tried using a real world approach in that sense.
    My biggest problem is that when the clients are going to the club they don't take a straightforward route, they kind of go all over the place before finding their destination. They look drunk before they get to the club :).
    My solution was to use mp_potential_step in small increments, like have them go to the door of the club and then choose another destination and so forth. It works but it's not really smooth.
    I would love to see how they did it in prison architect as I find their AI system works really well.
     
  4. bojack29

    bojack29 Member

    Joined:
    Jun 21, 2016
    Posts:
    407
    Basically the way the rts engine works is a unit plants a flag in an area he wishes to go to. Before planting the flag, he makes sure that no one is there and that a flag the does not currently exist in that location. The flag is as large as the unit itself so when he gets there he won't be touching anyone else. He then uses a path finding mechanic to create a path between himself and the flag that avoids obstacles like walls (the path finding mechanic does not concern itself with other units). He moves thru the crowd to the destination and sits there.
     
  5. Roachant

    Roachant Member

    Joined:
    Jun 24, 2016
    Posts:
    12
    I got your asset and will be checking it out. Thanks again for your help!
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice