Here is the latest update of the source code.
* Large amount of code refactoring to make a more "proper" structure (not perfect but "better" than it was)
* Updates on lighting
* Double resolution on the player health and mana bars
* XRay Vision mode added to see through walls and doors
* Fixed an issue with floor tiles occasionally appearing much darker than they should
On that last item... there seems to be some kind of bug with InstanceObject(sourceObjectID). Not sure what exactly. But I spent an hour or more just trying to get rid of a weird glitch where occasionally a few floor tiles would appear much darker than they should. It only effected a few tiles in any one run and they were at different locations nearly every run although generally in the same areas. I think it may have something to do with how lighting interacts with instanced objects perhaps. Not sure.
Anyway, you will see in the code that at first I thought perhaps there was some limit for instanced objects that caused the issue so I broke out the single cube into creating several different cubes. One for floor tiles, one for wall tiles, one for ceiling tiles, one for doors and one for the enemies. This did not resolve the issue but I left that in place because I liked it better. Is better to more easily allow the code to be built on.
Anyway, then I simply changed the code so floor tiles (and ONLY floor tiles) do not create an instance of a existing cube object and instead each tile creates a cube from scratch and that resolved the issue.
If anyone wants to see the issue just find that line in the MapManager and you will see the original InstanceObject(cubeFloor) code commented out on the end. Uncomment it and occasionally you should see some random floor tiles appear much darker than they should be. Or possibly this behavior only occurs on certain graphics cards such as mine.
There is always the possibility it is something I am doing in the code but I don't think that is the case. Because if I remove the point lights entirely (tested that at one point too) the glitch goes away. If I set the floor tiles to not be effected by lighting the glitch goes away. And if I replace InstanceObject with creating cubes for each tile the glitch goes away.
At any rate... it is a non issue because just creating cubes instead of instancing resolves the issue. Hence... no issue. But thought I'd share the information anyway in case someone else runs into this same thing.
Okay, that is it. Hope you like the updates. I am not done refactoring the code yet. I will make a couple more passes on that and then add the Game States.
Source is attached. 119 KB
There may be some code commented out and some gibberish in there as I was messing around sorting out that glitch with floor tiles. I will clean it up sooner or later.
TI/994a (BASIC) -> C64 (BASIC/PASCAL/ASM/Others) -> Amiga (AMOS/BLITZ/ASM/C/Gamesmith) -> DOS (C/C++/Allegro) -> Windows (C++/C#/Monkey X/GL Basic/Unity/Others)