SHMUP scrolling game

SGDK only sub forum

Moderator: Stef

Post Reply
acsabo
Newbie
Posts: 5
Joined: Wed Jul 05, 2017 1:51 pm

SHMUP scrolling game

Post by acsabo » Thu Jul 06, 2017 2:32 pm

Hi, I’m newbie in MD game dev stuff, and have been watching SGDK project for a while, but I got extra motivation to start working on something right after the relauch of Mega Drive here in Brazil, months ago.
First of all I would like to say SGDK rocks! In a few days I was able to get some amazing things to work with just a few lines of code.
I am willing to build a shumup game inspired in MUSHA and TRUXTON, so I started creating my big map to be scrolled down on the screen. And I looked into those tutorials available, samples and this web forum. Finally I managed to load my map into the plan and scroll it. But I have a question:
I am aware about the limitations of having 4096 bytes in the plan (32x128 in my case), and what I want to understand is how I do the progressive loads as the scrolling area reaches nearly the end. I know I still have to read more about the api, because as I said, I have just started. I believe I would have to use VDP_setMapEx somehow in combination with other things… Well, here is where I am so far. So, if you guys have something to share, that would be apreciated. thanks!
Last edited by acsabo on Thu Jul 06, 2017 3:58 pm, edited 2 times in total.

User avatar
Staffan
Very interested
Posts: 57
Joined: Wed Jun 14, 2017 2:33 pm

Re: SHMUP scrolling style game

Post by Staffan » Thu Jul 06, 2017 2:55 pm

Welcome!
Im also new at sgdk, and Im as just as Impressed as you. :)

I also tried to scroll the plane horizontally today, and after a while it returned to start again. This means that you could redraw the start of the plane before you get there, so that it doesnt look the same when you get back there I guess. This makes it look like an ifinitive large plane!

Miquel
Very interested
Posts: 180
Joined: Sat Jul 30, 2016 12:33 am

Re: SHMUP scrolling game

Post by Miquel » Thu Jul 06, 2017 5:00 pm

If you are using standart resolution (320x224 NTSC or 320x240 PAL) a plan of 32x? doesn't fit in the screen. 32x8=256 which is less than 320.

You could do what you want with a plan of 64x32 tiles for sure for NTSC, and I'm nearly sure it works for PAL too.
Are you talking about the "monolith"? I'm in communications with them, just tell me the question or ask yourself. If it's about it's movement: yes it really moves, but at a tremendous speed! From the Sun to Jupiter in less than 2 seconds!

acsabo
Newbie
Posts: 5
Joined: Wed Jul 05, 2017 1:51 pm

Re: SHMUP scrolling game

Post by acsabo » Thu Jul 06, 2017 5:53 pm

Miquel wrote:If you are using standart resolution (320x224 NTSC or 320x240 PAL) a plan of 32x? doesn't fit in the screen. 32x8=256 which is less than 320.

You could do what you want with a plan of 64x32 tiles for sure for NTSC, and I'm nearly sure it works for PAL too.
Just to make thinks simplier for now I am using
VDP_setScreenWidth256(); VDP_setPlanSize(32, 128);
which is working fine. I am thinking on how to load "on demand" from Map to PLAN as it scrolls. thanks for your reply!

Miquel
Very interested
Posts: 180
Joined: Sat Jul 30, 2016 12:33 am

Re: SHMUP scrolling game

Post by Miquel » Thu Jul 06, 2017 6:52 pm

It works but VDP is then in low specs.
Are you talking about the "monolith"? I'm in communications with them, just tell me the question or ask yourself. If it's about it's movement: yes it really moves, but at a tremendous speed! From the Sun to Jupiter in less than 2 seconds!

Chilly Willy
Very interested
Posts: 2486
Joined: Fri Aug 17, 2007 9:33 pm

Re: SHMUP scrolling game

Post by Chilly Willy » Thu Jul 06, 2017 7:02 pm

Miquel wrote:It works but VDP is then in low specs.
Yeah, not only is the screen narrower, but you get fewer sprites, and DMA runs slower. Of course, that may not be an issue with your game. We don't know how many sprites you need or how much DMA bandwidth. If you find you need more, you'll need to switch to H40 mode.

acsabo
Newbie
Posts: 5
Joined: Wed Jul 05, 2017 1:51 pm

Re: SHMUP scrolling game

Post by acsabo » Thu Jul 06, 2017 7:44 pm

Chilly Willy wrote:
Miquel wrote:It works but VDP is then in low specs.
Yeah, not only is the screen narrower, but you get fewer sprites, and DMA runs slower. Of course, that may not be an issue with your game. We don't know how many sprites you need or how much DMA bandwidth. If you find you need more, you'll need to switch to H40 mode.
Ok many thanks for the information about running in low specs. I changed it back to 64x64 plan size and resolution to 320. Now my problem is still the same, and need to find out some aproach to deal with the plan update as it scrolls down.... :?

User avatar
TmEE co.(TM)
Very interested
Posts: 2285
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Re: SHMUP scrolling game

Post by TmEE co.(TM) » Thu Jul 06, 2017 7:50 pm

You only update the row and column just beyond edge of screen towards scrolling direction, no need to deal with entire tilemap. Almost all games work that way too.
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

Miquel
Very interested
Posts: 180
Joined: Sat Jul 30, 2016 12:33 am

Re: SHMUP scrolling game

Post by Miquel » Thu Jul 06, 2017 8:42 pm

1) Think about tiles, and not about pixels
2) Since there is only one direction scroll, you need 2 vars: currentScroll & previousScroll
3) If you do a subtraction of the previous two, you get how many rows of tiles you need to update

rows = ( currentScroll / 8 ) - ( previousScroll / 8 );

4) Done

Do you need more info? Then specify better your case.

Edit:

currentScroll itself points to the first row you need to update. You are using a 64x64 plane so it will be:

row1 = ( currentScroll / 8 ) & 63;

Or perhaps you are asking SGDK do all this for you? I really ran out of ideas.
Are you talking about the "monolith"? I'm in communications with them, just tell me the question or ask yourself. If it's about it's movement: yes it really moves, but at a tremendous speed! From the Sun to Jupiter in less than 2 seconds!

acsabo
Newbie
Posts: 5
Joined: Wed Jul 05, 2017 1:51 pm

Re: SHMUP scrolling game

Post by acsabo » Thu Jul 06, 2017 9:30 pm

Miquel wrote:Or perhaps you are asking SGDK do all this for you? I really ran out of ideas.
ok, I got it! I think I am comfortable enough to follow your tips for now. I'll give it a try and let you know if I have more questions. Thanks! :D

acsabo
Newbie
Posts: 5
Joined: Wed Jul 05, 2017 1:51 pm

Re: SHMUP scrolling game

Post by acsabo » Wed Jul 12, 2017 1:39 am

I finally managed to make it work the way I was expecting. Thanks to you guys, but as I am new into this, I took a while to understand what I had to do. That is a snippet of the result:

Code: Select all

		scrolled_tiles = scroll_down >> 3;
		update_row = scrolled_tiles & 63;

		VDP_setMapEx(PLAN_A, map, TILE_ATTR_FULL(PAL0, FALSE, FALSE, FALSE, TILE_USERINDEX), 0, PLAN_HEIGHT - update_row - 1, 0, offset_row-scrolled_tiles, PLAN_WIDTH, 1);
		VDP_setVerticalScroll(PLAN_A, -scroll_down);
:lol:

User avatar
Stef
Very interested
Posts: 2627
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: SHMUP scrolling game

Post by Stef » Wed Jul 12, 2017 11:58 am

Well done, that's the good way to do that :)

Miquel
Very interested
Posts: 180
Joined: Sat Jul 30, 2016 12:33 am

Re: SHMUP scrolling game

Post by Miquel » Wed Jul 12, 2017 4:59 pm

Belive me that's not the end of it, not even close.

¿What happens when you reach the limit of the level?
Are you talking about the "monolith"? I'm in communications with them, just tell me the question or ask yourself. If it's about it's movement: yes it really moves, but at a tremendous speed! From the Sun to Jupiter in less than 2 seconds!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest