Great ideas. Although my system doesn't use collision checks at all
It checks nodes and direction.
To explain, everything in the game is measured to be a specific height and width so that it fits. This is actually very easy and all the sprites will have size catagories. T^s T= is the constant tile size height and width, s is the size catagory, for smaller sprites -s for larger sprites +s, and this will only be necessary for the artist to understand as when the sprites are finished they only need to be set up so thay we know how many nodes they take up by ((T^s)/(T/2))
This method makes it were collison detection is based on if the node is blocked, is in adjacent node, or occupies the same node, respective to the action.
Example:
0 = blocked
- Code: Select all
0, 0, 0, 0
0, 1, 1, 0
0, 1, 1, 0
0, 0, 0, 0
The player can only move to 1,1; 1,2; 2,1; 2,2; Not because the player is colliding with an object, but simply because to the computer that spot cannot occupy anything, unless we specifically put it there.
If a creature comes in and occupies 2,2 then that value goes from 1 to 0 and becomes blocked.
For increasing/decreasing speed its just a matter of checking the value of the node and multiplying it by the speed of the creature/player.
Linked Lists are pretty simple. Its a user created structure that has a value and a pointer. The pointer points to the next value in the linked list.
You have to link the list yourself, and create functions for handling the list. But there are many already designed that can be used. I wrote about them and put an example here in the useful functions.
viewtopic.php?t=11159&p=77564#p77564But they can be used in place of checking if a node is blocked simply by setting pointers to that position to null until it becomes free again.
There are a lot of things to be handled when using pointers though but they can be used to our advantage of speed. Sometimes two calls try to access the same space in memory, but only one can access it at a time. So if enemy 1 is moving through the linked list and has locked a node, and another enemy tries to access that same node it will return null and we need to handle that by If(pointer == NULL) try to find a new path, or wait until that spot is free to access.
Where the If is usually a for loop iterating through a path.
As for checking other things such as ranged attacks, they are placed into the object layer and when they occupy an area with a creature it deals damage to that creature as well as any additional effects.
The method I purpose will have absolutely no empty space, the object layer stacks objects tightly in a 1D array. But the array is only an array of pointers to the structures. The structures themselves can be created dynamically through the linked list, that's why I purpose an Array/Linked List hybrid is because an array allows for random access at the same rate while a linked list allows for faster manipulation of memory and sorting. Because when we want an object at the top of the stack we don't shift around objects in the array, we just change the what the pointers point too.
About graphical nodes, when using animations and moving objects around usually you do this in pixels per frame. The only issue is, often you are calling the same problem twice, basically, "move forward 3 pixels-> advance image 3 pixels" People don't even see half the movements made because it happens so fast, but the CPU notices it. It has to calculate the same problem multiple times just for one movement. With graphical nodes you set a position to be the center of where the image needs to go. So its while not at the node, keep going. Also it allows for forward intuition. Instead of, going until collision with pixel area; Its, check to see if I can go there, if not stay where I am. Where the former would have to make multiple moves until it found out that it can't go any further, the latter knows it can't go any further without actually hitting a physical wall.
As for the walls, they are using the original tileset with a couple halftiles to create corners. This way the wall can become semi-transparent and the player sees the wall still but can see his position behind it.
A lot of my ideas for this come from playing Diablo 1. I practically want to rebuild that game from scratch and enhance it a lot. Nodes will also allow for random maps. Where rooms connect by entrance nodes.
As for the tiles themselves. I would like to be able to have it where the map editor and game can link to an outside resource folder (if this is possible) rather then compiling all the images into the exe. It would be nice to use the canvas for tiles but I think for now we should just stick to .png files for animations and images. The floating layer is often going to only hold a fraction of the tiles that the tile layer has. This layer is also going to be used to allow for players to enter buildings and go behind them.
The tile set, while we COULD use a char array, we could just keep an int array, even though its quite larger it will allow for many many more tiles. Besides, with newer computers they have enough storage for a 4,000,000 int array. I did it from ram and it didn't cause a problem at all. If we were porting to mobile devices then we can modify it to use a char array with smaller maps and limited tile sets.
Pretty much these methods are almost "cheating" we don't want to make the computer do or think more than it has too. When it comes time to implement AI, we want as much cpu power as possible and making it as easy as possible for the AI to do its job of finding and eliminating the player, or in most cases finding and dying for the player.
But for now, my goal is to just build a map. One that a player can walk through and even with no AI, no Story, almost no content, can still enjoy the intensity and vastness with minimal processing power. The map could start off as a simple exploration game where you are a simple player that just walks through the world and discovers the new places, exploring the environmental dangers and puzzles of the map. Then when we can get a simple Attack AI and a more defined player it gets more interesting.
One of my goal games is called "Endless Dungeon" You create a player and start to explore the first level of the dungeon, fighting weak monsters and solving simple puzzles. But as you go deeper into the dungeon, the monsters get harder, the puzzles get harder, the maze of the dungeon gets larger. No two endless dungeons are the same. They are all randomly generated and once you enter, there is no going back. At various intervals of the levels until a point, there is a shop level, where you can go to repair armor, buy new armor and weapons, buy potions and other consumables. But soon the shops end, and all that is left is the endless dungeon. You have to pick and choose your loot. Which spare armor piece do you keep, what spare weapons to hold, of the variety of potions: do you keep the larger stronger potions even though you have less of them, or do you keep the smaller weaker potions because you have many.. Your armor is looking rusty and acid jelly's just ate your sword.. What kind of weapons to use, what skills to learn, what spells to invest time training. All of these become factors as you delve deeper into the "Endless Dungeon".