CMPM-290A-01
P4: Platformer Level Design
Skip To Content
Dashboard
  • Login
  • Dashboard
  • Calendar
  • Inbox
  • History
  • Help
  • Resources
Close
  • My Dashboard
  • CMPM-290A-01
  • Assignments
  • P4: Platformer Level Design
2017 Spring Quarter
  • Home
  • Syllabus
  • Assignments
  • Files
  • NameCoach
  • Zoom
  • YuJa
  • Gradescope
  • SETS

P4: Platformer Level Design

  • Due May 10, 2017 by 11:59pm
  • Points 10
  • Submitting a file upload
  • File Types html and pdf

In this programming assignment, you will use ASP to create a design space description suitable for use in a hypothetical mixed-initiative level design tool similar to Tanagra.

Domain Description Links to an external site.

We want to model platformer level designs on a canvas that is 80 units wide and 10 units tall. A design will consist of 8 beats, each of which is associated with a platform defined by a horizontal start (left) and end (right) with a vertical height. Near the end of each platform, the player will perform some activity.

Available activities:

  • jump: Cross a gap between platforms of at least 1 horizontal unit. The player may jump across a gap of as far as 2 horizontal units and 2 vertical units.
  • spring: Cross a larger gap between platforms spanning 3 to 4 horizontal units and covering a vertical change of up to 4 units. It should not be possible for the player to merely jump when the spring action is placed. Platforms involving the spring activity will be visualized with a spring sprite near their (right) end.
  • wait: Wait for a safe opening during the vertical movement of a thwomper. Platforms involving the wait activity will be visualized with a rock sprite hovering near their (right) end. The platform to the right of the platform involving this action should be adjacent (end of this one touching the start of the next) and have the same height.
  • kill: Kill an enemy by jumping on it. Platforms involving the kill activity will be visualized with a cute little bird sprite near their (right) end. As with the wait activity, the next platform should feel contiguous with this one.

General expectations for platforms:

  • The platforms (one associated with each beat) are arranged from left to right: their start is lower than their end; and the end of one platform is less than the start of the next platform to the right.
  • No platform is shorter than 2 units wide or longer than 12 units wide.

Named design patterns:

  • The valley design pattern is present for a beat if the player jumps down to a platform, kills an enemy, and then jumps back up to a platform of the same height as the original. This pattern involves a constraints on activities (jump, kill, jump) and a constraint on geometry (height(B-1) == height(B+2) and height(B-1) > height(B)).

Supporting Mixed-Initiative Design Links to an external site.

In a mixed-initiative interaction setup, two things are evolved through repeated interactions between the human user and machine design assistant: (1) the concrete current design, and (2) the currently desired design constraints. Your answer-set program will play the role of the machine: finding a new design that satisfies the desired consrtaints while retaining as many elements of the previous design as possible.

Because we're not creating an interactive graphical interface, it will be enough to model an initial design that future solutions should try to approximate. Initial design:

  • In the initial design, the eight beats are associated with identically shaped platforms. Each is 8 units wide followed by a gap of 2 horizontal units and a change of 0 vertical units. All platforms are at height 7 (out of 10).

When forming a new design, we want to retain as many of the activities as possible. Amongst those solutions, we should prefer those that preserve as much of the original geometry as possible. Activities are preserved if the new activity of a beat is the same as the previous activity. Geometry is preserved at the level of individual parameters: the start, end, and height of a platform. The shape of gaps between platforms is not explicitly captured in this model (although preserving the shape of many platforms will have the effect of preserving most gap shapes).

Grading Criteria Links to an external site.

To get credit, your notebook should illustrate the following:

  • [3 pts] Basic formulation: A preliminary design space model (one or more .lp files) for which solutions are visualized as embedded images of level designs (Include a random example level using --sign-def=3 to suggest the solver make random choices. Use --sign-def=rnd if you are using clingo 5.2.)
  • [1 pts] Consistent formulation: The design space model includes the initial design from above (Describe the initial design in a separate file and then show that the problem is still satisfiable when the new design is forced to match the initial design.) A visualization of this design coming out of your formulation would be good evidence that it is consistent.
  • [2 pts] All activities: Every activity is modeled per the description above (Use additional constraints, probably stored in a different .lp file, to generate a level design in which each of the four activities is present at least once in the same solution.)
  • [3 pts] Least-change formulation: Prioritized optimization is used to find the solution that demonstrates all activities while preserving the activities from the initial design at the highest priority and geometry from the initial design at at lower priority (Although different priorities are used, it is expected that all weights mentioned in the #minimize directive are set to 1 -- counting differences rather than weighing them.)
  • [1 pt] Least-change valley: A level design for which the valley design pattern is present at a given beat (okay to hard-code a specific position if you like) while preserving as much of the initial design as before.

Development Tips Links to an external site.

  • Make sure your notebook can be safely run from the very top. Under the Kernel menu, find the Restart & Run All option. Use it frequently.
  • Borrow visualize.py from this gist: https://gist.github.com/rndmcnlly/02ac6a4c1f86da73e22d145b5379a5fe Links to an external site. If you use this script unmodified (first installing the pillow Python module and the 3 icon files it suggests), you don't need to include the source of it in your notebook (but do cite your sources). This script will read in a JSON file describing the scene. Find the Demonstration section of the notebook in the gist for the use of icons to indicate platform activities. Using this, you will only need to wrangle from Clingo's JSON output to the visualizers JSON input.
  • Although no ansunit Links to an external site. test suite is provided for this project (because you get to invent your own predicate names now), you should still try to use the core idea of testing promoted by that tool: Write multiple small .lp files and check their correctness by adding a few extra constraints and checking of the solver finds some or no solutions as you expect. (Use Markdown cells to capture your expectations and explain the outputs.)
  • Avoid a formulation where pairs of the parameters of a platform get compared during grounding. Use weight constraints (with weights of 1 and -1) to compare numeric parameters for equality or inequality (such as checking that the end of a platform is larger than the start of it). Say "0 < #sum { -1*Start: geo(B,start,Start); 1*End: geo(B,end,End) }" rather than "Start < End" to avoid quadratic dependence on the canvas width. Although the size of the canvas is probably small enough for you to use the simpler encoding in this project, the extra grounding time will slow you down and make the debugging effort more frustrating.

Clingcon Links to an external site. would have been the ideal ASP system to use for this project (with native support for integer linear constraints over very large integer variable domains), but it proves difficult to run if you don't have easy access to Linux. Additionally, the syntax related to numerical constraints is very sparely documented. Play with this only after you've gotten most of the points possible on this assignment. With your experience modeling numerical constraints in the previous project, you know how to get Clingo to do what you need for this one without using Clingcon.

1494485940 05/10/2017 11:59pm
Please include a description
Additional Comments:
Rating max score to > pts
Please include a rating title

Rubric

Find Rubric
Please include a title
Find a Rubric
Title
You've already rated students with this rubric. Any major changes could affect their assessment results.
 
 
 
 
 
 
 
     
Can't change a rubric once you've started using it.  
Title
Criteria Ratings Pts
This criterion is linked to a Learning Outcome Description of criterion
threshold: 5 pts
Edit criterion description Delete criterion row
5 to >0 pts Full Marks blank
0 to >0 pts No Marks blank_2
This area will be used by the assessor to leave comments related to this criterion.
pts
  / 5 pts
--
Additional Comments
This criterion is linked to a Learning Outcome Description of criterion
threshold: 5 pts
Edit criterion description Delete criterion row
5 to >0 pts Full Marks blank
0 to >0 pts No Marks blank_2
This area will be used by the assessor to leave comments related to this criterion.
pts
  / 5 pts
--
Additional Comments
Total Points: 5 out of 5