1
\$\begingroup\$

I am trying my hand at android game development. I want to start with a simple 2D board game. What is the best way to draw a game board like the one in the image attacked below. The blue circles are points where the players can place objects.

enter image description here

\$\endgroup\$
  • \$\begingroup\$ Do you ask for a technology (canvas, OpenGL...) or a way to store and render it? \$\endgroup\$ – Bálint Mar 21 '17 at 7:27
  • \$\begingroup\$ The most optimum way to store and render \$\endgroup\$ – Kinley Tshering Mar 21 '17 at 8:07
2
\$\begingroup\$

You should use a graph.

A graph is a set of connected nodes. In your case each node should have a position (vector), and an ID.

Outside the grapg you should store the connections. E.g. in your gfaph there are 5 nodes with the position (0;0), (0;1), (1;0), (1;1) and (0.5,0.5) and the IDs 0, 1 2, 3, and 4 respectively. Then your connection set would be

0-1, 0-3, 0-4, 1-4, 3-4, 2-1, 2-3, 2-5

Make sure they aren't duplicated.

You take every connection, get each IDs and their corresponding nodes, and using their positions, you draw a line.

\$\endgroup\$
  • \$\begingroup\$ [NOTE] Might come handy to some people. To store the connections of nodes, look at adjacency matrix and/or list \$\endgroup\$ – Kinley Tshering Mar 30 '17 at 12:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.