I guess I'll start

The Partridge Family were neither partridges nor a family. Discuss.
albinopapa
Posts: 3745
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: I guess I'll start

Post by albinopapa » May 18th, 2019, 11:03 pm

NOOOOO!

I'm shocked at how dumb I can be sometimes. I get so focused on coding sometimes I forget to commit changes before implementing something that could break what is working. Then when it does break, I get so frustrated I just undo everything and now I can't get the parts I was working on back.

I'm crying right now.

Thanks MrGodin. I now have to redo some stuff, but at least I'll be starting from a working starting point.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

albinopapa
Posts: 3745
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: I guess I'll start

Post by albinopapa » May 18th, 2019, 11:16 pm

Oh, another thing I have been thinking of is surrounding connected tiles with lines. This way I'd check collision with a single line instead of a vector of tiles, both for lighting and entity collision. I'm thinking of changing the setup a bit for the map. The change would involve creating a tile map, around 800 x 800 tiles.

The way I handle collision right now is I have my player rectangle being clipped inside the room it's center is located. If the center is directly on the border between two rooms, then the rectangle could end up collapsing to 0, at least this is what is happening currently. This was to prevent crashes for negative indexes ( each room has their own tile vector, so 1 tile above the room would be y = -1 ). So while finding a tile in a particular room is easy enough, I think it might be easier to just use a grid of tiles, this would make finding a tile index by position a lot simpler and cleaner by just dividing the position of something by the tile size. The issue I keep thinking of is how the rooms are going to play out, though it could also be possibly easier and more aesthetic as they will no longer need to be symmetrical or uniform.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

MrGodin
Posts: 709
Joined: November 30th, 2013, 7:40 pm
Location: Merville, British Columbia Canada

Re: I guess I'll start

Post by MrGodin » May 19th, 2019, 5:26 pm

I've always been deemed a bad influence haha. Sometimes starting over is better ;). I use a grid of tiles myself for simple indexing. I've tried to encapsulate rows of tiles with lines before but couldn't get the algorithm correct.
Curiosity killed the cat, satisfaction brought him back

MrGodin
Posts: 709
Joined: November 30th, 2013, 7:40 pm
Location: Merville, British Columbia Canada

Re: I guess I'll start

Post by MrGodin » May 19th, 2019, 5:29 pm

These are of course simple indexing as you probably know

Code: Select all

inline uint getIndex(const uint& row, const uint& column)
		{
			return row * m_columns + column;
		}
		inline Math::vec2 getIndex(const uint& index)
		{
			return Math::vec2((float)(index % m_columns), (float)(index / m_columns));
		}
		inline uint getIndex(const Math::vec2& worldPos)
		{
			uint r = (uint)worldPos.y / m_cellHeight;
			uint c = (uint)worldPos.x / m_cellWidth;

			return getIndex(r, c);

		}
Curiosity killed the cat, satisfaction brought him back

albinopapa
Posts: 3745
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: I guess I'll start

Post by albinopapa » May 19th, 2019, 9:12 pm

Y'all like games that troll it's players?

The reason I ask is as a way of simplifying my job as a programmer, I am sorting a container in descending order. This container is used to pick which rooms to place keys in which unlock doors. I did this so I can just loop through the container and remove those elements from another container that lists all possible rooms to place chests in. Now, what I'm planning is to have the first element in the first container ( container A is a list of indices into container B which stores the room indices of candidates ) be unlocked or unblocked while the last two are blocked by doors requiring keys.

What this means and the reason for the questions is by doing this, you'll have to fight your way through the maze almost to the end, get the first key and go back through the maze to collect each of the other keys before returning to the end to open the last room where the exit is. This may not always be the case now that I think about it as the rooms for chest are picked at random, perhaps this is just a coincidence of the current randomly chosen rooms.

Haven't started on the rework of the tile map yet, I'm really dreading it, but I'm thinking it through before I go all gungho ( wow, gungho isn't in the list of acceptable words, but bunghole is? ).

I'm going through and recovering some stuff that I had lost because of the brain dead moment I had, which refers to the information above.

Seeing as how I'm now incorporating item collection, I suppose I also need to implement an inventory, which was actually planned as the game is suppose to be a dungeon crawler. I know I want to include the usual health and mana potions, perhaps weapons though I'm not sure about this one as I would probably need to render out each character with with each weapon type, but maybe once I get the code done adding sprites will be the only thing left to do.

I need to design and render out some enemies and their animations, not looking forward to this as I feel I'm not very creative in this aspect. I'm really not sure what genre this is even going to be ( fantasy, sci-fi, etc.. ). I could do demons, cyborgs, aliens, mythical creatures...I just don't know yet. Ok, I did/do have one idea so far for an enemy, but I'll definitely need to wait for the rework to actually implement this thing. My idea is a wall crawler that lobs projectiles at you and it can only move along walls.

Since I haven't decided on enemeis, I also haven't decided on behavior either. I can't decide if I want enemies or at least some enemies to be able to search through the maze for the hero or not. I'm also thinking of how to spawn these "creatures" in. I'm wondering if I should just spawn them in at level creation or have them spawn in periodically.

I've debated on a mini-map, part of me feels like it would make things too easy and I kind of like the idea of having the player getting out pencil and paper and making their own maps or at the very least writing down directions. My son and I went through and wrote down all the coordinates of rooms that had multiple paths, then wrote the direction of the path we should take to reach the end. Without directions and taking either all left turns or all right turns, it took around 35 minutes to find the end. With the directions it still took around 15 minutes IIRC. Add in some obstacles like monsters and a bit of backtracking by way of gathering keys and each maze could easily take another 45 minutes or so.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

MrGodin
Posts: 709
Joined: November 30th, 2013, 7:40 pm
Location: Merville, British Columbia Canada

Re: I guess I'll start

Post by MrGodin » May 20th, 2019, 1:36 am

I use sprite sheets.. there are 4 strips (rows) of animation each with 8 columns(frames) to iterate through in the art here. The movement component, through it's directional value, sets the row or strip to iterate through. Theses entities have a walk,thrust,slash and die animations.(currently on walk).
This is what it looks like (doing multiple path finding for all entities here).OpenGL here btw
Attachments
example.png
(634.39 KiB) Not downloaded yet
Last edited by MrGodin on May 20th, 2019, 2:11 am, edited 1 time in total.
Curiosity killed the cat, satisfaction brought him back

MrGodin
Posts: 709
Joined: November 30th, 2013, 7:40 pm
Location: Merville, British Columbia Canada

Re: I guess I'll start

Post by MrGodin » May 20th, 2019, 1:43 am

for tiles or maps i do this... Load a text file

Code: Select all

tileswide 46
tileshigh 44
tilewidth 64
tileheight 64
filename map2.png

layer 0
47,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,49
52,0,0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,21,0,0,0,0,0,0,0,0,0,0,0,21,4,5,5,6,8,16,21,21,21,21,21,0,0,0,0,0,0,0,0,0,0,0,0,52
52,0,0,0,0,0,0,0,0,21,0,0,0,0,0,0,0,0,0,0,0,21,4,6,8,12,14,16,21,21,21,21,21,0,0,0,0,0,0,0,0,0,0,0,0,52
52,0,0,0,0,0,0,0,0,21,0,0,0,0,0,0,0,0,0,0,0,21,4,12,14,5,5,16,21,35,36,37,21,0,0,0,0,0,0,0,0,0,0,0,0,52
52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,21,4,5,15,19,19,20,21,38,40,43,21,0,0,0,0,0,0,0,0,0,0,0,0,52
52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,21,4,5,16,0,0,21,21,44,45,46,21,0,0,0,0,0,0,0,0,0,0,0,0,52
52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,17,18,20,0,0,21,21,21,57,21,21,0,0,0,0,0,0,0,0,0,0,0,0,52
52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,21,31,25,25,22,22,22,22,24,25,28,0,0,0,64,57,57,0,57,58,0,0,0,52
52,0,0,0,0,0,0,0,21,0,0,0,0,21,0,0,0,0,0,0,0,21,21,21,21,21,21,21,21,21,21,21,27,0,0,0,59,0,0,0,0,56,0,0,0,52
52,0,0,0,0,0,0,0,0,0,0,21,0,0,0,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,26,0,0,0,59,0,0,0,0,56,0,0,0,52
52,0,0,0,0,0,0,0,0,0,0,0,0,21,0,0,0,0,0,0,21,21,21,21,0,0,0,0,0,0,0,21,26,0,0,0,59,0,0,0,0,56,0,0,0,52
52,0,0,0,0,0,0,0,21,0,0,21,0,0,0,0,0,0,0,21,21,21,21,21,0,0,0,0,0,0,0,21,26,0,0,0,59,0,0,0,0,56,0,0,0,52
52,0,0,0,0,21,0,21,0,0,0,0,0,21,0,21,0,21,0,21,21,21,21,21,0,0,0,0,0,0,0,21,26,0,0,0,61,62,62,62,62,63,0,0,0,52
52,0,0,0,0,0,0,0,0,0,21,21,0,0,0,0,0,0,0,0,0,21,21,21,0,0,0,0,0,0,0,21,26,0,0,0,0,0,0,0,0,0,0,0,0,50
52,48,48,48,48,48,49,0,0,21,21,21,0,0,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,26,0,0,0,0,0,0,0,0,0,0,0,0,50
22,22,22,22,22,28,50,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,26,0,0,0,0,0,0,0,0,0,0,0,0,50
52,48,48,48,49,27,53,0,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,21,26,21,21,21,0,0,0,0,0,0,0,0,0,50
52,0,0,0,50,31,25,25,25,25,25,22,22,25,25,25,25,25,25,25,25,25,25,25,25,25,25,28,21,21,21,21,27,21,21,21,21,21,21,0,0,0,0,0,0,50
52,0,0,0,53,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,23,22,22,22,22,29,21,21,21,21,21,21,21,21,21,21,0,0,50
52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,27,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,0,0,50
52,0,0,0,0,47,54,54,54,54,54,54,54,54,54,54,54,54,49,0,0,0,0,0,0,0,0,27,21,21,21,1,2,2,2,2,2,2,2,2,3,21,21,0,0,50
52,0,0,0,0,50,0,0,0,0,0,0,0,0,0,0,0,0,50,0,0,0,0,0,0,0,0,27,0,21,21,4,5,5,5,5,5,5,5,5,16,21,21,0,0,50
52,0,0,0,0,50,0,47,54,54,54,48,0,48,48,48,49,0,50,0,0,0,0,0,0,0,0,27,0,21,21,4,5,5,5,5,5,5,5,5,16,21,21,0,0,50
52,0,0,0,0,50,0,50,0,54,54,54,54,54,54,51,52,0,50,0,0,0,0,0,0,0,0,27,0,21,21,4,5,5,6,7,7,8,5,5,16,21,21,0,0,50
52,0,0,0,0,50,0,50,0,0,0,0,0,0,0,0,52,0,50,0,0,0,0,0,0,0,0,27,0,21,21,4,5,5,9,10,10,11,5,5,16,21,21,0,0,50
52,0,0,0,0,50,0,50,0,54,54,54,54,54,54,0,52,0,50,0,0,0,0,0,0,0,0,27,0,21,21,4,5,5,9,10,10,11,5,5,16,21,21,0,0,50
52,0,0,0,0,50,0,53,54,54,54,54,54,54,54,54,55,0,50,0,0,0,0,0,0,0,0,27,0,21,21,4,5,5,12,13,13,14,5,5,16,21,21,0,0,50
52,0,0,0,0,50,0,32,0,0,0,0,0,0,0,0,0,0,50,0,0,0,0,0,0,0,0,27,0,21,21,4,5,5,5,5,5,5,5,5,16,21,21,0,0,50
52,0,0,0,0,53,54,54,54,54,54,54,57,54,54,54,54,54,55,0,0,0,0,0,0,0,0,27,21,21,21,4,5,5,5,5,5,5,5,5,16,21,21,0,0,50
52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,27,21,21,21,17,19,19,19,18,19,19,19,19,20,21,21,0,0,50
52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,22,22,22,22,22,22,22,29,21,21,21,21,21,21,21,0,0,50
52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,0,0,50
53,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,55
The numbers are indexes to which part of the sprite sheet to draw at that tile.
I then deem them passable or not
Curiosity killed the cat, satisfaction brought him back

MrGodin
Posts: 709
Joined: November 30th, 2013, 7:40 pm
Location: Merville, British Columbia Canada

Re: I guess I'll start

Post by MrGodin » May 20th, 2019, 1:50 am

Another shot. the camera is following an entity (the last one created via a loop for testing)
Attachments
example2.png
(803.27 KiB) Not downloaded yet
Curiosity killed the cat, satisfaction brought him back

albinopapa
Posts: 3745
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: I guess I'll start

Post by albinopapa » May 20th, 2019, 5:32 am

I'm rendering out the sprites using a 3D application and haven't wanted to take the time to compose them into a sheet yet, but I'm not sure it's worth the effort to do so.

I have done the stage tilemap using text before, it's super easy to create and manipulate, but for this game I'm doing as much as I can procedurally, just to save time. I will more than likely use something like that for a platformer or an RPG as it appears you are making.

How did you do your lighting effect? Is it just a circular alpha gradient?
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

albinopapa
Posts: 3745
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: I guess I'll start

Post by albinopapa » May 20th, 2019, 5:38 am

Oh, to add to the topic of a sprite sheet, I have thought about how I might do it using the 3D application. I'd just have to have multiple copies of the characters arranged in the manner I'd like them presented then just pull back the camera until all models are in view and disable perspective. Not trying to dismiss anything you're sharing, I just wanted to prove that I had given it some thought. Doing it this way, I wouldn't have to compose a sprite sheet using all 240 frames for each character, but I don't know if my 8GB computer can handle that many instances of the character. Well, it could if I started from a fresh boot. After many naps throughout the day and usage, I end up with less than 1GB left. I'm guessing some memory is set aside for caching that isn't released when programs are closed.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

Post Reply