Random Enemy Generator Working!

Good news: Random enemy generator finally working

Bad news: the game will reset again… unfortunately this will happen a few more times again, but the game isn’t in a playable state yet, only for testing, so it will be ok.

I made a system, so it will be easier for new characters:

  • when you go down to the dungeon, enemies will generate only in 1 group, in a 6 x 6 square blocks around the stairs; there will be a maximum of 2 of the first 5 weakest enemies in that group
  • if you go further, the next 2 x 2 blocks will have a chance to generate 1 or 2 groups, with a maximum of 3 of the first 9 weakest enemies
  • if you go further than that, there will be 1, 2 or 3 groups of all enemy types; the weakest creatures can spawn in greater numbers, up to 10 (ex: ants or spiders)

So basically, just stay near the stairs when you start and you are low level 🙂

1

The alpha version demo:

Webplayer:

https://dl.dropboxusercontent.com/u/195129959/Dungeons_of_Orroth/Dungeons_of_Orroth.html

 

Android:

https://dl.dropboxusercontent.com/u/195129959/Dungeons_of_Orroth_Android/Dungeons_of_Orroth.apk

Another nasty bug fixed

I spent the last 3 days with a nasty bug, I almost went insane…

When opening a chest, the loot normally goes into the visible character’s (currently selected) inventory.

But if this character’s inventory is full, then the game will find the next character with enough room in his inventory.

The problem appeared when the next character had more then 6 items already in his inventory. The game tried to shift every item in his inventory to the left, so the new item will be the one selected, this way the player can see instantly the last looted item when browsing the inventory.

Everything stopped, nothing worked when clicking, the game just stuck.

The problem was so simple, that I’m embarrassed I wasted so much time on this bug… It was a simple do-while loop that never ended, infinite cycle.

The problem was that Unity started the do-while loop faster then Debug.Log function calls, so even if I put 20+ Debug.Logs before even entering the function that handles the opening of the chest, to see where it goes wrong, it wouldn’t show anything at all. I had no clue in which function was the problem (have 100+ functions already)

Oh well lesson learned, always check while and do-while loops if everything stops 😛

I tried to implement random generation of enemies (now it is static, same enemies appear in the dungeon rooms) but all I could think about was this bug… Now that it’s fixed I can continue with that 🙂

Quick update: adding new characters to parties bug fixed!

Just a quick update to let you know about a fix.

I managed to fix a nasty bug that got out in the last update, if you added a character that was alone in the party, and it was higher in position than the loaded party, then that added character would disappear.

Unfortunately this update will reset the game again, I hope it’s for the last time 🙂

 

The alpha version demo:

Webplayer:

https://dl.dropboxusercontent.com/u/195129959/Dungeons_of_Orroth/Dungeons_of_Orroth.html

 

Android:

https://dl.dropboxusercontent.com/u/195129959/Dungeons_of_Orroth_Android/Dungeons_of_Orroth.apk

Adding characters to party + faster saving and loading

WARNING this will reset the game again! You can find an older link in the post beneath this one.

Finally adding characters to already loaded parties is working.

12

It took a while because I had the same problem as deleting parties, copying a character took more then 15-20 seconds on android, but this time I couldn’t use the double array trick, because I needed to read and write the data to a new place.

So after searching way to many hours on google for a solution, I finally found this page:

http://www.previewlabs.com/writing-playerprefs-fast/

It replaces the entire PlayerPrefs library and it is so good that every saving and loading got almost instant! ^_^

On an older android you still wait ~1 second but it’s better then 20 seconds 😛

A little warning: there is a weird bug, if you create a new party, please go out to the Main Menu and reload before adding a new character, for some reason it does strange things if you try and add a new character as soon as you enter the town for the first time. I’ll look into that tomorrow, I just wanted to release this update today.

 

The alpha version demo:

Webplayer:

https://dl.dropboxusercontent.com/u/195129959/Dungeons_of_Orroth/Dungeons_of_Orroth.html

 

Android:

https://dl.dropboxusercontent.com/u/195129959/Dungeons_of_Orroth_Android/Dungeons_of_Orroth.apk

Deleting parties

BE WARNED! This version will delete all parties, characters and the explored map, it will reset the game.

I added an old version, so if you have a lot of parties and you want to continue testing with them please don’t load the normal link, instead load this one:

https://dl.dropboxusercontent.com/u/195129959/Dungeons_of_Orroth_oldVersion/Dungeons_of_Orroth.html

This old version has deleting of parties implemented too, but it’s very very slow…

So I had to redo the whole deleting system.

The problem is that on webplayer, deleting works fine(if you have a lot of parties it will be slower, but acceptable), but on android it took over 60 seconds to delete a party…

Unitys PlayerPrefs is very very slow. I tried to copy every party beneath the deleted one, by shifting them 1 slot, but reading and writing thousands of data is just impossible with PlayerPrefs.

So I had to come up with a solution to delete just the current party:

– I made another array in PlayerPrefs which holds the true numbering of parties, let the old party numbering to increase, and link these 2 arrays together

– Example:

– real party numbering: 1 2 3 4 5

– old party numbering:  1 2 3 4 5

– after removing party 3 and 4, and adding another 2 parties:

– real party numbering: 1 2 3 4 5

– old party numbering:  1 2 5 6 7

This way I only delete the selected party. In case you wonder why didn’t I just delete the current party from start, it is because the PlayerPrefs loading system, it needs to have an array of numbers that are incremented only by 1 (for example: 1, 2, 5, 6 is bad)

 

I thought I would do deleting pretty fast but sometimes coding is a pain 🙂

Anyway I’ll implement the adding of characters to the current party, I hope this will go faster.

 

The new links to alpha version demo:

Webplayer:

https://dl.dropboxusercontent.com/u/195129959/Dungeons_of_Orroth/Dungeons_of_Orroth.html

 

Android:

https://dl.dropboxusercontent.com/u/195129959/Dungeons_of_Orroth_Android/Dungeons_of_Orroth.apk

Kicking characters from party

Hello, I’ve been away for a little while, I got burned out of coding after Ludum Dare, so I had a little vacation 🙂

Anyway, now I’m back and restarted coding, and here is a little update:

I implemented kicking characters from the current party, they will show up in the load menu as a new party with 1 character.

1

 

Next I’m going to implement adding new characters to party, and deleting unwanted parties from the load menu.

 

Links to alpha version demo:

Webplayer:

https://dl.dropboxusercontent.com/u/195129959/Dungeons_of_Orroth/Dungeons_of_Orroth.html

 

Android:

https://dl.dropboxusercontent.com/u/195129959/Dungeons_of_Orroth_Android/Dungeons_of_Orroth.apk