Plane remapping
Moderators: BigEvilCorporation, Mask of Destiny
Plane remapping
Hello everyone.
From the past week, I had the idea to remake a pokemon game.
Everything was ok until yesterday, when I had to write the scrolling system.
The hardest part of this, is when I must do the map renewing code, to simulate a bigger map.
I'm stuck trying to program this part. I have no idea which formula I can follow to do this.
Can you at least give me a clue about this?
Thanks, and excuse my bad english.
From the past week, I had the idea to remake a pokemon game.
Everything was ok until yesterday, when I had to write the scrolling system.
The hardest part of this, is when I must do the map renewing code, to simulate a bigger map.
I'm stuck trying to program this part. I have no idea which formula I can follow to do this.
Can you at least give me a clue about this?
Thanks, and excuse my bad english.
Did you see the genres demo ?
I have a huge plan you can scroll left / right / up / down
How I did this ?
I haven't source code here so , from what I remember (since I fought a lot with the best / speed method for thos)
1. define 64x64 scrollable plane
2. define the 2 "switch" columns and 2 rows you'll use for redraw in the middle of the initially hidden parts of the plane
3.draw up to first column, the second column and after will be the column before you.
col 0 = map[n]
col 1 = map[n+1]
col .. = map[n+..]
col 40= map[n+40] ===> first switch column
col 41= map[n-(64-41)] ===> second switch column
...
col 62 = map[n-2]
col 63 = map[n-1]
4. the REAL plane index of a switch colum will always be colIdx + (scrollHIndex / 8)%64
the REAL plane index of a switch row will always be rowIdx + (scrollVIndex / 8)%64
5. every vblank redraw the 2 columns and 2 rows from map[colIdx][...] and map[...][rowIdx] at the plane REAL index
It's what I use with the MAP Genres plugin
I have a huge plan you can scroll left / right / up / down
How I did this ?
I haven't source code here so , from what I remember (since I fought a lot with the best / speed method for thos)
1. define 64x64 scrollable plane
2. define the 2 "switch" columns and 2 rows you'll use for redraw in the middle of the initially hidden parts of the plane
3.draw up to first column, the second column and after will be the column before you.
col 0 = map[n]
col 1 = map[n+1]
col .. = map[n+..]
col 40= map[n+40] ===> first switch column
col 41= map[n-(64-41)] ===> second switch column
...
col 62 = map[n-2]
col 63 = map[n-1]
4. the REAL plane index of a switch colum will always be colIdx + (scrollHIndex / 8)%64
the REAL plane index of a switch row will always be rowIdx + (scrollVIndex / 8)%64
5. every vblank redraw the 2 columns and 2 rows from map[colIdx][...] and map[...][rowIdx] at the plane REAL index
It's what I use with the MAP Genres plugin
-
- Very interested
- Posts: 124
- Joined: Sun Jan 29, 2012 2:10 pm
- Location: North America
- Contact:
Out of curioisity how did you start out learning ASM before something C or C-like?Bitybity wrote:I don't use GenRes, because I don't know how to work with C language (I'm 100% "lost"). I work in ASM.
I am in great awe of people who hand-code ASM, but I've always seen C, C++ or Java taught in schools when teaching computer programming concepts. I work in Java, but now can switch back and forth fairly easy. Still don't have ability to write ASM though.
-
- Very interested
- Posts: 2440
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
I still don't know C or C++ or such... just ASM, several kinds. I find ASM a whole lot easier haha
Mida sa loed ? Nagunii aru ei saa
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
-
- Very interested
- Posts: 2984
- Joined: Fri Aug 17, 2007 9:33 pm
When I started on computers, there wasn't C available... you had your choice of assembly, Forth, or BASIC. C was for mainframes or the like. C started to penetrate the home computer market in the mid to late 90's, and was often a really crappy K&R compliant homebrew compiler, or a REALLY expensive SAS compiler (seriously, they wanted over $500 for SAS C at the time).
I did get Deep Blue C for the Atari 8-bit - that was a Small C compiler that wasn't too bad made in the late 80's. But for the most part, it was BASIC's Golden Age... every platform had at least a couple different BASIC systems, be it MS's super-buggy BASIC, to BASIC compilers. BASIC dialects became very popular, like AMOS.
So many people of the time started with BASIC, but soon realized it was usually too slow. So you learned assembly so that critical portions of your BASIC program could be done as an assembly language routine instead. That led to full assembly programs. Most of my work on the Apple, Atari, and Amiga was 100% assembly. It was only after CBM went bust that C really started to hit its stride, and I started mixing a little C and mostly assembly. It wasn't until I was working on P2's and PowerMacs that it became mostly C with a little assembly rather than the other way around.
I did get Deep Blue C for the Atari 8-bit - that was a Small C compiler that wasn't too bad made in the late 80's. But for the most part, it was BASIC's Golden Age... every platform had at least a couple different BASIC systems, be it MS's super-buggy BASIC, to BASIC compilers. BASIC dialects became very popular, like AMOS.
So many people of the time started with BASIC, but soon realized it was usually too slow. So you learned assembly so that critical portions of your BASIC program could be done as an assembly language routine instead. That led to full assembly programs. Most of my work on the Apple, Atari, and Amiga was 100% assembly. It was only after CBM went bust that C really started to hit its stride, and I started mixing a little C and mostly assembly. It wasn't until I was working on P2's and PowerMacs that it became mostly C with a little assembly rather than the other way around.
As for me, I learned ASM by working with a sonic 1's disassemble.
Many times I tried to learn C, but I don't even understand the basics. And also, in Chile, there's no way to learn to program if it's not at the university (I know in other countries is possible to study languages at secondary schools, as I have a friend who learns about web there.).
Many times I tried to learn C, but I don't even understand the basics. And also, in Chile, there's no way to learn to program if it's not at the university (I know in other countries is possible to study languages at secondary schools, as I have a friend who learns about web there.).