Level designing

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

Celius wrote:Uh, that wasn't the full code by the way. that was a PEICE. I will create a good Qbasic program that designs levels, and I will have to think of a way to have my code incbin it. I'm not sure of how that one will work. I will be frustrated for months trying to get it to work. Well, I'll think of a good scrolling code, or go to someone for help. When saving the level data in my level editor, what kind of file should I save it as?
Just save it in the format you think is most efficient to read. Keep in mind that whatever you output from the editor is what your game code (written in 6502 assembly by YOU) is going to read and draw to the screen.

There are no "standards" for formats, it's all up to you. File extensions don't matter at all, the contents of the files do. Whatever the format you output from the editor, you'll be .incbin'ing it in your code.
Celius
Posts: 2158
Joined: Sun Jun 05, 2005 2:04 pm
Location: Minneapolis, Minnesota, United States
Contact:

Post by Celius »

Yeah, I'm going to make a Qbasic program that makes a large map, and updates it 1 line of tiles at a time. I just really hope I can make it output stuff on the NES. Even if it's not what I expect, I still want it to put stuff on the screen. This is the longest forum i've ever seen. yeah, the reason I was wondering how to load a chr file into Qbasic was because I want to have it act like NSA, but better. I want to find out if there's a way to have qbasic react to mouse movement. That's what I hate about DOS.
Celius
Posts: 2158
Joined: Sun Jun 05, 2005 2:04 pm
Location: Minneapolis, Minnesota, United States
Contact:

Post by Celius »

By the way, what Tile editor was written in Qbasic?
Guest

Post by Guest »

Celius wrote:Yeah, I'm going to make a Qbasic program that makes a large map, and updates it 1 line of tiles at a time. I just really hope I can make it output stuff on the NES. Even if it's not what I expect, I still want it to put stuff on the screen. This is the longest forum i've ever seen. yeah, the reason I was wondering how to load a chr file into Qbasic was because I want to have it act like NSA, but better. I want to find out if there's a way to have qbasic react to mouse movement. That's what I hate about DOS.
The editor doesn't have to do the "1 line of tiles at a time" thing, this is an in-game thing, not a level editor thing. Qbasic won't interact with the NES at all, it is just a tool to prepare the level in a format your game code can make good use of.

That is the whole deal of the level editor, a better NSA, one that is suited to (and optimized for) the needs of your game.

There are tons of mouse routines for qbasic, this shouldn't be hard to find at all, there are so many qbasic sites on the net that carry this kind of stuff... look for it in google and you will surelly find one.
Celius wrote: By the way, what Tile editor was written in Qbasic?
I said I think there is one, I'm not sure, so I can't give you a name. I can say there is an emulator made in qbasic, it's called unessential, look for it in www.zophar.net (I think you can find it there). Since it is a NES emulator, it must have code to decode NES graphics somewhere in there.

-tokumaru-
Celius
Posts: 2158
Joined: Sun Jun 05, 2005 2:04 pm
Location: Minneapolis, Minnesota, United States
Contact:

Post by Celius »

I just found out a really easy way to rip graphics. I think it may require Nesticle, due to its PCX snapshot thing. Take a snapshot, open it in photoshop, copy and paste it into paint, and save it as a .bmp file. Then open YY-Chr, and copy and paste the stuff from paint into YY-Chr. Make sure that there's only 4 colors in the bmp, and make sure they are the following:

Red
Green
Blue
Black

When you copy and paste it, whatever's Red will show up as the 4th color on the pallete, whatever's Blue will show up as the second, whatever's Green will show up as the the third, and Black will be the first. I'm sure you all knew that, but I just thought I might share it just in case. I'm sure different rules apply for different systems. But that one for sure works with windows.
User avatar
Quietust
Posts: 1920
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Post by Quietust »

There's an even easier method - use a tile editor that supports opening multiple files (such as Tile Layer Pro) and just drag-and-drop the tiles from one file to the other. This has the added bonus of being able to load tiles from ANYWHERE in the game, not just the ones that happened to be loaded at the time you took the screenshot.

The only caveat is that this method generally doesn't work with games that use CHR-RAM (since their tile data will likely be compressed somewhat).
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
Celius
Posts: 2158
Joined: Sun Jun 05, 2005 2:04 pm
Location: Minneapolis, Minnesota, United States
Contact:

Post by Celius »

Well, you can do that even in YY-Chr. I shouldn't have said ripping graphics is made easier by this, I should have said, if you want something you see on the screen in a chr file, do that method.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

Celius wrote:I just found out a really easy way to rip graphics. I think it may require Nesticle, due to its PCX snapshot thing.
Nope. Any emulator designed for Windows will do, as long as you can set it to unscaled (x1) windowed mode. Alt+Print Screen takes a snapshot of the current window in FCEU, Nintendulator, and every other "normal" Windows program and puts it on the Windows clipboard. Then you can...
paste it into paint, and save it as a .bmp file. Then open YY-Chr, and copy and paste the stuff from paint into YY-Chr.
I'm working on a program called 'bmp2tiles' that takes any .bmp file and turns it into tiles for 1-bit, GB, SMS, NES, Super NES/PCE, Virtual Boy, Genesis, GBA, or 8-bit packed. (Why Virtual Boy? Many GBA games use 1-bit or Virtual Boy format tiles and expand them to GBA format at runtime using a GBA BIOS call.) And yes, it'll even work with 8x16 pixel sprite mode.
Celius
Posts: 2158
Joined: Sun Jun 05, 2005 2:04 pm
Location: Minneapolis, Minnesota, United States
Contact:

Post by Celius »

Yeah, I just think that it's easier to copy and paste graphics from paint into a chr editor right away, instead of going into command prompt, and doing all that crap.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

True, but the command prompt is more scriptable. Have you ever read the GNU Make manual? If you keep the graphics in a .bmp file, which some claim is the most convenient format for making modifications, you can have your makefile automatically rebuild the .chr file whenever necessary. Having the grunt work of data conversion handled behind the scenes can simplify larger projects.
Celius
Posts: 2158
Joined: Sun Jun 05, 2005 2:04 pm
Location: Minneapolis, Minnesota, United States
Contact:

Post by Celius »

You know, Jnes and VirtuaNes seem to skip a line of tiles. Am I right? FCEUXD (AWESOME EMULATOR!) and Nintendulator(ALSO AWESOME!) are the only ones I know of that don't. If I write my code like this:

Code: Select all

	lda #$20
	sta $2006
	lda #$20
	sta $2006

	ldy #$00
	ldx #64

textwrite:
	lda menu,y
	sta $2007
	iny
	dex
	bne textwrite

	lda #%00001110
	sta $2001
	stx $2005
	stx $2005

menu:	.db $7,$8,$8,$8,$8,$8,$8,$8,$8,$8,$8,$8,$8,$8,$8,$8,$8,$8,
$8,$8,$8,$8,$8,$8,$8,$8,$8,$8,$8,$8,$8,$9
	.db $A,$B,$B,$B,$B,$B,$B,$B,$B,$B,$B,$B,$B,
$B,$B,$B,$B,$B,$B,$B,$B,$B,$B,$B,$B,$B,$B,$B,$B,$B,$B,$C

it starts at the top of the screen on Jnes and stuff, but starts on the second line like it should on Nintendulator and FCEUXD. Am I correct when I state that theory that Jnes skips a line?
Celius
Posts: 2158
Joined: Sun Jun 05, 2005 2:04 pm
Location: Minneapolis, Minnesota, United States
Contact:

Post by Celius »

Oh, by the way, that method you see above of loading a BG is quite reliable, it seems. So yay! I found a reliable method! thanks to the hello.asm code for NESASM, there are probably a bunch, but oh well.
User avatar
Disch
Posts: 1848
Joined: Wed Nov 10, 2004 6:47 pm

Post by Disch »

Do you have scanline clipping turned off? The NES renders 240 scanlines, but when emulating NTSC, most emulators chop off the top and bottom 8 scanlines (only rendering 224 scanlines) since the top and bottom are chopped off on most NTSC displays.

If one emu is chopping off the top 8 lines, and another isn't, it may appear that one is rendering the image lower than the other -- when it really isn't. One just isn't showing the whole picture.

Your code is drawing to ppu$2020, so without clipping, this will start drawing 8 pixels down from the top of ths screen. With clipping it will start at the very top of the screen.
Celius
Posts: 2158
Joined: Sun Jun 05, 2005 2:04 pm
Location: Minneapolis, Minnesota, United States
Contact:

Post by Celius »

Yeah, why would you want clipping? I'm sure there's a reason for it, but I think it's dumb.
User avatar
Disch
Posts: 1848
Joined: Wed Nov 10, 2004 6:47 pm

Post by Disch »

As stated -- most NTSC displays cut off the top and bottom of the screen. As such, Some games expected that area to not be visible and there's sometimes trash up there which clipping hides. Can't think of a game offhand which does that, but I know they exist. Also, look at Final Fantasy without clipping. Scroll the screen virtically -- see that effect at the top and bottom? That's an unavoidable problem with Virtical Scrolling + Vertical mirroring. However clipping hides it nicely.

Another possible benefit of clipping is that it brings the screen a little closer to 4:3 aspect ratio (though it's still pretty far from it). So all the people that like stretching the image to fit the screen will have less distortion than they would if all 240 lines were rendered.

So yeah, I'm pro-clipping -- though most/all emus make it optional so it's easy to flip off if you don't like it.
Post Reply