Page 11 of 14

Re: SCP-860 implementation list + discussion

Posted: Tue Dec 24, 2013 7:45 am
by MonocleBios
As promised here's the writeup. Wall of text incoming:

I'm gonna assume you know how to replicate risingstar's step algorithm in B3D, just make sure the tile values are stored in a dim array. I can't remember what Miro wanted it seeded to, but it shouldn't change too much.

Like the Pocket Dimension and other non-seeded rooms, stick the forest at the edge of the room array (can't remember what it was called, just follow Regalis' pattern and it should be fine) When you add the room to the FillRoom function, load each asset into the room's objects array, and hide them.

As for tile generation, I used event state as a global timer, and the remaining 2 event states as tile coordinates. So basically, every few frames or so, read from the forest dim array, copy the appropriate mesh from the room's object array, enable collision, do other stuff to the tile, place tile at an awkward positive Y coordinate to prevent clipping into the PD, increment stuff, and continue until the forest is finished. When the player leaves the forest you can just re-initialize the dim array(s) to delete everything. (You should probably define tile as a type and store them in dims so you can keep track of how many trees/other stuff there are per tile and use the index to appropriately hide stuff. I was going to do this to fix stuff, but never got around to it)

During generation, the GPU doesn't take that great of a hit in performance. The greatest drop anyone's ever recorded was an average of 1-2 FPS, so you don't need to worry about how often or when the forest generates a tile.

My optimization code was pretty meh, it was incredibly sloppy in order to get a quick release within a few days or so. (Ironic, isn't it?) Apparently, B3D's renderer isn't that effective at hiding things that aren't in the camera's range, so I had to do that manually. (Again, if you index tiles and their contents, this is much easier on the CPU as you can just use the player's position) Tree's are pretty simple, just slap em' on the tile however you wish. Same for rocks. I can't exactly remember how I got the leaves to work, but I'm pretty sure I made them separate from the trees, though, that could just be because I have no idea how to export stuff with fragmotion. I never really got Miro's grass to work well up close due to B3D's renderer doing weird things over the Z axis. I only ever got two benchmark reports, so I didn't have a very accurate depiction as to how optimized the entire thing was. But from what I've seen, the GPU takes a pretty heavy load when I introduce leaves to the forest. I still have no idea why this is, but my guess is that the renderer doesn't like rendering too many alpha textures.

We never really did anything with the monster, and I don't know if the concept is even finalized, but I'd recommend against using A* or an equivalent algorithm for movement. It just doesn't feel worth it with the lack of complexity it's design currently has. That and just remember to load all the data for it when the game starts, rather than when the forest generates.

So that's basically what I did with the forest, everything else was really easy or was for dev purposes.

If something doesn't make sense or I forgot something, let me know.

Good luck.

oyea, risingstar said he might work on it, which is pretty cool.

[insert skeptical comment about how this project will never be finished because nobody bothers to keep interest in it longer than a week here]

Re: SCP-860 implementation list + discussion

Posted: Tue Dec 24, 2013 7:27 pm
by juanjp600
I'll see what I can do to optimize the forest. Could you describe the forest's generation algorithm? It's the only thing I need to port it to Blitz3D.

Re: SCP-860 implementation list + discussion

Posted: Tue Dec 24, 2013 8:09 pm
by Mirocaine
Alright thanks for the write up monocle,

I have all the assets still; so it's easy to get them into the forest again. I have another windows laptop so I can take a while to convert all the props from fragMOTION to .b3d.
Still need to do the monsters animations, that's always tough. Then again it's also tough to ask someone to spend a great deal of time to do the forest code and stuff. Honestly we could do a very basic version with release and keep adding onto it. I think that will renew some enthusiasm.

Re: SCP-860 implementation list + discussion

Posted: Tue Dec 24, 2013 9:39 pm
by MonocleBios
juanjpro wrote:I'll see what I can do to optimize the forest. Could you describe the forest's generation algorithm? It's the only thing I need to port it to Blitz3D.
It made paths by stepping through an empty array. Made use of direction variables for traversal, then added the last row manually. Special tiles were added by placing nodes during the generation of the main path.

Re: SCP-860 implementation list + discussion

Posted: Tue Dec 24, 2013 11:21 pm
by juanjp600
MonocleBios wrote:
juanjpro wrote:I'll see what I can do to optimize the forest. Could you describe the forest's generation algorithm? It's the only thing I need to port it to Blitz3D.
It made paths by stepping through an empty array. Made use of direction variables for traversal, then added the last row manually. Special tiles were added by placing nodes during the generation of the main path.
Thanks, now I have an algorithm that seems to be good enough. Here's a sample:
Spoiler

Code: Select all

2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 
0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 1 1 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0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 0 0 0 0 
2 2 2 2 2 2 2 2 2 2 2 2 2 3 2 2 2 2 2 2 2 2 2 2 2 
And here's the code itself:
https://www.mediafire.com/?6a7u763gz2qd9on
It might need some optimization, but I think it's good enough for testing.

Re: SCP-860 implementation list + discussion

Posted: Tue Dec 24, 2013 11:53 pm
by Mirocaine
juanjpro wrote:
MonocleBios wrote:
juanjpro wrote:I'll see what I can do to optimize the forest. Could you describe the forest's generation algorithm? It's the only thing I need to port it to Blitz3D.
It made paths by stepping through an empty array. Made use of direction variables for traversal, then added the last row manually. Special tiles were added by placing nodes during the generation of the main path.
Thanks, now I have an algorithm that seems to be good enough. Here's a sample:
Spoiler

Code: Select all

2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 
0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 1 1 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 
2 2 2 2 2 2 2 2 2 2 2 2 2 3 2 2 2 2 2 2 2 2 2 2 2 
And here's the code itself:
https://www.mediafire.com/?6a7u763gz2qd9on
It might need some optimization, but I think it's good enough for testing.
u stole my heart already.

and we have to save all this like right now so we dont lose it in the future (possibly, MAYBE..)

Re: SCP-860 implementation list + discussion

Posted: Tue Dec 24, 2013 11:53 pm
by risingstar64
juanjpro wrote:Thanks, now I have an algorithm that seems to be good enough. Here's a sample:
Spoiler

Code: Select all

2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 
0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 1 1 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 1 0 0 0 0 0 1 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3 2 2 2 2 2 2 2 2 2 2 2 
And here's the code itself:
https://www.mediafire.com/?6a7u763gz2qd9on
It might need some optimization, but I think it's good enough for testing.
That looks pretty good to me. This is the script I put together for Monocle last year: http://www.mediafire.com/view/v78zsgchn ... erator2.py
It's a python 3.2 script (he ported it to Blitz himself). The only major difference from yours is that I had some extra checks when creating branches to avoid path branches reconnecting to the correct path, or running directly next to any other paths. That and a low chance of creating special tiles.

Re: SCP-860 implementation list + discussion

Posted: Wed Dec 25, 2013 5:38 pm
by juanjp600
risingstar64 wrote:That looks pretty good to me. This is the script I put together for Monocle last year: http://www.mediafire.com/view/v78zsgchn ... erator2.py
It's a python 3.2 script (he ported it to Blitz himself). The only major difference from yours is that I had some extra checks when creating branches to avoid path branches reconnecting to the correct path, or running directly next to any other paths. That and a low chance of creating special tiles.
Here's a Blitz3D port of your algorithm: https://www.mediafire.com/?p44pd8fcrqpmhfj
This implementation uses a 1D array instead of a 2D Dim array, so the forest doesn't need to be defined globally.

One thing I noticed about this algorithm is that the doors are forcibly placed at the center of the grid. If players noticed this, they'd just run straight through the forest since it'd probably be the easiest way of reaching the other door.

Re: SCP-860 implementation list + discussion

Posted: Wed Dec 25, 2013 6:25 pm
by risingstar64
juanjpro wrote:
risingstar64 wrote:That looks pretty good to me. This is the script I put together for Monocle last year: http://www.mediafire.com/view/v78zsgchn ... erator2.py
It's a python 3.2 script (he ported it to Blitz himself). The only major difference from yours is that I had some extra checks when creating branches to avoid path branches reconnecting to the correct path, or running directly next to any other paths. That and a low chance of creating special tiles.
Here's a Blitz3D port of your algorithm: https://www.mediafire.com/?p44pd8fcrqpmhfj
This implementation uses a 1D array instead of a 2D Dim array, so the forest doesn't need to be defined globally.

One thing I noticed about this algorithm is that the doors are forcibly placed at the center of the grid. If players noticed this, they'd just run straight through the forest since it'd probably be the easiest way of reaching the other door.
Wow, excellent work! I haven't looked at the source yet but if you already ported it I'm extremely impressed. I can't remember why I chose that door placement as it was awhile ago when I wrote it, but I don't see why not allow the doors to be created at any position on the wall, so please feel free to change that. I'm excited to see how you tackle the rest of the generation script.

Re: SCP-860 implementation list + discussion

Posted: Wed Dec 25, 2013 6:36 pm
by Mirocaine
sweet work Juan, always encouraging to see such progress again already (:

Right now I'm working on the monsters animations, I think I'll just give it a simple texture and maybe we could add a particle effect along with it. I'll post a video about it when I get them done. (Always hard to make realistic animations). My laptop fan sounds like a hairbuzzer and is pretty hot, so I'll also have to check that in later. Lol.