Download

Blueprinting a road placement system - for a City Sim kind of game

Been trying to get something like this working for a while now, but it’s not quite there yet. What I’ve tried doing is creating an integer that adds or subtracts how many roads to place depending on when the mouse moves. As you can probably tell just from reading that, it doesn’t work too well. The best I know to do at the moment is add a very short delay between when the mouse moves and when the game adds/subtracts to the integer. I’ve also tried making it a float variable and having the float increase in smaller increments. Not surprisingly, it doesn’t change much when I do that. I’ve also tried having the player create splines within the game for the roads, but since I’m using sprites and not meshes, I haven’t had much luck there. Not to mention I don’t know enough about splines to work around that issue.

So the question is, anyone got an idea of how to go about making a road placement system for a City Sim game in UE4? I was aiming to achieve something like in Cities: Skylines, but I’m starting to recognize that that may be a bit difficult to do with sprites. There are no meshes anywhere within the game, it’s all 2D images. I’m sure someone here can guide me in the right direction.

Bump

Surely someone has some advice at least? ._.

What exactly is it about your system that is not working so well? The integer method sounds like it would work, what is happening?

Here’s a better look at what I’ve got. Elsewhere in the code is the section where it takes whatever the number from the integer is, and just spawns the roads from there, subtracting one from the integer after each road spawn until it reaches zero.

0b6d48c3fcb3481549a511acc5ebe1ffa9646ec2.jpeg

The issue is that it’s not looking for where the mouse is, it’s only looking for if the mouse moves at all. So I could just move the mouse really slowly forward and end up placing about twenty roads, even though the mouse’s end location would suggest that there should’ve only been two placed. My other attempts have not worked any better. I’ve tried comparing start and end vectors, which didn’t work out. and I already mentioned changing the NumberofRoad variable to a float, and that didn’t change anything. What I currently have is the closest I’ve gotten to getting it right.

Edit: I ended up just going with a different system that I think will work better with the game we’re making. Thanks for the help though!