My Dungeon Game is slow, any redux gurus want to take a look?

My Dungeon Game is slow, any redux gurus want to take a look?
0

#1

Hey Guys,

I finally finished (ish) my Dungeon Game with React and Redux. I have done anything I could to boost the performance (using shouldComponentUpdate, using ImmutableJs, using Redux Reselect) but still when there is no shadow applied to the tiles and you would move fast (keep pressing arrow keys) you will notice the lagging. Anyone has any suggestions for increasing performance even more?

Here is the code:


#2

I dont have answer for your question, but I do have one for you?

I am still stuck on how to render the map randomly that actually make a dungeon + hallway.

Can you elaborate on your take?


#3

@Neotriz I hear you man, for me that wouldn’t have been easy either. I used someone else’s work and thanked him and referenced this link on the project: http://bigbadwofl.me/

Although I have done a good amount of modification on his code the base is still his work cause I simply wasn’t too interested in spending time on generating a dungeon!


#4

Have you seen this ? http://forum.freecodecamp.com/t/random-map-generator/49515/7

Maybe it can help you. I follow the idea taken from http://www.roguebasin.com/index.php?title=Dungeon-Building_Algorithm

1- Fill the whole map with solid earth 2- Dig out a single room in the centre of the map 3- Pick a wall of any room 4-Decide upon a new feature to build 5- See if there is room to add the new feature through the chosen wall 6-i f yes, continue. If no, go back to step 3 7- Add the feature through the chosen wall 8- Go back to step 3, until the dungeon is complete 9- Add the up and down staircases at random points in map 10- Finally, sprinkle some monsters and items liberally over dungeon


#5

lag isn’t too bad, but I spawned in a closed room on my first try… :confused:


#6

All things considered I think you did a pretty good job optimizing.

If the lag bothers you one possible optimization would be waiting longer to render map moves, and then rendering bigger jumps.

What I did was wait until the player was ~5 spaces from the edge and then shift the map 10 spaces at once. Because the map isn’t constantly rendering the feedback feels quicker.


#7

You are totally right! :slight_smile: Like I said before because I did not create the dungeon generation algorithm I wasn’t savvy enough (interested enough) to fix its bugs! thanks for feedback though


#8

This is great feedback cjsheets, I’ll definitely look into it! How do you exactly do this from a redux standpoint? Any middleware or best practice?


#9

Huh, for some reason I didnt’ see it on the other thread. I will look into it. Thanks!