DQ9 Encyclopedia

The game's randomness (for speedrunners)

The essentials

  • The game has three streams of random numbers, the “tables” A, B and C.
  • Table A: monster spawns, ordinary loot, blue chests, furniture… The treasure map menu resets it to a known value: that is what manipulations are built on.
  • Table B: healing outside battle, alchemiracles, the fountain, group make-up… You can find your place in it from the HP a healing spell restores.
  • Table C: everything in battle. It restarts at every battle: it cannot be predicted.

The game has three sources of randomness, the community's A, B and C “tables”, read and checked in its code (the Python port gives exactly the same rolls as the game code run in an emulator).

Table A: 32-bit generator

Under the hood

x = x × 0x41C64E6D + 0x3039, roll = (x ≫ 16) & 0x7FFF (0 to 32,767).

  • Seeded with a treasure map's seed to build the grotto: a grotto is always the same for a given map. Opening the map menu reseeds it with the seed of the last map on the page, followed by 33 rolls: this is the community's “map method” (see EXP manipulations).
  • It rolls the make-up of battles at sea (see below), monster spawns on the field, pre-emptive strikes, ordinary monster loot, blue chests, furniture and sparkly spots, NPC movements (2 rolls per decision: the direction, then a 2 to 4 s wait), the head-bump screen shake on a ceiling (29 rolls, one per frame) and the choice of DQVC items (see table B).
  • Ordinary loot: one roll per group; the rare item drops if ⌊N × (roll − 1) ÷ 32,767⌋ = 0 (almost exactly 1 in N); if it drops, the common item is not rolled.
  • Pre-emptive strike: a roll out of 100 below deftness × 0.05 + 2 (the party's highest deftness; +10 when you hit the monster's back). Otherwise, ambush if the roll is below 2 (12 when the monster catches you from behind).

Table B: global 64-bit generator (the “Hoimi table”)

Under the hood
  • x = x × 0x5D588B656C078965 + 0x269EC3 (mod 264); each roll returns the high 32 bits. Integer from 0 to n−1: min(n − 1, ⌊n × roll ÷ 4,294,967,295⌋), a single roll.
  • Seeded together with table A from the console's hardware counter: A gets the low 32 bits, B all 64. Right after power-on the counter is small, hence B = A and few possible seeds per console.
  • It rolls field healing, alchemy (alchemiracles), the fountain, on land the number and make-up of monster groups (the group of the monster you touched always stays first, on the left), at sea the order of the groups and the wait before the next battle, the monsters' starting HP (80 to 100% of their record), grotto and legacy boss loot, the stock of DQVC items, and a companion called in at Patty's (1 roll during their entrance).
  • That is what makes the “Hoimi table” predictable: the HP restored by a healing spell come from this stream, so they reveal the position in the sequence.
  • How many rolls (measured in game: Heal +1 per cast, even at full HP; medicinal herb and magic water +2; Inspect in battle +1; battle start +2 for 1 group, +5 for 2 (+7 for 3, read in the code), then +1 per monster; at Patty's, creating a companion +1 (this roll, 0 to 15, picks their personal colour, the one in the “change your party members' personal colours” menu: it shows on the outfit they wear with nothing on the body) and calling them into the party +1; elfin elixir and chimaera wing 0; DQVC connection +6. From the community, consistent with the code: Multiheal +1 per target, Omniheal +2 per target, alchemiracle +1, flee +1 when not automatic; inn, saving, Zoom 0).
  • DQVC +6: on every successful connection, table A picks the 6 items from the week's list (roll % N, redrawn on a duplicate: at least 6 rolls), then table B rolls each one's stock, min + integer(max − min + 1): +6 (fewer if the week has fewer than 6 items). Failed connection or the offline DQVC: 0. The +6 was known to the community (Japanese blog drakue9, 2010); its cause is the stock, recomputed exactly in game with DQVC at home.
  • Boss loot: rare slot, common slot, then guaranteed slot; each drops if integer(100) < percentage. With the Thief's Theory, the three slots are rolled again at percentage × level ÷ 100 (truncated: −1 at level 99), the guaranteed slot at 0%.

Table C: the battle's 64-bit generator

  • Same generator as table B, but a separate instance owned by the battle, reseeded at every battle from the hardware counter.
  • It rolls how the battle unfolds: damage, critical hits, turn order, monster choices… It does not advance the Hoimi table.

At sea

  • No visible monsters: a step count rolled in table B between 30 and 100 drops by about 1 per unit sailed; at 0, a battle. The zone (centre, ring, edges, corners: see the Ocean place) is the one of the water under the ship.
  • Make-up in table A, with remainders: number of groups = roll % (w1 + w2 + w3) + 1 against the zone's weights (centre 6 / 4 / 2, ring 5 / 4 / 3, edges and corners 4 / 4 / 4); for each group, species = roll % total weight + 1, count = roll % (max − min + 1) + min. That is 3, 5 or 7 table-A rolls. Above 5 monsters, trimming as on land.
  • Then the group order is shuffled in table B (integer(2) or integer(6)) and, unlike on land, the shuffle shows: the on-screen order, left to right, is the shuffled order. Checked in game on about fifty battles.

Battle memory (on land and at sea)

  • Before loading the monsters, the battle takes the free space of its memory (about 153 KB) and walks the species in group order; each species reserves a fixed share (Spinchilla 42 KB, Claw Hammer 52, Axolhotl 63, Great Troll 96…). The first species that no longer fits is removed with all later ones, together with their groups.
  • So the edge and corner seas never show three species together; at the Ondor Cliffs, a Claws with a Great Troll stays alone. The encyclopedia's “% of battles” take this into account. Checked in game: 30 forced species trios at sea (kept up to 153 KB, lost from 154 KB) and forced battles on land.
  • On land, the species of the monster you touched is put first just before this check: it is never removed. Party size changes nothing (same free space measured with the hero alone and with 4 members).

Where monsters spawn

Read in the game's code, which redoes this every frame, and cross-checked with TKG's videos that display the spawn nodes: Spawn Node Display, 3.5m Radii, Party Member Bias, Scoring System, AT Stops in Nipple Maps.

The node in front most in front of the gaze:picked with no roll no node in front:1 random rollunder 5 units: ignored
The hero (circle) looks along the arrow; the diamonds are the area's spawn nodes.
The 3.5-unit circle companion herochosen node a member within 3.5:nothing spawns,nothing is rolled
A party member too close to the chosen node blocks the spawn and that frame's roll.
In a grotto▲ facing the upward stairsfrom the next square:table frozen one-square room:no roll at all
One node per walkable square (dots), linked square to square; the upward stairs (▲) never hold a monster.
  1. Nothing happens until the spawn timer has passed 1 second, nor when 12 monsters are already there.
  2. The game takes the area's spawn nodes that are more than 5 units from the hero; closer ones are ignored.
  3. The node most in front of the gaze is picked with no roll. If there is none in front, a roll picks one at random among the others.
  4. If that node is too far from the line of sight (beyond 10 units), the game gives up without rolling anything: facing that way, the hero freezes table A. These are the “stop spots” used by manipulations.
  5. If a party member is within 3.5 units of the chosen node, nothing spawns and nothing is rolled that frame: a companion standing on the node freezes the table too.
  6. Otherwise, a roll gives the species from the area's table, and the monster appears.
  • In a grotto: one node per walkable square, linked to the neighbouring squares; only the nodes linked to the hero's count. The upward stairs never hold a monster: faced from a neighbouring square, they freeze the table. In a one-square room cut off from the rest (out of bounds), there is no candidate left, so no roll at all. On entering a floor, table A is reseeded from the clock: that is why the grotto map method is done on the spot.
  • Monster-free floor (a grotto floor whose memory is full, see How grottoes are generated): the game does roll a species, but it cannot spawn. The timer is only reset when a monster spawns: once the 5 seconds have passed, the game tries again every frame, and table A advances one extra roll per frame (the species). Stop spots still freeze it. On a single-monster floor it is the same until the species rolled is the right one.
  • In multiplayer, the other players count too: one attempt per frame and per player, 4 at most.

8 items at most per battle

  • A battle's loot fits in an 8-slot table: beyond that, nothing more is added. There is one chance per monster group, plus one pass per holder of the Thief's Theory (see tables A and B above).
  • Records filmed by TKG, all within the limit: 8 items from a level 1 Mortamor; 4 and 5 items from legacy bosses; with 4 players, 5 items including the victorious armour and 8 rockbomb shards; seeds of life ×3 and ×4 in a single battle.

The Hoimi table: what the community does with it

  • Boss loot (grottoes and legacy bosses): rolled in table B, rare slot, common slot then guaranteed slot, each if integer(100) < percentage. The 2% slots are aimed at like alchemiracles: find your position with a few heals, then advance to a position that makes the slot drop. See the Hoimi table tool.
  • The next battle: on land, the number of groups and their make-up are rolled in table B (the touched monster's group stays first). So you can tell whether the next monster will be alone or not.
  • Starting HP of monsters you meet: (int)(HP × random(0.8; 1) + 0.5), also in table B. Metal slime (4 HP): 3 HP 37.5% of the time, 4 HP otherwise (Sylwer says 37% and 60%).
  • Seed at power-on: tables A and B start from the console's timer, read when the opening sequence begins, before the Nintendo logo, about 0.4 s after the game starts. Nothing else goes into it: no date, no time, no button, no save. So the seed only measures how long the start-up took, to within 2 millionths of a second. On a DS, differences of 2 thousandths of a second give about a thousand possible seeds. A console that always starts up at exactly the same pace always gives the same seed: that is what the community sees on 3DS and 2DS.
  • Lid trick: on a DS “phat”, TKG gets the same seed four times by closing the lid right after the warning screen's “tick”, while the game is launching. The game itself only looks at the lid after it has taken the seed: its sleep mode does not change it. So the effect comes from the console during the launch, which the game's code cannot show.
  • Sylwer's speedrun seed: 1A26E, chosen because it offers many good positions (tutorial “Allons plus loin dans la Hoimi”, in French).
  • A companion's colour: the roll made when creating them at Patty's picks their personal colour (changeable later in the party menu), shown on the outfit they wear with nothing on the body.

Cross-checked with hurblub's RNG guide (2026), the research of the “The Quester's Rest” Discord (TKG, MelonGx, DaisukeDaisuke) and Sylwer's tutorials (Hoimi table, randomness): same formulas, except a few details settled by the code (at sea: group weights per zone, monster counts by remainder, trimming divided by 3); battle memory is in neither source.

Open in the full encyclopediasearch, filters, my collection, grotto tools