I want to create a game similar to sea battle 2 ! how can i do in ue4?

I want to add objects to this table (drag and drop). and they should get attached to the cells of this table.

Is this 2d or 3d?

Here’s a quick board, see if this gets you started or at least inspires you a little. There are 2 actors:

  • a tile with a Static Mesh and a Text Render

  • and a board with a spotlight, it spawns the tiles:

The interaction is pretty basic at this point but it could be a start.

Image from Gyazo

It’s going to be 2D

Never played Sea Battle - was aiming at Battleships here. Hope it’s a Hit!

Thank you so much for you answer. I really appreciate !
But i am working on 2D game. So challenges i am facing is i am able to drag the object but the drop the object in ue4, only widget blueprint has that function which can be overridden. So i need to know how to create 2D table of this sort and be able to drop the object onto the cell (Some objects take more than cell)… Thanks !

I made table as you showed. only issue i am getting is spotlight is not showing… !! All tiles is BP_Tile right?

it’s a 2D game !

Thanks for your answer. can drag and drop an object in this setup onto the cells?

Thanks for your answer. I am making 2D game, and i want to be able to drag and drop the object into the cells

If you’re making it 2d I won’t be able to help you, not my field at all. The docs are here:

And there’s plenty of tuts online. One advice I can give is: do not try to make an entire game in UMG, it is seriously limited and you will not be able to handle logic comfortably.

The light might be facing sideways, you may need to rotate it to face down - not important at this stage. It’s just bells & whistles.

I saw that you commented here but not the comment itself due to the moderation. My example is next to useless if you’re going 2d. Sorry.

There’s probably half a dozen ways of doing it, here’s one:

I added a custom Game Mode with a Player Controller to keep things civil and organised.

  • I spawned some physics ‘ships’ above the board and let them fall with physics and gravity
  • the script then checks what’s under the cursor, if it’s a Ship, we store a reference
  • switch the physics and collision off so it does not interfere with anything else while we drag it around
  • then we check what’s under the cursor; if it’s a tile, we interpolate the ship’s location to the location of that tile - this gives the movement a nice, smooth snap. The ship also is lifted 100uus above the tile, so it looks like it’s floating while it’s being dragged
  • when the mouse is released, we snap the ship to the last known tile’s location (in case the interpolation did not finish) and clean up

Image from Gyazo

There’s obviously tons of work to do here but it could be a fun and challenging learning (or even commercial, who knows how you spin it) project.

Thank you so much man ! I can start from this !

This screenshot you shared is from GameMode Scripting right?

thank you so much ! i did that scripting in custom player controller and set it in my custom game mode but for some reason, i am not able to lift and transport the base ship ! i did debugging by print string, everything is fine but i dont know why its not working

It’s Player Controller - any controls, key presses or so are better handled there.

Can’t answer that without seeing what you’ve got. Btw, if you need me to, I can zip the project and push it your way so you have a working base. Do tell.

That problem solved ! thank you so much mate ! i can’t thank you enough ! Now i am trying to build on this base !