1
\$\begingroup\$

I'm a beginning programmer and i need to make a game. The rough idea revolves around fleets fighting in turn based battles while you control your factions resources and manpower.

The original concept was to make a set of routes which the fleet could follow. A graph of location nodes connected by route edges that looks a bit like this:

Example map layout

I don't know how to make a map and make set locations on it.

On that note, i'm making this is html/javascript/css. This is a school assignment.

\$\endgroup\$

closed as unclear what you're asking by Tyyppi_77, Almo, Philipp, Anko, DMGregory Dec 6 '18 at 2:58

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\begingroup\$ I've voted to close this question as too broad. This question is basically "I want to make a game in JavaScript but I know nothing. Please teach me everything I need to know". The purpose of this site is to answer specific questions, not provide one on one tutoring. \$\endgroup\$ – Philipp Nov 30 '18 at 9:24
  • \$\begingroup\$ all i asked is, what should i use? I didn't ask ANYTHING that involves programming \$\endgroup\$ – TheShaws358 Nov 30 '18 at 11:43
  • \$\begingroup\$ It's not entirely clear what manner of thing you're asking to "use", then, if not javascript code. If you're looking for some sort of pre-made package that just does this without code, that's not the type of thing we're best suited to help you track down. Can you be more precise about what step of this process you need help with? Is it drawing this map on your web page (eg. with an image element for the whole map, or individually placed images for each node, or a canvas to draw it dynamically), or representing this node graph structure in your game logic code, or something else? \$\endgroup\$ – DMGregory Nov 30 '18 at 11:54
0
\$\begingroup\$

Regardless of the programming language, the easiest way to produce a flat map is with an array. In most languages, you'd use a 2D array so you could have a grid based area although I understand from this question How can I create a two dimensional array in javascript that it is rather difficult.

Once you have your array, you can then assign a value into the array to tell the game what is there.

For example, in this 6 x 6 map:
0 0 1 1 1 0
2 0 P 1 1 0
0 3 0 1 P 0
0 0 1 1 0 2
0 1 1 1 P 0
1 1 1 1 3 0

Where 0 represents land, 1 is sea, 2 is resource type 1, 3 is resource type 2 and P is a port which you can then use as an overlay for your boats to travel back and forth or anywhere that is a 1.

\$\endgroup\$

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