Announcement

Collapse
No announcement yet.

Noob Needs help: Spawning Pawns

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Noob Needs help: Spawning Pawns

    Hi, Im learning unreal engine 4, I don't have a programming background and am using blueprints to try and get a game made.

    The game is based on a board game named Shogi. Its very similar to chess. Its designed to be a 2 player on-line game.

    So far I have:
    • A basic map
    • A player camera bluprint (pawn class)
    • A decal on the floor that represents a 9x9 grid
    • A Blueprint (Actor class) which comprises of a 9x9 grid of boxes


    Click image for larger version

Name:	grid.jpg
Views:	1
Size:	485.5 KB
ID:	1137651

    Being a noob I have inevitably reached a point where I'm struggling to progress. I need some advice please.

    What I'm trying to do is create some sort of array (I think this is the way to do it) for each of the clients to determine which units to spawn, where to locate each spawned unit and which direction to orientate the units at the start of the match. I think this data should be held on the dedicated server and replicated for each client upon begin play. then when a unit is moved by a player in a client it should update the coordinates on the server which then informs the clients.

    Right now I don't even know how to get one of my unit blueprints to spawn, I was going to use the 9x9 grid of boxes which are listed as A1-I9 as a reference to position the unit after spawning. These units will eventually spawn then make their way to their grid space in some elaborate fashion i.e jet pack. but right now What I want to do is find out where they should be positioned on the grid, spawn them and have them move from the spawn point to the appropriate location, possibly by using the 9x9 grid of boxes as reference i.e. move to X - Y of box A1 then trace down to find the first object hit which should be the floor and use those coordinates to position the unit.

    Any help would be appreciated, and keep in mind when offering advice that I'm new to this so I may not know things that others take for granted.

    Cheers

    #2
    I can help get you pointed in the right direction, but I don't have all your answers. I'm in the same boat as you but I have elementary programming experience.

    So to get your blueprint or pawns to spawn check out my blueprint below. What i have in the scene is a smoke effect, and a trigger volume. When my character walks through the trigger volume (OnActorBeginOverlap) it spawns an AIFrom Class (my AI blueprint character), to know where to spawn it gets the smoke effect's location (you can change this to your grid settings). Finding the level blueprint can be annoying at first, if you're only looking in the content browser, instead at the top bar where world settings, build, and play are located there's a blueprints option, that's where you'll find the level blueprint.

    After you get spawning to work, then you'll want to look at the UE4 documentation on behavior trees, this is how you're going to get your pawns to move to a grid location. https://wiki.unrealengine.com/Bluepr..._Tree_Tutorial

    Basically your behavior tree would be like your array, with built in if/thens (you'll see how the BT works, a sequence looks at one thing if no then goes to the next thing). Let me know if any of this is too confusing, but do go through the entire Behavior Tree Tutorial and see if that solves a few issues.
    Attached Files
    Last edited by zlspradlin; 08-21-2014, 10:10 AM.

    Comment


      #3
      I had just figured out how to get to the stage you described just before reading your message but I'm using on event begin play instead of on actor begin overlap. Also I have spawned the blueprint as an actor but now looking at yours I'm thinking I should spawn it as an AI so I can get it to a location by assigning it a behaviour tree.

      Gonna check out the BT documentation, thanks for the help. you have saved me a lot of confusion

      Comment

      Working...
      X