HTML Rough (working title)

esoom

Active Member
Sep 6, 2017
926
1,071
Rewrote a huge chunk of the NPC and player generation script, that gave me a major headache.

The save size for 1000 NPCs on game start is now 94k instead of ~270k for 1000 NPCs, not quite done yet, if I could set integer sizes could probably save more space still learning this javascript stuff. Almost everything is saved as numbers now instead of strings, have made another script to read the information back from the arrays on request.

Edit : (01/07/2019): Rewrote part of the scheduler and improved the map NPC array script, Everything is now fixed and functions like before but with the ability to keep track of NPC's at locations, it currently does not account for NPCs being present at multiple locations at once (which should not happen), should in theory be possible to prevent that along with the ability to generate more NPCs if there are not enough to populate an area, with have to write some logic to make sure the same NPCs don't show up all the time, maybe have a last seen timer or something.
 
Last edited:

esoom

Active Member
Sep 6, 2017
926
1,071
Yeah, still working on silly stuff before actual content.

I've just added the ability for the game never to have duplicate NPCs at any active location (any location that was used in the last 45 minutes in game time or less), and if attempts too many times too add a NPC that is in use (picks at random) it will generate 100 new NPCs and try again , at the moment I've set this to whatever the current population should be x10 so should never hit the 1000 limit.

It will sometime spit out a "NPC generation error", this means it was not able to provide enough unique NPCs even with generating 100 new NPCs, so the population may not match what is displayed.

This is more a problem with the number generator than anything, not sure how to make unique random numbers it keeps chucking out the same number multiple times in a row, if anyone has any idea how to make the random number generator more random?...
 
Last edited:

Lust Demon

Member
Apr 22, 2018
100
85
Nothing is ever really random. Pick a different algorithm/plugin? Index it to something silly like time of day or day of the year/36.5 or the average of both? Still predictable, but less repeatable and you can expand it.

Sorry, skipped a few posts. Still drooling over the Ryzen 2700, which I know is dated. If you want bigger appeal, lower the requirements and as previously stated, no one is going to remember 900 NPC's anyway. For the record, I'm running a CPU with a fraction of that power and compared to me, a lot of people are playing games on digital toasters (I know, I'm more than due for a rebuild).
 
  • Like
Reactions: passiveDragon

HiEv

Member
Sep 1, 2017
384
778
It will sometime spit out a "NPC generation error", this means it was not able to provide enough unique NPCs even with generating 100 new NPCs, so the population may not match what is displayed.

This is more a problem with the number generator than anything, not sure how to make unique random numbers it keeps chucking out the same number multiple times in a row, if anyone has any idea how to make the random number generator more random?...
Actually, if you're talking about making it unable to give you the same number multiple times in a row, you're actually talking about how to make it less random. (Human brains tend to see patterns in randomness, which causes us to mistake actual randomness for non-randomness sometimes.)

There are a couple of ways to do that. The two easiest would be to either put all of the (unique) numbers in an array, that array, and then pull them from that array so you get an even spread of results, or you could keep track of the last few results in an array, and then re-roll the current roll whenever it's found in an check of the array (use to add the final result to the array, and then, if the array's is greater than some number, use to remove the oldest member).

However, as I've said before, you should never be generating hundreds of NPCs at a time like that.
 

Alleykatt

Well-Known Member
May 19, 2017
1,336
1,929
If you don't mind me saying, you need a plot to draw people in. It is all well and good having nice systems in place for random NPCs but if we don't care about the MC, no-one will play it.
 
  • Like
Reactions: TheAnonymousUser

picobyte

Active Member
Oct 20, 2017
636
654
I think you may not need to pregenerate all NPCs. In game, if you go somewhere and if you want 10 characters on site, choose 10 indices of your NPCs array. Only the indices in the NPC array that point to an NPC that does not yet exist will have to be generated and stored in the array. In first instance that will be all 10 characters, but after a while some will already be generated and the amount required to generate will become less.

Edit: actually I think something similar was suggested here:
Ideally you would create any 'random' NPC's (or any 'random' object) you need just before you actually need them, this saves on both system resources and the amount of information that needs to be contained within each Moment in the story's History system.
 
Last edited:
  • Like
Reactions: passiveDragon

esoom

Active Member
Sep 6, 2017
926
1,071
Just updated the game again, took some time off from it but am back at it again, got a bit burned out on it.

Added the ability to be able to complete quests on a triggered event. Currently it will just complete the initial quest of finding a place to sleep when you enter the bedroom of your house, but can be used for anything, it is triggered by location (passage) and a secondary variable which is defined in the quest itself and will also be tied to random characters at some point for quests that are given by them.

The plan is I will create a array of locations (perhaps auto generate it somehow) based on the map passages and use that for auto generating random quests which may have random locations from random NPCs based on their traits (are quest givers and other stuff, will probably also put a timeout for the NPCs so they only give quests again after a certain time limit.

Also I know the game will have to have a plot, but I really want to get the underlying systems working first, if I get it right it should make it easier to add things.

But I also want to make the game be different in random ways, so things are not repetitive.

Think of Degrees of Lewdity but with the NPC's you interact with being persistent so they remember what you did to them, and side quests they give will be from a database of quests that they are likely to give you, for example deliver packages, meet someone, do a job, etc.

There will also be other quests that are not random to advance a main plot line based on the choices you make.
 
Last edited:
  • Like
Reactions: ibk

esoom

Active Member
Sep 6, 2017
926
1,071
Made a few more updates to the game, got the fight system to the point where NPC's can actually chase the player and not run through other NPCs on the grid (will expand this for other obstacles when they get put in with some more advanced collision avoidance for navigating around walls and stuff).

If anyone could test what I've made now to see if it works properly that would be great. (initiate test fight with a NPC) at the moment there are no attacks or variable actions points or any of that stuff, just movement where everyone has 4AP.

Just getting the movement bit to work was a pain in the arse, I think I've got rid of most of the bugs in it I just want to find them all before moving on.
 

Rycharde's Realm

Well-Known Member
Jan 17, 2018
1,046
678
Noticed a couple of issues:
* One is added to your age of the character (ie I choose 18 and 19 is listed as minimum age)
* Date game starts is beginning with zero instead of 1 during character creation (ie January is 0, May is 4)

Been up for more than I should, my brain is not firing on all cylinders so I forgot a couple of other items. I'll see if a night's sleep dredges them up. :)