Grid questions?

I’ve made a widget to make a grid but I have a few questions on how I should implement it

  1. How should I constrain the characters or “game pieces” to the grid

  2. Would character go through things like the levels walls or rubble and if so how would I prevent that

Thanks for the help in advance and please be as detailed as possible as I’m still quite new :slight_smile:

What does widget grid panel have to do with character movement? Or is this not about widget Grid Panel? You may need to elaborate on what the end goal is. Are you making a game that is 2d only?

How should I constrain the characters or “game pieces” to the grid

Many ways. Really depending on how things are supposed to move, I can imagine so many ways… You did not specify how the character is moving? Click → move to location, keyboard keys, some other method?

  • you can provide target coordinate from a line trace
  • you could snap vectors if you’re using pure math and locations are known upfront
  • you could use navmesh to determine pathfinding

Would character go through things like the levels walls or rubble and if so how would I prevent that

It would depend on the method of movement. Perhaps it’s enough to never attempt to move the character where they shouldn’t go in the first place. If you provide valid coords, they won’t go anywhere else.

If the target location is undetermined or is too dynamic to figure out the final destination upfront, you may need to rely on the line traces to sample the environment around you and adapt on the fly.

Honestly, there simply is not enough detail in the question to suggest something tangible. Consider fleshing it out.

Gameplay wise it would be similar to a board game and each character would have a set amount of action points to either move or attack and I’m going for a style kinda similar to xcom I guess so 3d but a almost a top down camera

The most fundamental approach could look like this:

You’d send this snapped vector to the character and have it move there. But before you do, sphere trace that location first to find out what else is there. You will surely have meshes, volumes, interactive elements, friends, foes and whatnot.

Look into how interfaces work in order to communicate between these entities effortlessly. Collision filtering will be a crucial element here - worth reading up on.

This is, obviously, incomplete. Alternatively, you could spawn tiles if this is supposed to be tile based rather than grid based. Line tracing can be used instead of the plane intersection, it really depends on how the map will end up looking and how you’re planning to handle the vertical aspect / selecting things.

1 Like

The closest thing that I can find is this. But it’s in French and I haven’t finished watching it, yet.

And it’s also for a turn-based RPG that’s built on a grid. But you’ll have to do some more work if you’re using guns with accuracy penalties and cover.

Also, check out the marketplace for turn-based stuff:

£50 saves you what, 3 months of active dev time, more? A bargain, especially considering the glowing reviews and support.

Seems to be exactly what I’m looking for, unfortunately I don’t speak French but I’m gonna try my best to follow and since it’ll be almost tabletop rpg I wouldn’t have to worry about that and just have skills with accuracy ratings, thanks a ton for the help :slight_smile:

Just bear in mind that the guy who made that tutorial has been inactive for a few years.

What would be the differences between grids and tiles i thought they were used for essentially the same thing?

A grid does not need a physical 3d representation. You could show it in material - much more efficient than having 100x100 tiles, 10k actors is no joke. But you could use several HISM comps, ofc.

Or you could use pure math, like in the (very simplified) example. Drop a spline point at every imaginary tile that need traversal and have a pawn follow it. You will need to develop pathfinding, ofc. You could leverage the existing methods and approximate.