retroclouds, on Wed May 18, 2011 12:07 PM, said:
Features I'm gonna include:
* Viewport handling
You may want to check out the map scroller I worked on for Owen. I spent a few days writing and rewriting the code, trying different methods of virtual window scrolling, and what I ended up with was the most efficient I could come up with at the time. The main theories I tested were focused on handling the "edge cases":
1. Keep the player in the middle of the window and having buffer data in the map. A lot of modern games (Diablo2 is an example I'm very familiar with...
2. Like #1, keep the player in the middle of the window, but instead of having a half-window worth of extra data around the map, there is just a default character that is used to draw any characters that are in the window but not part of the map.
3. Keep the player in the middle of the window until an edge is encountered, then the player moves from the middle up to the edges. This keeps the map data inside the window at all times.
4. The player moves freely in the map and scrolling happens when the player bumps in to a virtual edge, usually a character or two from the edge of the window. Like #3, the map data is inside the window at all times.
What I found was that the logic to handle edges (#1 and #2) was prohibitive and added a lot of extra code and time to process the window. The theory is easy, the implementation gets tricky to keep things simple and efficient.
I went with #3 because for a game like Owen's, you want to be able to see what is coming, and if you have to be right up against the edge to get the map to scroll (option #4), then it is easy to be surprised by a monster or something on the map popping up within 1 character of your current location. With option #3, you have half a window worth of map to see what is coming.
Anyway, the code is heavily commented and you may want to look at it.
retroclouds, on Wed May 18, 2011 12:07 PM, said:
in my player. Only learned that just today.
Again, thanks to working on something for Owen, you may want to look in to the sound player I wrote for his games. If I remember correctly, I made it compatible with the system ISR player, as well as adding additional features like looping within a sound (to save data in songs that have repeating parts), and some other things (I can't remember the details now.) One sound can stop another, but I didn't do any kind of "merging" of sounds. Another idea is to provide the user an single voice for each sound, or let them choose how many to use for a given sound, then you can more easily merge and play sounds simultaneously that are using separate voices. Also, you could do something like two voices for continuous game music, and one voice plus the noise voice for short sound effects.













