Khamis, Mac 05, 2020

Coordinate Transforms, Still

Last post was about my attempt at explaining coordinate transforms. Progress has been slow. I've implemented many of the diagrams but I'm still having trouble with the narrative. Last time I said this was my outline:

  1. Show a side scrolling game with some cool camera effects.
  2. Introduce world coordinates vs screen coordinates.
  3. Solve the problem of scrolling: subtract an offset.
  4. Introduce transforms. (may need to be later)
  5. Introduce inverse transforms, for mouse clicks. (may need to be later)
  6. Introduce cameras. More complicated than offsets, but can do more.
  7. Show some cool effects with cameras. (may need to be earlier)
  8. Introduce chaining transforms.
  9. Show some cool effects with chaining.
  10. Demo showing all concepts together.

I've been experimenting with different orders for the topics and now think there are two intertwined "tracks": the concept track introduces mathematical concepts and terminology, and the problem solving track shows solutions to specific gamedev problems. These two tracks are paired up:

Problem solving Concept
scrolling world/screen coordinates, translate transform
following the player cameras, view coordinates
tile grid coordinates scale transform, chaining transforms
mouse clicks inverse transforms
? function composition
? transform matrices

I think in each case I should start with the problem to be solved, then show the immediate solution, then explain the concept behind the solution. The concepts then lead to a reusable solution. Example:

  1. Problem: we want to scroll the screen
  2. Immediate solution: add an offset before drawing
  3. Concept: we're transforming world coordinates to screen coordinates
  4. Reusable solution: a translate transform is a function or object that converts coordinates

The next section is:

  1. Problem: we want to keep the player in the center of the screen
  2. Immediate solution: use the player plus half the screen size as the offset
  3. Concept: a "camera" points at the player, using view coordinates
  4. Reusable solution: a camera object is placed in the world, and we use that to build the translate transform

What order should I present these topics? I'm not sure. I know I want to put scrolling first. If I put mouse clicks second, then it's fairly easy to solve, and there's less motivation to learn inverse transforms. So I might put that later. If I put tile grid coordinates second, then it leads to chaining transforms together, which will be useful for following the player with a camera. Or if I put following the player second, then it leads to view coordinates, which might further motivate chaining transforms.

I think the main problem is that I'm not feeling particularly inspired right now, so I'm working very slowly.

Tiada ulasan: