• Topic Archived
You're browsing the GameFAQs Message Boards as a guest. Sign Up for free (or Log In if you already have an account) to be able to post messages, change how messages are displayed, and view media in posts.

User Info: MeteorStrike

MeteorStrike
9 years ago#131
The map was too big to fit into a 256 x 256 tile region, so they created a 256 x 256 screen region instead. A map coordinate is stored as a low-byte, high byte combination. The high byte indicates the screen you are in, the low byte indicates the tile within that screen. As a result, the whole map wraps after ( 16 x 256 ) x ( 15 x 256 ) = 4096 x 3840 tiles.

The areas outside the map "normal" boundaries are simply what happens when you interpret other game code as map data. There is nothing special about it, and nothing intentional. That's just how it goes. The game does something like ( high byte x 8192 ) = location in the ROM where the current screen is saved. So when you go out of bounds, the game ends up reading all kinds of out-of-bounds data as map data, until you keep walking and the high byte of your coordinates loops back to 0.

The reason some of those out-of-bounds regions look familiar is because they are touching on data that is intended to be used as town and dungeon maps. When this happens, you end up with those maps rendered, but using the sprites of the world map instead of the sprites of the towns and caves. As a result, depending where you are, you MAY be looking at a town map, but with the world map tiles used as sprites. it's somewhat like the Earthbound world map where all the different areas in the game are "crammed" into the same single logical map.

The entrance and exit locations in maps was coded in a special way. Programmatically speaking, there are what I call entrance points and warp points. Each was programmed differently. Going into a town is an entrance point and will add your last location ( the world map ) into a stack data format. Going into a house will push the town location into the stack. As you exit these homes / rooms / towns / etc. the stack pops and the game can figure out where to put you.

Warp points were used in other cases such as caves. When you enter a cave, the game does NOT push your current location into the stack. Instead, it REPLACES the last stack location with the location you are entering. Upon exit, depending on the tile you stepped on, it knows to change the location back to something appropriate. The reason this was needed for caves was because some caves have more than one exit point. Some caves lead from one entrance in the world map to another one. If the stack approach was used here, it would be impossible for the game to put you on the other side of the cave when you exited the cave through the other entrance.

When you are on the world map, you are at stack depth 0. If you enter into a town, you are at stack depth 1, and entering a house will put you at stack depth 2. Exiting these simply pops the stack accordingly, making it easy to remember where you came from, and where to return you. Entering a cave from the world map will keep you in stack depth 0 instead of pushing you into stack depth 1. You are essentially "warped" to a new location. If you step on certain tiles on the world map that are out-of-bounds, these tiles are marked as boundaries to the current map you are on. ( Much in the same way a town map has tiles around it marked as boundaries, so the game knows to "exit" you back to the world map when you step on them. )

Well, when you step on these on the world map ( stack depth 0 ) the algorithm is supposed to pop the stack and return you to the previous location you were on. The game is essentially popping the stack that has a current depth of 0. This is a bug and the result is that the memory location right before the call stack memory is used as the return point. This will usually lead to returning to the same coordinates, depending on the memory that shows up before the stack memory. Since you're not supposed to walk thru walls, this is not REALLY a bug. There is no other way to trigger this bug so it does not need fixing.

User Info: MeteorStrike

MeteorStrike
9 years ago#132
Also, the way you can tell if a tile is an entrance point or a warp point is easy. If you enter a cave, town, house, etc and you hear the foot steps sound effect, you entered or exited an entry point. If you don't, you entered a warp point. Notice that the castle with that guy with the Thunder attack does NOT make a foot steps sound effect when you enter, because it is a warp point. ( It was needed because this castle leads to a cave that leads to another entrance from the world map. ) If you try to walk-thru walls in that castle, you will also activate the bug, because you are at stack depth 0 when you are in that castle, instead of stack depth 1.

Also, if you move from one region of a cave to another, ( like when you go through those dark parts where you move and then the portion of the cave you were on turns black, and the new area shows up? ) those are actually warp points too. When you enter the temple and you step into the back room where that king is dying at the beginning? Those types of tiles are also warp points. Because they don't push the stack ( due to being a warp point ) you still exit to the same place if you walk-thru-walls there. In any case, the warp points issue is the reason why you should NEVER walk-thru walls in caves to exit the cave faster. You will pop the stack of depth 0 and end up somewhere in the Netherworld...

Note that warp points are specific ( X, Y ) tiles, and not necessarily a tile TYPE. Also note that entrance points are also specific ( X, Y ) tiles, and not necessarily tile TYPES either. However, exit tiles ( which define a town's boundaries, etc. ) ARE defined as specific tile TYPES so that the game doesn't have to keep a huge list of possible exit tiles...

Also, for technicality's sake, I don't remember if the algorithm pushed the current location to the stack and then moved the pointer, or moved the pointer and then pushed the current location to the stack, or added the new location and then moved the stack pointer, or what. It's been a while and I'm too lazy to look at my notes right now. The algorithm concept is still the same, and the bug happens for the same logical reason anyways...

User Info: _catAstr0phe_

_catAstr0phe_
9 years ago#133
The areas outside the map "normal" boundaries are simply what happens when you interpret other game code as map data.

That makes perfect sense, but is rather anticlimactic lol.

I'm ready to start learning assembly, i saved links to some tutorials etc and started skimming through a few commands. Could you give me a DoaE source file, or should i use a disassembler like TRaCER ?

Also, have you ever coded in nBasic and do you recommend it? (though I imagine it would only save time when creating your own game, not modding a game)

User Info: MeteorStrike

MeteorStrike
9 years ago#134
I can't access my home PC for now. I got a virus while surfing for pr0n the other day. :p I'm pretty sure I got rid of it, but I'm an extremely paranoid person. I am going to solve the XP-Admin-internet-viruses-problem once and for all and switch to Vista. For all the crap that people talk about it, its UAC feature is by far one of the safest out there in terms of keeping viruses out of your machine...

The real problem with Vista is that a) they focused too much on changing the whole freaking layout and functionality instead of sticking to security, making everyone pull their hairs out, and b) a lot of people complain that Vista sucks for doing certain things without realizing that it's actually for good reasons (so lack of understanding of Vista itself by most users is a big problem too.)

And yes, I realize that running on XP as an user should solve the problem for the most part, but XP Home doesn't let you set any ACLs and DACLs on files and its a nightmare to run as a regular user on XP... so screw it, Im going to get Vista with all the latest updates and be done with it. I've been meaning to get a laptop for a while anyways... Now I have an excuse to do so sooner rather than later. (And what better time to get a great deal with all companies out there trying desperately to make a sale!)

Until I get a laptop (prob in 2 weeks) I don't plan on turning on my XP machine for paranoia's sake. When I get it, Im gonna get an external enclosure for my data HDD and then reinstall Windows XP on the desktop and use it as a test machine. But all this means that I won't have access to my files (DoaE traces and such) for a good 2 - 3 weeks...

User Info: MeteorStrike

MeteorStrike
9 years ago#135
Oh, and I've never even heard of nBasic. Just googled it. If you are dead set in making an NES ROM ( i.e. a program or game that runs on NES emulators) Then I guess you should go in that direction. I would recommend sticking to something more relevant, specially if you plan to pursue a career in software. So coding things in C# or java might be a good idea.

If you are worried about people not running your apps for security's sake, then you are better off doing something on javascript for web integration (if possible) than to code for old NES architecture. At least javascript coding is still relevant, but you gain nothing by making apps / games for the old-school NES... Just my 2 cents on it (and yes, I am biased with regards to using your time in more productive ways, as you can see from my previous posts.)

On a related note, I showed a demo of 3 different programs I worked on during college in my own spare time during one of my interviews years ago, and it landed me my first job. All 3 demo programs were all game-related. (One was a password generator of sorts with some advanced features, one was a puzzle solver of sorts, and one was a DOS-based game written in assembly) So my point is, an utility for old games that runs on modern technology can still be worth the effort, in terms of having something you can discuss with employers during live interviews and such. The point is to keep the technology you work on as relevant. ;)

User Info: _catAstr0phe_

_catAstr0phe_
9 years ago#136
noooo don't get Vista, XP is twice as fast in several different benchmarks. If I get a new PC, first thing i'm gonna do is reformat it and put XP on. And laptops are ripoffs, for the same price you can get a desktop that's at least 2x as good. Do you do your rom-hacking, etc. on park benches? :P

There's no hurry for the DoaE files, i'm gonna be away for 5 weeks. GL with your job, and virus issues. Seems a little funny though, a hax0r like you getting viruses :P

User Info: MeteorStrike

MeteorStrike
9 years ago#137
No one is immune to viruses. Its much like the people who say they can drink and drive and nothing will happen to them. That's just people being naive and arrogant. No one is immune. At least I cought the virus right away before it even finished installing anything. I killed the process, renamed the exe files it downloaded, and then I disabled them from msconfig startup. It turned out that it had changed registry entries too and disabled task manager ( which I already had running, which is why I was able to kill the process. :p )

I did a system restore and all the exe and configs it made went away ( were restored to previous settings. ) So in a way, being a hax0r did not make me immune, but it sure gave me a good fighting chance against it. ;)

Also, XP is "faster" only because it does less. You wouldn't believe how many things Vista does in the background for optimization / stability purposes that makes it slower. The fact is, there are a number of things you can do to disable those things, which would make Vista somewhat faster.

On a related note, I would give security priority over speed. I would rather run a little slower and feel safe from viruses, spyware, identity theft, etc. than run a little faster and always watching my back. That's just how I see it.

Also, I don't have a laptop, so this is my chance to get one. Laptops these days are faster than my desktop anyways, so I won't loose much. Also, you get less for the same money, but you also get portability and the compact-ness of a laptop. No PC will offer you this, and for me, portability is something I need. ( Moving from one part of the country to another for a new job every now and then, taking my PC for demos in interviews is not a bad idea, etc. )

Since I am keeping my desktop anyways and simply re-installing windows XP on it, I can still do stuff on XP with my laptop. I just don't plan on hooking it up to the internet again...

User Info: MeteorStrike

MeteorStrike
9 years ago#138
Also, I will admit that if I had been running Firefox 3.0 instead of the old Firefox 1.5, I would not have gotten the virus. A PDF file downloaded automatically, and Adobe opened it, causing the contents to extract an EXE, which then ran.

In Firefox 3.0, this behavior can be changed. You can configure FireFox to NOT open certain documents automatically, which you can't configure in FireFox 1.5. I switched from 3.0 back to 1.5 because of a feature in 1.5 that was changed in 3.0, which has to do with resizing text. It annoyed me so I went back to 1.5.

So I guess a point here is that keeping updated all the time would be a good way to avoid viruses also... but the other point here to be learned is that features are in no way more important than security. Sacrificing the usability of the text resizing implementation of Firefox 1.5 would suck, but it would give me superior security. I am now trading the usability of XP for the security of Vista, so it's not that much different from trading the usability of Firefox 1.5 for the security of Firefox 3.0...
  • Topic Archived