Posts for Luke

Post subject: Super Turrican
Experienced Forum User, Published Author, Player (84)
Joined: 2/10/2006
Posts: 113
Location: US
Hi all-- I think I will try to beat this Famtasia movie. The old submission is here http://tasvideos.org/forum/viewtopic.php?t=1609 There are a few possibilities for modes This game can be run in PAL or NTSC. In fact, in PAL mode there is a black line on the bottom of the screen, which tells me it was designed to work in NTSC, even though it is european. Some timings are different between the modes, and I have verified that the game does run faster in NTSC. So I thought I would do NTSC to compete with the current run. There are also different difficulty levels. It goes up to 4, but it's just extra enemy HP (I think). The last run played on difficulty 2. Should I up the difficulty?
Use the force
Experienced Forum User, Published Author, Player (84)
Joined: 2/10/2006
Posts: 113
Location: US
Actually there are a few interesting questions PAL vs NTSC mode, and what difficulty. So I think I will make a thread in the NES forum and see what the opinion is)
Use the force
Experienced Forum User, Published Author, Player (84)
Joined: 2/10/2006
Posts: 113
Location: US
I think I will try to improve Super Turrican. Zerstorung's run seems well-planned (as far as I can tell), so mostly I'll just be optimizing frames.
Use the force
Experienced Forum User, Published Author, Player (84)
Joined: 2/10/2006
Posts: 113
Location: US
(majorly edited) I've gotten the memory mappers Phil mentions to compile. It seems to run some ROMs that wouldn't run before, like Paperboy 2! I will try to get a new version up soon.
Use the force
Experienced Forum User, Published Author, Player (84)
Joined: 2/10/2006
Posts: 113
Location: US
I seem to remember seeing a SSB run. Was that ever considered for publication?
Use the force
Experienced Forum User, Published Author, Player (84)
Joined: 2/10/2006
Posts: 113
Location: US
FODA: The "Maximize" field tells BasicBot how to score the input. After the input ends, it calculates the equation in "Maximize." It will try to find the input that maximizes "Maximize."
- how do i set a goal "ram(05A4)=82" AND max amount "frame=20"? i tried "ram(05A4)=82&frame=20" but it doesn't work
First, I should mention order of operations. I'm really sorry, but programming correct order-of-operations in C is too much work for me... Try using parentheses: (ram(05A4)=82) & (frame=20). Oh also, you must prefix hex numbers with "x". So (ram(x05A4)=82) & (frame=20) is how to write that correctly. That said, I think you want "frame=20" in the "End" field. This tells BasicBot to end the input when 20 frames of input have been generated. Then put "ram(x05A4)=82" in the "Maximize" field. This gives a score of 0 to inputs where the ram is not 82, and a score of 1000 to inputs where the ram is 82. Or, if what you actually wanted was a maximum of 20 frames, you could try this: in "End", you could put (ram(x05A4)=82) | (frame=20). That tells BasicBot to stop as soon as the ram is 82, or stop at frame=20. Then for Maximize, you could do "ram(x05A4)=82", and the tiebreak could be "-frame". This says, first try to make the ram 82, then try to minimize the number of frames. --- Bisqwit/Linux users: I wouldn't say I'm maintaining the code... nitsuja was the last one to make important changes I think. I haven't touched any of the emulation internals, I've just made some UI "attachments" to the program to make TASing easier. I think I did break a few things on non-windows platforms, since I added an argument to a function or two (that's assuming nitsuja's version even would cross-compile, I don't know :). Also I really don't know what I'm doing with these makefiles, they are way more complicated than any makefiles I've used before... But I have tried to keep all Windowsisms either within #ifdef WIN32 or #ifdef _USE_SHARED_MEMORY_, or in the Windows driver files. Regardless, all the changes I have made are windows-specific anyway, so there's no reason to use my source instead of the original 98.13/15 for another platform. I have looked at the 98.12 source a bit. As Bisqwit said, the boards/mappers were majorly reorganized and improved since then. Not only do you need the boards and mapper files, but the ppu.c file has some related changes to support the new mappers. Maybe x6502.c, too, but I think this file is identical. AFAIK, the movie file format is identical. I'm surprised you've gotten away with 98.12 source for so long, actually--TMNT, Castlevania, and DW4 are all known to desynch in 98.13/15. That's about all I can say... nitsuja would be more helpful since he made (all?) the changes between 98.12 and 98.15.
Use the force
Experienced Forum User, Published Author, Player (84)
Joined: 2/10/2006
Posts: 113
Location: US
How much time do you think the whistle trick could save? There seems to be a few seconds load time going in and out of each dungeon, and starting a game also seems to take a while. So I'm not so sure an FDS run would be faster unless there is a big route improvement, like 1 minute.
Use the force
Experienced Forum User, Published Author, Player (84)
Joined: 2/10/2006
Posts: 113
Location: US
I have a working BasicBot now, and a few other minor updates. I've also got a reference for BasicBot on the website so hopefully some people will be able to figure it out :) http://lukeg.50webs.com/fceu.html
Use the force
Experienced Forum User, Published Author, Player (84)
Joined: 2/10/2006
Posts: 113
Location: US
You mean on a console? 8 in a row is bad luck, but still possible (10% chance actually P). If you're doing a TAS you can just check the memory right after you start a game. Also, are you using continues? Continues affect the technodrome, but I don't know how. TAS or console, I'm looking forward to your run. I couldn't believe at SDA you claimed 113 left on the clock after swimming! So keep at it D
Use the force
Experienced Forum User, Published Author, Player (84)
Joined: 2/10/2006
Posts: 113
Location: US
Actually while talking about this tetris game... I noticed some pieces don't behave symmetrically. This isn't normally such a big deal, but when doing death mode + hide next, it can be frustrating since the pieces aren't consistently manipulatable. For example, the I-piece needs only 2 columns of room to rotate on the right side of the screen, but 3 on the left. Will rotate to vertical:
..........
......XXXX
....OOOO..
....OOOO..
....OOOO..
Won't rotate:
..........
XXXX......
..OOOO....
..OOOO....
..OOOO....
I'm sure this is just because the pivot-point is the 3rd square. But it still is annoying since you have to think asymmetrically :) The L-pieces also seem to have inconsistent behavior. Anyway a minor complaint, but it would make those modes more doable :) As it is, the I-piece is INCREDIBLY annoying in death mode/hide next.
Use the force
Experienced Forum User, Published Author, Player (84)
Joined: 2/10/2006
Posts: 113
Location: US
I personally would love to see more TASed racing games, but it's extremely hard to do. It's pretty easy to make a single frame-perfect turn, but it's really tough to make a frame-perfect route through a course. And yeah, this was one of the first N64 games IIRC. Doesn't mean it's good, but it is well-known.
Use the force
Experienced Forum User, Published Author, Player (84)
Joined: 2/10/2006
Posts: 113
Location: US
Hi, sorry I'm a little slow at replying, I've been busy in real life :) I'll look into the speed problems. I've been having a similar issue, I only get about 400% when I used to get 800%. I might have some code accidentally running when it shouldn't be? Or maybe gcc is just being dumb about some optimizations. I'm glad you brought this up because I wasn't sure FCEU was actually running slower. -- Sorry about confusion, the BasicBot right now is not useful for anything, it's just a test. I've got a working BasicBot now, I will release soon. It is quite flexible, although I still recommend using an external program for anything requiring too much code. I wrote a basic expression parser, so you can enter formulas, etc. The downside is, order of operations is right-to-left, so you will need lots of parentheses :) Right now it supports (integer math): +, -, *, /, (, ), % (remainder aka mod), hex numbers, & (and), | (or), ^ (xor), =, <, >, >=, <=, ?: (if-else), access to RAM, access to current joysticks, number of frames, number of attempts, and 256 counters you can use for whatever. This is sufficient for doing either random searches, or systematic searches. Example: Say you want to find the first frame so that pressing Up makes RAM(0) = 1. In the Up field, you could enter "frame=attempt" i.e. press Up if the frame # = the attempt #. In the "End when" field, you could enter "upbutton > 0", i.e. the up button was pressed. In the "Maximize" field, you could enter "ram(0)=1", since this is what we want to be true. In the tiebreak field you could enter "-frames". Anyway when I release it, I will try to document it fully, and have some examples. -- adelikat: See my post in the Memory Watch thread for actual code that opens the BotInput. The functions OpenFileMapping and MapViewOfFile should be the same name in whatever programming language, since they are part of the NT kernel. Hoe is using C#, for example. I know VB also has these functions. I don't know about Java. Unfortunately in windows you can't directly pass control to another program, so I have to manually make commands available to other programs.
Use the force
Experienced Forum User, Published Author, Player (84)
Joined: 2/10/2006
Posts: 113
Location: US
EDIT: Hoe, I think I found your problem. I see in your code "file = NTKernel.OpenFileMapping(4, false, ramMapPrefix + ramMap);" The "4" means FILE_MAP_READ, i.e. read-only. Try replacing it with a 983071=FILE_MAP_ALL_ACCESS. And in "MapViewOfFile(file, 4, 0, 0, 0); " try replacing the "4" with a 2=FILE_MAP_WRITE. Hi--sorry I'm a little slow at answering FCEU questions, but I've been busy in real life. The next FCEU I post will not use shared memory if another FCEU is open (it's just a matter of replacing MapViewOFFile with malloc, I've just been lazy). But yeah, right now having 2 open will just behave weirdly. I'm pretty sure the shared memory works right now. True, a duplex situation like you described is better, but as it is, it should work. Here is an executable that will open the memory and write a few values: http://lukeg.50webs.com/bottest.exe.foo It will tell you what errors it gets opening the memory. Be sure that you check the Tools--UseExternal Input option. Right now FCEU won't look for bot input unless you tell it to.
...
	HANDLE mapBotInput;
	unsigned int * BotInput;

	mapBotInput = OpenFileMapping(FILE_MAP_ALL_ACCESS, false, "fceu.BotInput");

	if(!mapBotInput)
	{
...Error report
	}
	
	
	BotInput = (unsigned int *) MapViewOfFile(mapBotInput, FILE_MAP_WRITE, 0, 0, 0);
	
	if(!BotInput)
	{
	...Error report
	}

	BotInput[1] = 65536;
	BotInput[2] = 1;
	BotInput[3] = 2;
	BotInput[4] = 4;
	BotInput[5] = 8;
	BotInput[6] = 16;
	BotInput[0] = 6;

	UnmapViewOfFile(mapBotInput);
	CloseHandle(mapBotInput);
	BotInput = NULL;
Use the force
Experienced Forum User, Published Author, Player (84)
Joined: 2/10/2006
Posts: 113
Location: US
So I guess in this version of Excitebike, the game won't let your speed exceed 04FF (where 0340 is your unassisted top speed), or about 5 pixels per frame. So it'll be a lot slower than the regular NES version, where your speeed would just keep increasing every time you go over a ramp.
Use the force
Experienced Forum User, Published Author, Player (84)
Joined: 2/10/2006
Posts: 113
Location: US
I'd just like to say, I totally agree with Warp about C being obsoleted by C++. Really the only reason to learn C nowadays is if you want to work with already-existing C code (which sadly includes FCEU). I personally like to/need to do a lot of low-level coding, so I don't use a lot of C++'s more advanced features, but having objects makes organizing your code 10x easier. Plus, learning OOP from C++ is a good intro before doing a fully OO language like Java. Coming from Lisp, Ada, and QBasic, I guess my warning about C/C++ is that they don't do much bounds-checking for you. I strongly recommend bounds-checking everything in your programs--you will accidentally write past the ends of arrays all the time if you don't. These bugs can be really hard to catch, because C/C++ don't care if you go past the end of an array, as long as you're still writing to your program's allocated memory.
Use the force
Experienced Forum User, Published Author, Player (84)
Joined: 2/10/2006
Posts: 113
Location: US
The built-in bot doesn't work right now, it just does random input--I'll be adding to it later. However, external programs should work. Come to think of it, really I should have disabled it before releasing. The bot opens the current savestate before running, so that's why it's getting an error. I'm not sure about the pause error--but I think that's just because the bot will try to run for 1000 frames before you regain input. You do have to manually unpause, however, after unchecking "use external input"
Use the force
Experienced Forum User, Published Author, Player (84)
Joined: 2/10/2006
Posts: 113
Location: US
Ok I think I am ready to release an FCEU with bot support. I made a little webpage here with more info http://lukeg.50webs.com/fceu.html A little bug on the webpage in the autofire section, I talk about a menu item "Alternate A and B", but it's actually called "Desync Autofire". I forget to recompile the menu P Anyway, this has a bunch of little tweaks and fixes from the shared memory/memory watch version. I tried to put in a bunch of your guys' suggestions, but I didn't get around to making the saveslot display yet. I haven't tested external input much, but it seems to be working after feeding FCEU random strings of data ) I'll release this version so bot programmers can play with it. Let me know about bugs etc., although I might not have a chance to do much programming for a couple days.
Use the force
Experienced Forum User, Published Author, Player (84)
Joined: 2/10/2006
Posts: 113
Location: US
I've put in a variety of autofire pattern options. As soon as I have working bot code (tonight if things go smoothly?) I will post a new version with a bunch of useful little features ppl have been requesting. I'm trying to stay away from doing anything that affects the config files. I want this to be 100% compatible with the standard nitsuja version. So, I don't think I'll put in a button-combo editor, at least not yet. Plus, I'm not sure how useful this would be for TASing when there is frame advance (although I know it's useful for playing in real-time). Maybe in the future a button combo editor could be added, but not just yet )
Use the force
Experienced Forum User, Published Author, Player (84)
Joined: 2/10/2006
Posts: 113
Location: US
Actually this would be really easy to do. I'll put it in the next FCEU version.
Use the force
Experienced Forum User, Published Author, Player (84)
Joined: 2/10/2006
Posts: 113
Location: US
Hi all-- So I think I might try to make a TAS of the Vs Excitebike (VS, not FDS). IMO it's a better game than the original, with more tracks and bonus levels. Before I start, I was wondering you can skip the first 2 tracks when you start a new game. The first 2 tracks are very similar (though not identical) to the regular NES version. So, should a run skip these tracks, or play the whole game?
Use the force
Experienced Forum User, Published Author, Player (84)
Joined: 2/10/2006
Posts: 113
Location: US
Yeah I also was having framerate problems. But it looked really well-done, some of the tricks surprised me )
Use the force
Experienced Forum User, Published Author, Player (84)
Joined: 2/10/2006
Posts: 113
Location: US
Hmm, I think it should display the *.txt files. I didn't code the load/save dialog myself, so I hope it works ) However, right now it doesn't automatically add a .txt after your filename when you save, so maybe your files aren't getting named properly? I'll definitely make it automatically add the .txt in the next version, since that confused me at first. I'll check out the directories thingy too. I think there's already some good code in FCEU for directories so it shouldn't be too much work. Happily, the weekend is here now, so I'll have a good chunk of time to work on FCEU.
Use the force
Experienced Forum User, Published Author, Player (84)
Joined: 2/10/2006
Posts: 113
Location: US
Mr. Kelly R. Flewin wrote:
Now... if even half of these moves are possible on a console... oooh yeah!
You could probably use an autofire to press the B button. It might not work all the time, since it would have to be in sync with the game timer, but I'm sure it's possible. It would take care of engine overheating and definitely could improve times. On the other hand, I don't really think the in-air techniques could be done on a console, because the timing varies from jump to jump. Anyway, glad ya'll enjoyed the run. I loved FODA's run too... I think this game just makes a really good TAS :)
Use the force
Experienced Forum User, Published Author, Player (84)
Joined: 2/10/2006
Posts: 113
Location: US
Yeah, I did use Superninja once (a long time ago, just for one submission I think). I don't have the password or the email for that account anymore, so yeah, go ahead and delete Luke G/Superninja. Sorry about that~~
Use the force
Experienced Forum User, Published Author, Player (84)
Joined: 2/10/2006
Posts: 113
Location: US
I'm glad the memory watch has been useful so far. I've tweaked it a bit, and probably this weekend will have another version with some minor changes. I'm going to add hex viewing as an option, too. I like the idea of stopping a movie on its last frame. I agree, definitely more convenient. I'll check how hard that would be to add. ----- Anyway, I think this weekend I will start working on bot support. I'm open to suggestions how to implement this. I don't know a lot about inter-process communication, except for sharing memory. So if there's a better way to do this than memory sharing, let me know! My current thinking is this set up a page of shared memory (say, 4k would be more than enough), that FCEU will check for input. If there is a signal that the bot input is ready (for example, maybe writing a '1' to the first byte), then FCEU will use this for input. The input could be stored however, probably just serially 2bytes/frame (+ more for special commands) representing the controller input. The bot input would simply replace the user input (just like playing a movie), so it won't be hard to program this. The only special command I was thinking about giving the bot is Load Current State. I wouldn't want a bot to overwrite save states. However, if this is something you guys would like, I could make some bot-only savestates. This would be more work, however, so it wouldn't be in the first version. So I'll give a little example how I was thinking this could work A bot generates some potential input. It writes "Load Current State" to the memory, and then the input. The bot writes a non-zero value to the first byte (maybe the input length would be a good value?), and then when FCEU checks the memory, it runs the potential input. After FCEU is done, it writes '0' to the first byte. Now the bot can look at the NES RAM, etc., and decide what to do next--either "Load Current State" and try again, or continue giving input. If there is a way to send messages to other programs via the message queue (maybe I'll check MSDN and see what they have about this), this process could be a little more streamlined. Probably not a big deal, since almost all the CPU time will be for the emulation, and any overhead will be pretty small compared to this. But like I said, if you know better ways to do this than sharing memory, I'd love to hear about it ) Anyway, I'm open to feedback about this, so potential bot authors (Hoe, adelikat, ?), I'd be interested in hearing your thoughts. Probably I will also make a basic bot included with FCEU. After all, I need something to test it with, so I might as well add it to FCEU )
Use the force