COM S 327 Programming Project 1.01 Terrain Generation


Category: You will Instantly receive a download link for .zip solution file upon Payment


5/5 - (1 vote)

It’s time to start developing our Pokemon-inspired game. We’ll begin by generating terrain. Some ´
details are specified below, but generating a good-looking map is largely a matter of taste.

Because it’s so much a matter of taste, you may decide how you want your map to look and come up
with your own heuristics to generate that look. Things to keep in mind are playability and realism. Yeah,
it’s a fantasy game where we catch monsters in tall grass, but that doesn’t mean there’s no realism!

that are too straight are probably unrealistic; after all, the world is full of rocks, streams, hills and trees.
Your terrain generator should be written with an eye toward extensibility. Remember that you will be
adding functionality on top of this next week, and for the rest of the semester.

For this step, you generate a
map, draw it on the standard output, and exit. Here are the requirements:
• All code is in C.
• The map measures 80 units in the x (horizontal) direction and 21 units in the y (vertical) direction. A
standard terminal is 80 × 24, and limiting the map to 21 rows leaves three rows for text, things like
gameplay messages and player status, which come later.

• At least two paths pass through your map, one oriented N-S, the other E-W; these will intersect somewhere in your map. Additional paths are acceptable according to your taste. Paths are represented
using hashes (’#’).

• Your map should have a Pokemon Center and a Pok ´ emart, Represented by one or more ’C’ and ’M’, ´
respectively. I make my Pokemon Centers and Pok ´ emarts ´ 2 × 2.

• Your Pokemon Center and Pok ´ emart, should be reachable from the path without having to go through ´
tall grass.

• Your map should contain at least two regions of tall grass (represented with colons)
• Your map should contain at least one region of water (represented with tildes)

• The outermost cells of the map are immovable boulders (represented using percent signs), except that
there is one exit on each border. Your N-S path goes between the top and bottom exit, while the E-W
path goes between the left and right exits.

• Your map should contain at least two clearings (regions of short grass). Clearings are represented
using periods.
• Other option terrain includes rocks and boulders (’%’), trees (’ˆ’), and whatever else you think would
be interesting.

My approach involves randomly choosing a handful of “seed” locations for the various region types,
then “growing” those seeds until the regions contact each other. Once the whole map has been filled, I favor
region borders for path placement. To make the space more interesting, in addition to the required regions
given above, I sprinkle boulders and trees around the map after regions have been placed.

If you’re unfamiliar with Pokemon games, the Pok ´ emon Center is a medical facility where you take your Pok ´ emon for healing ´
and the Pokemart is a Pok ´ emon convenience store. We’ll implement the functionality of these facilities in a later assignment. ´

In a future assignment, we will add the ability to move out of the first map into an adjoining map through any of the exits. In
the new map, you will enter through the old map’s exit; thus the position of this exit must be maintained in order to go back where
you came from. For this reason, it’s probably best to generate exits before generating paths!