Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

I don't think you should be using random hints, as the provided hint may not provide help for the player's current situation or it may provide help for a problem that the player has already solved or it may provide spoilers for a situation that the player hasn't even encountered yet. If any of these situations occur, the player will just keep typing HINT until they run out of hints.

I think it is much better to provide context-sensitive hints whereby you run through a series of tests to see if the player has solved a particular problem. If they have solved it, then you move on to the next test. When you get to the first situation that the player hasn't solved, then you provide a hint for that situation. Does that make sense? The hint will generally be location-based, so this reduces the number of tests you need to do in any location, but it may be more general or a combination of the two.

If you want to stick to your random hints, have you considered having a list of hints and just shuffle the order of the hints at the start of the game? Each item in the list has an index number from 0 to MAX - 1. Just create an array of the index numbers and shuffle the array. Then you only need to step through the shuffled array of index numbers and print the hint corresponding to that index number.

(2 edits)

Thank you, Garry for answer. Yeah, it seems that random hints produce  so many problems that I better consider changing them to context-specific hints. Development of my game is in early stage. However, the algorithm might be useful in another situations (random events that do not change the ability to complete the game, but make the game more attractive and possible to play many times).

Unfortunately AdvSys has no indexed arrays. However the list approach is very easy and the algorithm is fast. Shuffling should be possible as well.