Download

Endless Runner Split path

Hello everyone,
I’m trying to make an enless runner game based on this great tutorial series:

https://youtube.com/watch?v=VJOMdHzp3b8

So everything works fine, but I want to add a Floor tiles which makes me problems and I’m not able so solve it by myself. I want to spawn a tile where the path splits in two directions, where the player has the options to turn left or right and based of the decision the course keeps spawning the chosen way.

I hope someone can help me.

Thanks in advance

Couldn’t you just make a dead end tile (on the forward path) and open the sides to the left and right, place the turn trigger in the whole tile and duplicate the spawner so you have one on each side? I watched the tutorial a while back, but never made the game so just a thought.

that’s what I did :slight_smile:

What do you mean with have a spawner on each side? Do you mean to create an attach point on each side with an endtrigger? Because thats what I already did. Otherwise can you go in detail to explain me what u meant?

Nope, sounds like you did what I was thinking. Can you maybe go into more detail about what the issue your seeing is? Pictures of your blueprints might help too if well documented.

Well I did most of my Blueprints like in the tutorials. I can show you what I have done.

This is the normal BP_FloorTile which works great.

8b552cf97620d187b156ad5277d7065eb99294b2.jpeg
89d864ae8aef4f916124ac0d6f65f9272c82eb72.jpeg
a4b854e28025f8bfffe6dd3f9a60e5120cfd3b24.jpeg

How it is set up in the RunGameMode

cfa9061d107fb0fb795d61dcbf417a01e740c2ec.jpegRunGameMode_AddFloorTile_Function.jpg

This is what I tried for the Split Path

581c97a12bc0f2d77dede55eb89f8eaa8778bd4a.jpeg
88d19f34cafdd8d3832571e53299e614e68def6b.jpeg

Where I am not sure how to set it up

d77c22a0df59a098e3909aa14d9275865921d8dc.jpeg
b994f182c3b1e4d11a233d17187efdd72889a911.jpeg

I made almost the same Function for split path like for a normal tile, but my problem is that for the split path I need to set up 2 variables in the RunGameMode, because I get 2 possibilites (left and right) where the player can run, but I cannot set the same variable in both Attachpoints unlike the normal FloorTile where it is always clear where to set the next FloorTile.

22ebe10f5dedc18474a6187e5151292e53623498.jpeg

I hope this helps you to help me :slight_smile:

It’s a bit hard to see some of the nodes, but I think the setup makes sense for the most part. I think the easiest way to do this might be to set a bool each time the player turns right or left. True is left, false is right, then check that when you spawn the next tile and branch to one direction or the other depending on the value of that bool. However, that depends on when/where the function to add a tile is called. I can’t tell (or remember from the tutorial) when that happens so you need to do it before the player is on the spot where the new tile should be. Hope that makes sense and helps at least a little.

Yes I’m sorry. It’s smaller than expected. I was thinking about a boolean variabel, too, but I hoped there would be another solution, because I didn’t want to fool around in the setup of the tutorial :slight_smile:
I will try it with the boolean variable and will tell you if i was successful

Edit: Well actually I don’t seem able to do that… How do I check if I turn left or right? In my actual blueprint I can only check if I can turn at all

If I remember the tutorial correctly, you hit keys to turn either left or right. I would just add a Set(bool) node on each key and then check that. Again, not exactly sure how that part is set up in the character.

Another option might be to spawn tiles on each side to let the player see a small glimpse of what’s to come depending on how they turn. Then you just need to duplicate the spawn logic for each side on wherever you’re spawning new tiles.

Also, I wouldn’t get too worried about mucking around in the setup of the tutorial. That’s the best way to learn. What I like to do when I start trying new setups is to keep all the old nodes there, but spread out a bit to allow room for new ones. Also, running a P4 server helps to be able to go back to an old version if you do mess something up. :slight_smile:

Yeah I usually do mess around in setup, but in this case I wasn’t 100% sure how it worked so I thought better not to touch it. :slight_smile:
Anyway this is is the setup for corners

25f597b5d7bf5a331a362e2592adefe7f41b7098.jpeg

So I could setup a boolean based on this, couldn’t I?
Something like that?

4bb48ccf5400e29dccf88d6f44fe3ca8dd0720c4.jpeg

…and I set it up in the RunGameMode like this

c34e93498d3b94cf73ba2116c4123857363a7de2.jpeg

…unfortunately it didn’t work :frowning: It always spawns the tiles on the same side no matter the input.
In case my boolean setup is right I think it could be wrong, because of the event graph of the RunGameMode.

cfa9061d107fb0fb795d61dcbf417a01e740c2ec.jpeg

Because of the ForLoop it always spawns 10 Tiles. When it comes to decide if I turn left or right it has already spawned the tiles… Tried it without the ForLoop and it’s still not working. :frowning:
I think my boolean setup is wrong.

How would I do that? Isn’t this more or less the same problem as I’m facing at the moment? Not being able to duplicate the spawn logic to the other side at all no matter of the input :confused:

You will need to make the loop run twice since you want to spawn out each side of it.So you will want it to generate 5-10 new tiles on each side, then after you have turned,figure out which way you turned and then only generate on that side.

You will need to change around the logic thats provided in the tutorial quite a bit to meet your needs so I suggest going back to the start and breaking out each of the problems and you will be able to solve it fairly easily.

IF T intersection generate 5 on left, THEN generate 5 on right. IF player turns left set the new spawn point at the end of the left.

Well I do understand the general logic how to get it working, but sadly it seems to be that I do not have enough knowledge to set it up technically. It would be awesome if you could provide a picture of a blueprint setup…I dont really know where I need to start chaning thinks, because I tried so much but still failed :frowning:

I’m really lost. I hope someone has mercy and tries to help me.

Well, I did that tutorial awhile back so I am semi familiar with it.

The problem is, though I have been a developer for a long time, I am definitely a noob when it comes to UE4, so take my advice with a grain of salt :slight_smile:

From a logical standpoint, I think if I were trying to accomplish what you are doing, I would change the ‘nextspawnpoint’ variable (I think that is what it is called) into an array. It would normally only have one value in it, and hitting your box collision that spawns the next tile 10 tiles out would have the same outcome, but it would be doing a foreach through the spawn points.

Then when you were ready to split, the split tile you place would have two spawn points, it would still be 10 tiles out, so you would essentially be spawning twice the tiles for the next ten tiles, as it would be building two roads. Then once they hit the canTurn box collision and make the turn, dump the no longer needed nextspawnpoint from the array and your road would only continue to build in the direction you are currently going.

Of course it wouldnt be that easy, you would probably need another collection that stored your intersection nextspawn points so you could kill the actors that are no longer needed the direction you are going, and you would have to decide if you want to make it easy and only have one possible split path at a time. And to know which nextspawnpoint to kill, you would probably just want to keep it convention based and always have left first and right second or some such.

It actually sounds like something that would be pretty fun to write :slight_smile:

Hope that is helpful and not just more confusing!

Thanks for your reply.
If I understand you correctly you would make the ‘nextspawnpoint’ variable into an array and when it comes to the ‘split path canTurn trigger box’ depending which side I turned spawn the next tile and ignore/delete the other side. Nevertheless I still have troubles getting it work properly. Could you provide a setup of blueprints pls?

Refreshing this thread, because I decided to work further on the endless runner game after a long time and I wanted to know if someone probably got a solution for solving this problem now. :slight_smile:

I would like to know this, too

I’m not sure how much help my two pence piece will be, but here it is.

I’ve recently been following the tutorial and trying to apply it to a 2D side scrolling format.
When generating the floor tiles, I would find obstacles deleting before the character reached them, so I set it to generate one large tile at a time.

62fe7655c2559351b719d4923c3e6628f2d96d75.png

Now I haven’t set it up yet, but my next step is to create a tile that splits into two paths at the beginning, and uses two different collision boxes to set one of two different arrows as the next attach point.

Now what I’m thinking is that you make the T junction tile extend a bit to the left and right to allow room for collision boxes on ether side that determine which attach point is used.
You may need to mess around with the size of the rest of the tiles and the number that spawn ahead, but it is a possibility.

I have abandoned my old project quite a while ago, but recently revived it and it comes in very handy to solve the problem concerning the t-tile intersection. It would be aswesome if you have figured something out to share your knowledge or which would be even better if you could post a screenshot of your blueprints. At the moment I’m trying to fix this issue, like someone stated out before, by giving a little glimpse to the left and to the right of the intersection and having a collision box of each side. When the player turns left I move the (already) spawned tiles left and if he turns right I shift them right when he overlaps the corresponding box. That’s at least the approach I’m going to try which confrontes me with the problem that I don’t seem to be able to shift already spawned tiles. Anyway any input is welcomed which might help :slight_smile: