Re: Learning how to code free movement and panning in a game like Swamp.

A good transformation matrix library in Python is gameobjects.  The tutorial I need to write is the important bit here: it's like having the sine and cosine functions in that you can call them but probably have no idea what's going on.  Transformation matrices are super, super useful but also kinda complicated even in library form-said library isn't giving you a pan this sound primitive, it's giving you the stuff you need to work with transformation matrices.  I'm putting the explanation here, but you probably just want to fight with that code-there are too many prerequisites for how and why this works for me to just give you my mental model.
The general approach, however, is to construct a 3d transformation matrix in which the left-most column is a unit vector in the direction which the player is facing, the middle column is a unit vector in the direction to the right of the player, and the third column is the unit vector pointing alon g the positive z axis.  The fourth column is much more complicated, and I can't remember-but that's why we have libraries.  This entire construction is usually one function call to the matrix library (usually called lookAt or similar). You then pad all your coordinates with 0 for z, feed them through it, and then compute the angle with the y axis to get the value you need.
If you're wondering why I'd go through all the effort, there's a few reasons: the formulas that involve dot products and cross products are usually much, much simpler than the formulas involving trig functions; this is because the dot and cross products have direct physical interpretations.  The second is that literally anything you use from the sighted world is going to expect you to use 2D transformation matrices at least.  The third is that moving the entire world like this is super useful for a variety of other things like radars.  And fourth, this is how sighted game programers have been doing it for years; I can leverage all that wonderful and highly capable code.
To put it in a much simpler way.  You can say that you are ten feet east of the flagpole facing northeast, which is fine.  But you could also say that you're at the origin facing north and that the flagpole is 10 feet southwest of you.  Which is also fine and describes exactly the same thing, just in a different way.  What transformation matrices are doing is allowing you to change how you look at the world--with them, you can make the player literally the center of the universe whenever you want.
This is probably the most literal interpretation of the universe revolving around you anywhere, and it's a powerful concept.  Just really, really complicated to learn in the first place as a blind person as we don't have all the pictures sighted people do.  Most tutorials on the subject say "look at this picture. Got it ? Good, how about this one." with barely any text.

_______________________________________________
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Off-topic room : frastlin via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : frastlin via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : frastlin via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : frastlin via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : frastlin via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : frastlin via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : frastlin via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : frastlin via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : frastlin via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : Aprone via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : frastlin via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : Aprone via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : camlorn via Audiogames-reflector

Reply via email to