+ZeroPage Homebrew Posted February 12, 2020 Share Posted February 12, 2020 1 minute ago, Karl G said: Cool. I won't be able to make the stream, thought. Probably for the best because it's hard for me to avoid giving advice when my games are played, anyway. It'll be a fun time today as we poke around every dark corner in the demo and try to level up as far as we can go! - James Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted February 13, 2020 Share Posted February 13, 2020 During the stream we noticed some problems with the line of sight. Sometimes walls disappear for no reason. Personally I am not sure if the concept works well on such a low res grid where you cannot look very far anyway. Quote Link to comment Share on other sites More sharing options...
+Karl G Posted February 13, 2020 Author Share Posted February 13, 2020 1 hour ago, Thomas Jentzsch said: During the stream we noticed some problems with the line of sight. Sometimes walls disappear for no reason. Thanks! I'll have to find that and investigate. 1 hour ago, Thomas Jentzsch said: Personally I am not sure if the concept works well on such a low res grid where you cannot look very far anyway. It's about the same visibility distance as the Ultima 3 game that inspired it. It may not be obvious from a glance, but the line of sight code is fairly vital for hiding things in the game like a dungeon on a mountain path, or a city deep in the forest. Anyway, I appreciate you passing this along! Quote Link to comment Share on other sites More sharing options...
+TwentySixHundred Posted February 13, 2020 Share Posted February 13, 2020 (edited) Just watched the ZPH stream and this game is truly ambitious. The more i was watching the more i like the line-of-sight feature. Never really played many JRPG's however i'm really wanting to sit though and play this. Zelda and Secret of Evermore are my favorites and i know their not the same but this is very impressive, well done ? Edited February 13, 2020 by TwentySixHundred 1 Quote Link to comment Share on other sites More sharing options...
+Karl G Posted February 13, 2020 Author Share Posted February 13, 2020 Re: line of sight, having reviewed some of the video, I'm pretty sure what you are seeing is my line of sight algorithm at work, which does have some limitations based on my limited time to run a line of sight algorithm. Dynamic line of sight like this is common in 2D RPGs and roguelikes. Here's one discussion of some of the more common algorithms in use for this purpose: http://www.adammil.net/blog/v125_Roguelike_Vision_Algorithms.html In the case of my game, I load the current on-screen map tiles into RAM during overscan, and then I need to blank out the non-visible tiles before the visible screen is run to avoid revealing anything hidden from sight. Currently, I am using raycasting with pre-computed lines from lookup tables, and a fair amount of interpolation due to a limited number of computational cycles to work with. The combination of the method used and the limited number of angles used for raycasting leads to some oddities like not all parts of all walls being visible in a shop from certain positions. Other times, things seeming to disappear out of sight for no reason is due to the presence of "solid" tiles in front that obscure vision. Here's an example of the outside of the town hall in Acadia. The two round tiles are pillars or big trees that are treated as "solid", and block line of sight: If I edit the map to remove these obscuring tiles, it looks like this instead from the same position: Many more tiles are then visible, other than the very corners due to the limitations of my raycasting algorithm described above. I think there are probably still improvements that can be made within the time constraints to help with some of these corner cases (literally!), though. @Thomas Jentzsch or @ZeroPage Homebrew - please let me know if there's anything I didn't notice in the video that maya have looked like a bug. Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted February 13, 2020 Share Posted February 13, 2020 (edited) In your example above, I can understand why the tiles behind the right pillar is blocked. And the tile which is one down and one left of the left pillar. But all the other nine blocked tiles seem wrong. I have never played Ultima 3, but IMO the current line of sight implementation is way too rigid and quite irritating. Maybe you could try a more different approach which when in doubt decides not to block. Edited February 13, 2020 by Thomas Jentzsch Quote Link to comment Share on other sites More sharing options...
+Karl G Posted February 13, 2020 Author Share Posted February 13, 2020 I definitely agree that there are tiles that are obscured that shouldn't be with my current approach. Fitting in a workable dynamic vision system within the CPU time constraints was one of my biggest early challenges. There's a bit of code that I can move to a different time slice that should free up a bit more time to improve my current algorithm. Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted February 13, 2020 Share Posted February 13, 2020 Don't worry too much. No one else has complained yet. Maybe I am just an overly sensitive person. And I am not into Ultima anyway, so... Quote Link to comment Share on other sites More sharing options...
+Karl G Posted February 14, 2020 Author Share Posted February 14, 2020 18 hours ago, Thomas Jentzsch said: Don't worry too much. No one else has complained yet. Maybe I am just an overly sensitive person. And I am not into Ultima anyway, so... That kind of feedback is still valuable to me nonetheless. I want the game to be accessible to people who have never seen the Ultima series, too, and not just the subset. of people who are active Atari hobbyists, and are already fans of the series. Seeing how I could improve my vision algorithm with the timing constraints i have should be a fun challenge. Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted February 14, 2020 Share Posted February 14, 2020 (edited) Maybe you could spread the calculations over multiple frames? With the number of visible tiles increasing from frame to frame? And/or you could do a delta calculation. So when you e.g. move right, you keep the visibility of the old tiles identical to the previous spot and and then re-calculate from right to left. That way the new tiles are always 100% correct and the old, already known tiles get corrected a bit slower. Also, I am not sure, why the calculations require that much time. I haven't implemented this, so maybe I am underestimating the complexity. But given the rather small size of the grid, it seems that visibility could be calculated using tables, no? Edited February 14, 2020 by Thomas Jentzsch 1 Quote Link to comment Share on other sites More sharing options...
+Karl G Posted February 14, 2020 Author Share Posted February 14, 2020 I like the idea of more tiles becoming visible on a second pass, which would probably be too quick to be noticed, but would be kind of like an image coming into focus, anyway. Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted February 14, 2020 Share Posted February 14, 2020 17 minutes ago, Karl G said: I like the idea of more tiles becoming visible on a second pass, which would probably be too quick to be noticed, but would be kind of like an image coming into focus, anyway. I like the idea of old tiles disappearing and only new tiles appearing better. Feels more natural. But I doubt the difference would be noticeable anyway, if you can fix the errors withing a 2nd frame. Quote Link to comment Share on other sites More sharing options...
+Karl G Posted February 14, 2020 Author Share Posted February 14, 2020 1 hour ago, Thomas Jentzsch said: Also, I am not sure, why the calculations require that much time. I haven't implemented this, so maybe I am underestimating the complexity. But given the rather small size of the grid, it seems that visibility could be calculated using tables, no? It is more complicated than I expected it to be when I first started researching it. A 12-piece 7 grid is 84 tiles, and way too many possible permutations to have in a lookup table. I pre-compute my lines for raycasting in a lookup table to save some processing time, though. Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted February 14, 2020 Share Posted February 14, 2020 (edited) 7 minutes ago, Karl G said: It is more complicated than I expected it to be when I first started researching it. A 12-piece 7 grid is 84 tiles, and way too many possible permutations to have in a lookup table. I pre-compute my lines for raycasting in a lookup table to save some processing time, though. Your grid is smaller (10 x 7 = 60) and you only need a table for one quarter (7 x 4 - 1 = 27) of it, no? All other quarters can use the same table, but mirrored. There are still 2^27 permutations though. But maybe this can be cut further down? BTW: Is a tile either blocking or not? Or do the different elements block differently? Edited February 14, 2020 by Thomas Jentzsch Quote Link to comment Share on other sites More sharing options...
+Karl G Posted February 14, 2020 Author Share Posted February 14, 2020 44 minutes ago, Thomas Jentzsch said: BTW: Is a tile either blocking or not? Or do the different elements block differently? Yes,it is an all or nothing thing, which makes it simpler, at least. Xoxoxo Edit: it's also not entirely symmetrical, since the hero isn't in the exact center (since he can't be with a width of 12 tiles). Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted February 14, 2020 Share Posted February 14, 2020 17 minutes ago, Karl G said: Edit: it's also not entirely symmetrical, since the hero isn't in the exact center (since he can't be with a width of 12 tiles). Yes, but the left 5 tiles are like the right 5 tiles, no? And the 6 column only exists on the right. Quote Link to comment Share on other sites More sharing options...
+Karl G Posted February 14, 2020 Author Share Posted February 14, 2020 5 minutes ago, Thomas Jentzsch said: Yes, but the left 5 tiles are like the right 5 tiles, no? And the 6 column only exists on the right. Yes, that's true. Quote Link to comment Share on other sites More sharing options...
+Karl G Posted February 16, 2020 Author Share Posted February 16, 2020 Good news! I was inspired by the discussion to devise a new visibility algorithm. It eliminates the quirks of the old method, works in one pass, and "only" takes 27 scanlines of vertical blank to complete. The only downside is that it takes more ROM space due to unrolling loops for performance reasons, but I have the space to accept that trade-off. Here's a few comparative screenshots of the old method vs the new: Outdoors Near Mountains In the Weapons Shop Pillars Outside City Hall I'll have to do more testing, but I haven't yet found any cases where the new code reveals something that should be hidden. Many thanks to @Thomas Jentzsch for pointing this out, and the discussion which inspired me to improve on my code. 7 Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted February 16, 2020 Share Posted February 16, 2020 That looks much better. So what's the trick? Quote Link to comment Share on other sites More sharing options...
+Karl G Posted February 16, 2020 Author Share Posted February 16, 2020 24 minutes ago, Thomas Jentzsch said: That looks much better. So what's the trick? In the diagram below, the plus symbols are tiles adjacent to the hero, and are always visible. The ones marked with "1" are straight or diagonal lines that can easily be determined by following the line from the hero, blocking out any tiles that are past any blocking tiles in the path of the line. Once all of those are figured out, the remaining tiles can be figured out through interpolation. Specifically, I check the two adjacent tiles that are closest to the hero, and if either of these is visible and not solid, then the tile in question is also visible. If both of the other tiles are not visible or solid, then it gets blanked out. 0123456789AB 0 XX1XX1XX1XXX 1 XXX1X1X1XXXX 2 XXXX+++XXXXX 3 1111+@+11111 4 XXXX+++XXXXX 5 XXX1X1X1XXXX 6 XX1XX1XX1XXX So, for example, when checking the tile at (3,4), the two tiles that are adjacent and closest to the hero would be (4,3) and (4,4). If either of those is visible and not solid, then (3,4) remains visible. If both are solid or not visible, then it get blanked out. Tiles need to be checked in the right order from the center out so that it is checking against two "parent" tiles whose visibility is already known. I wrote a C utility to figure out which two "parent" tiles to use for each of these tiles, and to generate the assembly code to check all of them. It was an interesting exercise for sure. 1 Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted February 16, 2020 Share Posted February 16, 2020 I had already thought about vertical and horizontal lines, but not about the diagonals. Clever. Looking forward to the next demo to see the new code in action. 2 Quote Link to comment Share on other sites More sharing options...
King_Salamon Posted February 18, 2020 Share Posted February 18, 2020 While some of the things you guys are talking about are a foreign language to me, I do find it interesting how the changes that are made to the game impact on what we see. I'm enjoying following the development of this title and will soon try out the demo as I recently received my Harmony Encore cart. I will continue to watch this thread and I look forward to future developments and the eventual cart release! 1 Quote Link to comment Share on other sites More sharing options...
MissCommand Posted February 18, 2020 Share Posted February 18, 2020 Definitely agreed... that looks much better! ?? Your new algorithm I think is much more logical for LOS. 1 Quote Link to comment Share on other sites More sharing options...
Asaki Posted February 22, 2020 Share Posted February 22, 2020 I feel like your new algorithm might even be better than the one British himself used. 1 Quote Link to comment Share on other sites More sharing options...
azure Posted February 22, 2020 Share Posted February 22, 2020 On 2/16/2020 at 1:46 PM, Karl G said: It was an interesting exercise for sure. That's when you're having fun. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.