Posts for c-square


1 2
13 14 15
26 27
Experienced Forum User, Published Author, Active player (372)
Joined: 9/25/2011
Posts: 652
Got it! Just one slight change to what you wrote, Radiant: int random (int min, int max) { agi_rand_seed = 0x7C4D * agi_rand_seed + 1; return (((agi_rand_seed%256) ^ (agi_rand_seed>>8)) % (max - min + 1)) + min; } The seed contains two bytes. It's taking one byte and XORing it with the other byte. In my libreOffice spreadsheet I use =MOD(BITXOR(MOD(A18,256),BITRSHIFT(A18,8)),100)+1 to calculate the value, and it's matching the slot results so far. Next to find an ideal pattern. Onwards!
Experienced Forum User, Published Author, Active player (372)
Joined: 9/25/2011
Posts: 652
DrD2k9 wrote:
EDIT: I'm thinking my math on the return value is incorrect. I'm not getting the spins I expect based on the seed value. Could either of you write a better return value formula for the spreadsheet (or figure out why I'm not matching up, if the math is correct)?
I wrote my own and I'm not getting the expected results either. So either we're both wrong, or there's something else happening in the random function we're not aware of yet. For example: For seed value 2809, Random(1,100) should return 4, but the slot machine actually shows a loss. Similarly, for seed value 59622, Random(1,100) should return 7, but the slot machine only gives two cherries and a diamond, not three cherries.
DrD2k9 wrote:
I'm not sure I completely understand this...
Reading it again, I did a rather poor job of explaining myself. I'll give it a try again later, but first I want to figure out what's wrong with our slot results. EDIT: I can't find the code for the rand function in the recompiled code. I did find what Radiant posted on NAGI's code site, however there's no guarantee that NAGI generates random numbers the same way the original AGI did. JAGI's random number generator is much different.
Experienced Forum User, Published Author, Active player (372)
Joined: 9/25/2011
Posts: 652
DrD2k9 wrote:
$250 214 for the ship. 36 for the droid.
Great, and we start with $30 to play with. Looks like there's a nice set of values close together starting around seed value 4319. That means if we can start the game off with a seed of one of the following values, we should be able to cut down the slot section significantly: 63832 - 10 rng numbers for manipulation 40825 37734 48559 53668 32341 11154 53995 17584 59633 - 0 rng numbers for manipulation We can pick ones further up to allow you spots to manipulate away the guards if you like. Also, there's precedence for changing the initial RTC value, so I think we can do it!
Experienced Forum User, Published Author, Active player (372)
Joined: 9/25/2011
Posts: 652
What's the minimum cash you need to be able to buy the ship and the droid?
Post subject: Re: Space Quest 1
Experienced Forum User, Published Author, Active player (372)
Joined: 9/25/2011
Posts: 652
DrD2k9 wrote:
c-square wrote:
This is a thread to help DrD2k9 figure out the slot machine, and any other time savings in her/his (?) SQ1 run.
His
Fixed! :)
Experienced Forum User, Published Author, Active player (372)
Joined: 9/25/2011
Posts: 652
Woo hoo! I think we've got it. The RNG memory address in JPC-rr is both 246039 and 1294615 (both store the same value). It's initially populated at JPC-rr clock time 2954901700, which is almost 2955 ms into the game. The initial value is 46218 (using the save file you sent me, DrD2k9). There are 586 random calls from the start of the game until you first get to the slot machine. Based on all this, we should be able to figure out a lot! I'll put more work into this tonight.
Experienced Forum User, Published Author, Active player (372)
Joined: 9/25/2011
Posts: 652
Radiant wrote:
If you start your emulator and it's set up to directly open this game, then the intial value of random_seed should always be the same.
I agree. Unfortunately, since we don't know on what frame the game sets this value, we can't know the initial value.
The easy way to advance the seed, which can be done at any time, is typing N + enter or Y + enter. These are the shortest inputs that give a randomized message (all other one-letter inputs are either not recognized, which give a non-random message, or are ignored).
Great! Looks like that'll be the best way to do RNG manipulation here.
Finally, and most importantly, JPC-RR has a parameter "Initial RTC time". Since the random seed is initialized as the amount of milliseconds since midnight, altering this parameter is an easy way to get a different pattern. I believe this is legit by the site rules, but we should probably check that.
Since the game initializes the seed only once on startup, wouldn't this only be useful then? Changing this mid-game would have no effect on the seed. Radiant, would you check the lua code I posted to see if I missed anything? If we can find the memory address for the seed, then we can know every slot outcome coming up and how best to manipulate them.
Experienced Forum User, Published Author, Active player (372)
Joined: 9/25/2011
Posts: 652
v64 is the amount won:
    -- Big win, all diamonds (LOGIC.114)
    if (v64 == 4) {
      v125 = 2;
      v127 = 2;
      v128 = 2;
      v129 = 7;
    }

    -- Payout depends on bet (LOGIC.115)
    if (v129 == 7) {
      if (v123 == 1) {
        v64 = 20;
      }
      else {
        if (v123 == 2) {
          v64 = 40;
        }
        else {
          v64 = 60;
        }
      }
    }
Experienced Forum User, Published Author, Active player (372)
Joined: 9/25/2011
Posts: 652
Hmm.. I was sure that'd work. Would you please check my lua recreation of the slot logic:
-- Populate RNG nums
for i=0,65536 do
	slotRNG[i] = (i*31821+1)%65536;
end

-- Return the random number for an RNG value
function calcRnd(rng,min,max)
	return (bxor(rng,rshift(rng,8))%(max-min+1))+min
end

-- Get the next RNG value after a spin
function getNextRNG(rng,slotRNG)
	nextRng=slotRNG[rng]
	slotRoll = calcRnd(nextRng,1,100)
	if slotRoll > 9 then
		repeat
			nextRng=slotRNG[nextRng]
			firstSlot=calcRnd(nextRng,0,3) 
		until firstSlot ~= 1
		if slotRoll > 16 then
			nextRng=slotRNG[nextRng]
			secondSlot=calcRnd(nextRng,0,3)
			if slotRoll > 32 then
				repeat
					nextRng=slotRNG[nextRng]
					lastSlot=calcRnd(nextRng,0,3)
				until lastSlot ~= firstSlot or lastSlot ~= secondSlot or firstSlot ~= secondSlot
				nextRng=slotRNG[nextRng] -- Random lose comment
			end
		end
	end
	return nextRng
end
Experienced Forum User, Published Author, Active player (372)
Joined: 9/25/2011
Posts: 652
Radient, when I try AGIHack, I get the following error:
This version of e:\Old Games\AGIHack\AGIHACK.EXE is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need a x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher.
What version of Windows are you running it in? I'm using Windows 7. DrD2k9, I created a similar spreadsheet to list the numbers. I was hoping it'd cycle after a few thousand, but it looks like the RNG is complete and it doesn't cycle until all 65536 numbers have been used. <sigh> I've written lua scripts to search memory for when memory changes and when it doesn't change. Since we have no idea what the starting value is that's the best I think of to do. Now I've got to use that to hunt a memory address that changes when Random is called, and doesn't change otherwise. EDIT: I just had another idea. I'm going to give it a try and let you know how it goes. :)
DrD2k9 wrote:
It also appears based on LOGIC.000 that the random number is changed when certain instructions are typed. For example : if (said("use","anyword")) { random(79,80,v64); print.v(v64); } If I'm reading it correctly, this instruction appears to set the random variable to a number from 79-80. Different instructions set the value to different numbers. This may help in allowing us to set the value to a given range using text input while in the slot machine.
This sounds useful and may be worth more investigation.[/quote]
Experienced Forum User, Published Author, Active player (372)
Joined: 9/25/2011
Posts: 652
This is a thread to help DrD2k9 figure out the slot machine, and any other time savings in his SQ1 run.
Post subject: Re: #5710: DrD2k9's DOS Space Quest: Chapter 1 - The Sarien Encounter "EGA version 2.2" in 01:12.24
Experienced Forum User, Published Author, Active player (372)
Joined: 9/25/2011
Posts: 652
Radiant wrote:
Suppose it's 3. Then the next value is ((7C4D * 3) + 1) % 65536 = 29928. The third value is ((7C4D * 29928) + 1) % 65536 = 35273. Then 52598. And so on. (edit) wait no, I forgot about the >> in the return formula. Anyway you get the general idea.
I'm working on figuring this out. What does the >> do? Also, what decompiler did you use to get to this code?
Experienced Forum User, Published Author, Active player (372)
Joined: 9/25/2011
Posts: 652
DrD2k9 wrote:
At this point there seems to be mostly positive votes (though few) on this run. I can either leave it for a judge to accept/reject knowing a new version will be submitted in the relatively near future, or I can simply cancel the current submission. Thoughts?
I'm not a judge, but I'd say if it's not going to take you long then just leave it and replace the file.
Experienced Forum User, Published Author, Active player (372)
Joined: 9/25/2011
Posts: 652
It's fast, it's fun, it does things no human can. Definite yes vote! And I'm very happy to have another Sierra TASser on the site. I'm looking forward to more!
I could not get dumpconvert to produce both audio and video of the dumped JPC-rr movie file wherewith to merge.
Throw this in a CreateAVIFromDump.bat file and give it a try:
Echo USAGE: CreateAVIFromDump avi_name dump_name
dumpconvert --video-width=640 --video-height=400 --video-framerate=125875/1796 --output-cscd=%1,crf=0,fullrange=on %2
And kudos to Radient for figuring out the RNG and fsvgm777 for finding a VGA Bios that works. DRD2k9, I hope you're able to just swap out the bios and it syncs, although with the way the RNG is set up, you'll likely have to do some fixes. Also, how's your lua? If you can figure out the memory address of the random number seed then it shouldn't be too hard to write a script that shows the upcoming possibilities. I'd be happy to help if you'd like. Finally, in regards to:
Typing "holy shit" while using the slot machine allows the player to select the next sequence of slot symbols, drastically reducing the number of spins necessary to reach 250 buckazoids. If this would be deemed acceptable, it would drastically shorten the run by (mostly) eliminating a rather boring sequence and negating the need for RNG manipulation at this portion of the game.
I already asked and was rejected on almost the exact same request, which was for the best, as it forced me to find other ways to speed things up.
Experienced Forum User, Published Author, Active player (372)
Joined: 9/25/2011
Posts: 652
fsvgm777 wrote:
I actually tried it myself (with a DOS 6.22 floppy) last night, and....the font was equally messed up.
In that case, it's not an emulation bug. If the text for the game is garbled under real "console" conditions, then this run should be acceptable IMO, even with garbled text. Thoughts?
Experienced Forum User, Published Author, Active player (372)
Joined: 9/25/2011
Posts: 652
fsvgm777 wrote:
EDIT: No dice. It's an emulation bug.
I'm not convinced it's an emulation bug. The same effect reportedly happens if your run the game in Windows 95, and that's not emulating (I don't think).
Experienced Forum User, Published Author, Active player (372)
Joined: 9/25/2011
Posts: 652
I found the answer to my own question:
while true do
	a, b = jpcrr.wait_event();
	if a == "lock" then
		[Code you want to execute each frame]
		if [optional condition if you want to stop processing] then
			jpcrr.pc_stop()
		end
		jpcrr.release_vga();
	end
end
Post subject: Re: Font Display Issue with JPC-RR
Experienced Forum User, Published Author, Active player (372)
Joined: 9/25/2011
Posts: 652
DrD2k9 wrote:
So I've TASed Space Quest 1 on JPC-RR. But as can be seen in this image, the in-game font doesn't display correctly. Using the same game files on dosbox, the font displays appropriately. Any suggestions on how to fix this?
Wow, that is odd. Could you send the movie file? I'll give it a shot and see if I come up with the same thing. I don't see this disqualifying a submission, if it happens consistently for everyone.
Experienced Forum User, Published Author, Active player (372)
Joined: 9/25/2011
Posts: 652
Thanks for the trip down memory lane. The run was fast and fun. Yes vote!
Experienced Forum User, Published Author, Active player (372)
Joined: 9/25/2011
Posts: 652
mrprmiller wrote:
Would it be possible to load all four DOS games into the same instance of emulation at the same time, and change to other games after each?
Yes, that's the only way you could do a marathon run.
Experienced Forum User, Published Author, Active player (372)
Joined: 9/25/2011
Posts: 652
Sirmola wrote:
Is transfering previous save data even allowed? The closest I can think of is the "no dirty sram" rule, but that refers to saves of the same game.
I sure hope so, as a marathon run wouldn't be possible without it!
Experienced Forum User, Published Author, Active player (372)
Joined: 9/25/2011
Posts: 652
mrprmiller wrote:
In version 1.0 of QFG5, you can technically marry 3 people thanks to timing and an exploit, which makes for some extensive planning and intended polygamy. :p
As an aside, it's interesting to see a Reverend promoting polygamy... ;)
Experienced Forum User, Published Author, Active player (372)
Joined: 9/25/2011
Posts: 652
Doh! I just realized that the Wizard can do the exact same route! I thought the Wizard couldn't escape from the statue at the end, but that's only if he has the Trigger spell. By choosing a Thief instead of a Wizard, I waste 0.3 seconds giving magic to my Thief. Just picking Wizard at the start would have saved that. I've updated the submission text to add this.
Experienced Forum User, Published Author, Active player (372)
Joined: 9/25/2011
Posts: 652
I think there'd have to be a discussion on the definition of 100% in this case. Is it reaching the stated max points in the game (500 in QFG II for example)? Is it accomplishing a specific list of tasks? Because of the possibility of multi-classing, the actual max points can vary. Mrprmiller, what's the 100% criteria for an RTA?
Experienced Forum User, Published Author, Active player (372)
Joined: 9/25/2011
Posts: 652
I'll repeat my Question for Glory! From here on out the games in the series get longer and more complicated, and there may come a time when there is an advantage to start from a character file exported from a previous game. Unfortunately, if I use JPC-rr to generate a verification movie, I don't know a way of exporting the generated character file from JPC-rr to a hard drive to be included in the actual run. Would a DosBox video would suffice as a verification movie? If not, what method would be needed to be able to start QFG3 (or later) from an exported character file? Let me know what you think! Thanks. :)
1 2
13 14 15
26 27