Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Wonder Boy III technical questions

Reply to topic
Author Message
  • Joined: 03 Nov 2013
  • Posts: 26
Reply with quote
Wonder Boy III technical questions
Post Posted: Sun Nov 03, 2013 7:25 am
I have a number of technical questions for Wonder Boy III. Perhaps someone may be able to assist me.

1. How is the cost of the cure calculated? It seems to depend on a number of factors, including your current form, how many hearts you have, and the location of the hospital?
2. How are the gold drop values calculated for different enemies? Is there some formula?
3. How are the magic/potion/stone/heart piece/hearts drops decided? Is there some formula?
4. The number of hits to defeat a single identical enemy varies, even when using identical form and equipment. What influences this? Is it the attack technique or a random formula?
5. What is the maximum number of gold you can collect? Does the game bug out if you exceed this maximum? I have not had the patience yet to reach any maximum after starting with 983,040 with the code generator. Perhaps there is a fast way to earn gold, or a spot you can grind automatically somehow, or some game genie/PAR cheats that could help?

Thanks
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 13506
  • Location: London
Reply with quote
Post Posted: Sun Nov 03, 2013 10:27 am
Last edited by Maxim on Fri Nov 08, 2013 8:30 am; edited 1 time in total
All of these are certainly answerable, even if not in equation form. Most likely some random numbers are involved in the cases where values fluctuate.

Regarding the gold, the password system enforces restrictions on how precisely the value can be encoded, but within the game it is using a regular counter, which probably limits you to 999999. It'd take a long time to collect that much, even if you started at 983040.
  View user's profile Send private message Visit poster's website
  • Joined: 03 Nov 2013
  • Posts: 26
Reply with quote
Post Posted: Sun Nov 03, 2013 11:14 am
Thank you for your reply. For anyone interested, I have apparently discovered the formula for calculating the cost of the cure. With some exceptions, the formula is ((Current # of hearts [containers] * 5 * Current # of hearts)+Base DP of current form). The exception to this is Piranha-Man, which seems to offer the 2 heart cure for 50 gold instead of 60, even though his base DP is 40. There are likely other exceptions, as I am yet to test every possibility.

Contrary to what I said, all of the hospitals appear to charge the same. Your current level of health or equipment do not appear to be factors either.
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 13506
  • Location: London
Reply with quote
Post Posted: Sun Nov 03, 2013 11:57 am
Is that based on observing the inputs and output, rather than by looking at the code? The latter will reveal a lot more. For example, there is no such thing as a "base" DP value for the characters, it's just a convention.
  View user's profile Send private message Visit poster's website
  • Joined: 03 Nov 2013
  • Posts: 26
Reply with quote
Post Posted: Sun Nov 03, 2013 1:48 pm
This is simply based on observation; I don't know how to look at the code.

I have finally gotten the most gold possible. I can confirm a few things:

* The limit is 999,999
* Nothing special happens
* Some games have a limit on what a counter will show, but still keep counting beyond what the counter shows. This is NOT the case in this instance. You cannot get more than 999,999 gold.
  View user's profile Send private message
  • Joined: 14 Apr 2013
  • Posts: 560
Reply with quote
Post Posted: Mon Nov 04, 2013 12:22 am
Maxim wrote
Is that based on observing the inputs and output, rather than by looking at the code? The latter will reveal a lot more. For example, there is no such thing as a "base" DP value for the characters, it's just a convention.

Hi guys,

I took a look at the code and this is what I found out:
When entering the hospital, the price for heal gets stored into RAM starting from $d10e. The value that gets written there gets looked up from a table in ROM starting from $1c550. This table consists of 6*8 (transformation * number of heart containers) 2-byte-BCD entries and looks like that:


Containers   |  1      2      3       4       5       6       7       8
-------------|----------------------------------------------------------
Hu-Man       | 60     75    100     135     180     235     300     375
Lizard-Man   |  5     20     45      80     125     180     245     320
Mouse-Man    | 25     40     65     100     145     200     265     340
Piranha-Man  | 45     50     55      60     165     220     285     360
Lion-Man     | 55     70     95     130     175     230     295     370
Hawk-Man     | 15     30     55      90     135     190     255     330


I've also found out something about the gold drop from monsters:
RAM location $c37e holds the number of killed monsters for the current screen +$50. The lower nibble of this value (the number of killed monesters for the current screen) is used to index a table in ROM starting from $5de2. This table consists of entries of 2 bytes: The first byte of each entry is the base amount of money that will drop and the 2nd byte is used as a mask on a value calculated and stored into register A by the following code (sorry too tired to analyze this right now):

_LABEL_D36_:
   push hl
   push de
   ld a, ($D0DD)
   ld e, a
   ld d, $00
   inc a
   cp $37
   jr c, _LABEL_D44_
   xor a
_LABEL_D44_:
   ld ($D0DD), a
   ld a, ($D0DC)
   inc a
   cp $37
   jr c, _LABEL_D50_
   xor a
_LABEL_D50_:
   ld ($D0DC), a
   ld hl, $D0A5
   add a, l
   ld l, a
   ld a, $00
   adc a, h
   ld h, a
   ld a, (hl)
   ld hl, $D0A5
   add hl, de
   add a, (hl)
   or a
   jp p, _LABEL_D67_
   inc a
_LABEL_D67_:
   ld (hl), a
   pop de
   pop hl
   ret

The first entry of this table is $01 $03. That means the first enemy that is killed on a screen drops 1-4 gold. The second entry is $04 $03 that means the second enemy that is killed drops 4-7 gold and so on.
There is an exception to this rule: If the value stored at RAM location $cf66 equals to 7 (an item that increases the amount of gold that is dropped I guess) the index is increased by 2 before indexing the table.
  View user's profile Send private message Visit poster's website
  • Joined: 03 Nov 2013
  • Posts: 26
Reply with quote
Post Posted: Mon Nov 04, 2013 4:33 am
Thanks for your assistance, Calindro!
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 13506
  • Location: London
Reply with quote
Post Posted: Mon Nov 04, 2013 2:40 pm
Last edited by Maxim on Thu Nov 07, 2013 4:20 pm; edited 1 time in total
The refill costs match the "inherent" DP of the characters, plus values based on the number of hearts (i.e. the Lizard-Man row) which are vaguely exponential. It'd be good to get it added to http://www.smspower.org/Development/WonderBoyIII-SMS , along with the next thing you figure out :)

The magic byte for the enhanced money drop is probably the lucky sword.
  View user's profile Send private message Visit poster's website
  • Joined: 03 Nov 2013
  • Posts: 26
Reply with quote
Post Posted: Thu Nov 07, 2013 1:59 pm
I'm also keen to find out the CP requirements to unlock all the different equipment in the shops.
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 13506
  • Location: London
Reply with quote
Post Posted: Thu Nov 07, 2013 4:20 pm
Those happen to be in the wiki page linked above.
  View user's profile Send private message Visit poster's website
  • Joined: 03 Nov 2013
  • Posts: 26
Reply with quote
Post Posted: Thu Nov 07, 2013 4:26 pm
:-/ Sorry, I did not read it thoroughly. I thought those were the CP the item gave to you. And now I realise, only armour grants you CP.
  View user's profile Send private message
  • Joined: 03 Nov 2013
  • Posts: 26
Reply with quote
Post Posted: Fri Nov 08, 2013 8:58 am
New question, does anyone know how the player can still defeat enemies whilst the Thunder Saber is equipped, or the Magical Saber is equipped as Lizard-Man, as you have 0 AP?
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 13506
  • Location: London
Reply with quote
Post Posted: Fri Nov 08, 2013 11:39 am
Can you? You suggested above that there's a random factor, which might make you get non-zero results with a 0 AP weapon.
  View user's profile Send private message Visit poster's website
  • Joined: 03 Nov 2013
  • Posts: 26
Reply with quote
Post Posted: Fri Nov 08, 2013 2:23 pm
Yes. Yet every time I attack an enemy when I have 0 AP, I can still defeat them.
  View user's profile Send private message
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8276
  • Location: Paris, France
Reply with quote
Wonder Boy III hacking notes
Post Posted: Tue Jan 21, 2014 10:33 pm
Thinking about getting back into this project of reverse engineering more of Wonder Boy III. Until then dropping off some loose notes + symbol file I took during a hacking session in 2012. I was actually attempting to reverse engineer the level format to hunt for unknown level doors, which I haven't finished. There's very little in the notes, but rather post them than not.

I'd like further to disassemble all the gameplay and namely the controls/physics.. time given.

*EDIT* this is pretty much old stuff, I've got more better/infos now will post asap.

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8276
  • Location: Paris, France
Reply with quote
Post Posted: Fri Jan 24, 2014 1:14 am
Updated symbol files + some early notes on collision functions.

  View user's profile Send private message Visit poster's website
  • Joined: 03 Nov 2013
  • Posts: 26
Reply with quote
Post Posted: Fri Oct 17, 2014 3:16 am
Hey guys. I really appreciate the work you have been doing on this. I am keen to find out how the damage system works (the formula for calculating damage and the defence points of all the enemies and bosses). I could offer a donation or something if that would help.
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 13506
  • Location: London
Reply with quote
Post Posted: Fri Oct 17, 2014 7:44 am
If you can use a cheat finder (like in Meka) to find relevant variables, that might help.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8276
  • Location: Paris, France
Reply with quote
Post Posted: Mon Feb 09, 2015 10:16 pm
Updated my symbol file with notes. Its very raw and messy.
I think I'll change strategy and start editing a disassembly instead of manually constructing a .SYM file. The way Emulicious detect data and jump table is super useful.

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8276
  • Location: Paris, France
Reply with quote
Post Posted: Mon Jul 13, 2015 2:05 pm
Minor update.
wb3hack-20150713.zip (11.14 KB)

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8276
  • Location: Paris, France
Reply with quote
tigsource blog
Post Posted: Tue Oct 13, 2015 11:16 pm
I'm starting a mini blog here. Not much to get started with:
http://forums.tigsource.com/index.php?topic=50899.0

There's a few reasons why I'm not initially posting it here, you'll find out. But will probably open a thread here.
  View user's profile Send private message Visit poster's website
  • Joined: 29 Mar 2012
  • Posts: 656
  • Location: Spain
Reply with quote
Post Posted: Wed Oct 14, 2015 7:38 am
This absolutely has my seal of approval!

Any help you need, don't hesitate to ask!
  View user's profile Send private message
Reply to topic



Back to the top of this page

Back to SMS Power!