So, I've spent 24 hours finding a million ways NOT to solve my problem. I kept on getting side-tracked and forgetful, which lead to me solving problems that are already solved via map design or tackling way too complicated of systems. Then I started to forget that my pathfinding was largely okay, the real problem was the diagonals and long story short I got very very detoured. At some point, I realized it all boiled down to three possibilities:
1) A straight shot. Either going left/right OR up/down would take you safely to your goal.
2) A double shot. Going left/right THEN up/down would take you safely to your goal. I spent a lot of time trying to optimize it so that it would try the "shorter way" first before I realized: It didn't matter! So long as there's not a wall in the way, go for it!
3) The avenue shot. Going Up/Down to the Avenue, Across to your Destination'sX and then Up/Down to your Destination Y would take you safely to your goal. This is how my previous attempt was solving all problems with a vertical and a horizontal element and it was adding a superfluous third step. Because my map design guarantees there's always a Y path to the Avenue, I don't need to get into fancy stuff to find a path to it, which is ALSO something I forgot and spent a lot of pointless time trying to solve.
Once I reduced the problem to those three possibilities I was better able to tackle it and I think I'm probably 95% done with the new solution to the pathfinding thing. Hopefully it works.
It wasn't all wasted effort though. I started a seperate file to test a "MoveQueue" idea, in which there's a collection of slices detailing the necesary moves. Every tick the game checks to see if there's something in the queue. Let's say I'm standing at 6,18 and I want to go to 4,12. Using extra slice data, I'd add two slices/entries to the queue
"4,18,X"
"4,12,Y"
Letting it know that first I want to move in the plane of X to 4 and secondly that I want to move in the Plane of Y to 12. Even though I only ever move in one plane, I record the other one so I can be sure that I'm always properly aligned to the grid before I start the next move. The test of that worked really really well, so once I get the pathfinding to correctly feed entries to the queue, I think things will be marvelous and no one will get stuck in the walls anymore.
Talked with Charbile and Hawk a bit, and they had their two cents to put in. Not sure I'm going to commit to their changes, but it's always nice to have extra opinions. Seen some previews of Feenicks project and he's even crazier than I am! Sure do hope he pulls it off!
Final development of the day was a test of something I'm calling the Mixtape System, another inspiration I owe to Taco Bot. It frustrates me sometimes how OHR Games loop the same song over and over and over so many times. Never thought there was a good way around it, till Taco Bot talked about using a
Timer to count down the length of a song for some kind of dancing minigame. Timers, as it turns out, obey basically NONE of the standard rules for butting into scripts. I never knew that, I always thought they were some kind of a shortcut for For loops.
By manually programming the length of a song and utilizing a timer, I can have a song play once and then start the next one. Or have a song play once and choose to start another at random. All of it without interfering with the more important stuff goin on in the other scripts!
My code for the demo looked something like
Code:
plotscript,TimerDemo,begin
variable (WhichSong)
WhichSong := Random (0,2)
switch (WhichSong)
do (
Case (0)
#2 minutes, 47 seconds
SongLength := 168
PlaySong (0)
Case (1)
#1 Minute, 41 Seconds
SongLength := 101
PlaySong (1)
Case (2)
#3 Minutes, 28 Seconds
SongLength := 188
PlaySong (2)
)
SongOneQuarter := SongLength/4
SongOneHalf := SongOneQuarter *2
SongThreeQuarters := SongOneQuarter+SongOneHalf
SetTimer (0,SongLength,18,@TimerDemo,1,(TimerFlag:Menu,or,TimerFlag:Battle))
end
There's some silly shit cluttering it up so I can do stuff at different times in the song, but it shouldn't be too hard to figure out. If anyone else wants to use it, they're more than welcome. In theory, you could have different commands to play like... the action mixtape, the romance mixtape, suspense mixtape, etc. as mood dictated. You could even marry it to some GUI and slices and provide the player with a variety of songs that they could choose from to use in different situations. Don't know that I'm going to go that far, but I'm arguably more excited about this than I am about anything else. Whoever invented Timers is the best.
(Whoever made sure custom resolutions would work on Android is a close second, but I still don't have a phone so am unable to monkey with it.)