Pixel,circle,square and line draw

SGDK only sub forum

Moderator: Stef

Post Reply
Cristiano Sword
Interested
Posts: 19
Joined: Mon Jul 03, 2017 2:23 pm
Location: Sao Paulo -Sp
Contact:

Pixel,circle,square and line draw

Post by Cristiano Sword » Fri Jun 15, 2018 2:07 am

hello guys, :D
I'm trying to create lines, pixels, circles and squares that appear on screen by sgdk, I know there's a function, but nn I'm getting it, could anyone help me :?: :(
The Mega Drive Will Never Die In Our Hearts.

Project Leyria RPG for Sega Mega Drive / Genesis
https://gendev.spritesmind.net/forum/vi ... php?t=2728

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

Re: Pixel,circle,square and line draw

Post by Chilly Willy » Fri Jun 15, 2018 2:27 am

Look at the BMP commands. You can set pixels, draw lines, or draw polygons. If you use enough sides in the polygon, it'll appear circular.

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

Re: Pixel,circle,square and line draw

Post by Miquel » Sat Jun 16, 2018 12:59 pm

Or just draw circles and lines through tiles (sprites or planes) were Geny excels on. MD hardware wasn't designed to draw using bitmaps, Stef simulated it but with a performance penalty.
HELP. Spanish TVs are brain washing people to be hostile to me.

Cristiano Sword
Interested
Posts: 19
Joined: Mon Jul 03, 2017 2:23 pm
Location: Sao Paulo -Sp
Contact:

Re: Pixel,circle,square and line draw

Post by Cristiano Sword » Mon Jun 18, 2018 5:45 pm

I'm doing rain and snow effects for my rpg, I'll analyze if I get more perfomance like this or with tiles.
Although I have already seen that the functions are very different from the "line" of the Amiga and Msx.
The Mega Drive Will Never Die In Our Hearts.

Project Leyria RPG for Sega Mega Drive / Genesis
https://gendev.spritesmind.net/forum/vi ... php?t=2728

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

Re: Pixel,circle,square and line draw

Post by Miquel » Mon Jun 18, 2018 8:46 pm

On a bitmap device (like a traditional PC) drawing lines and circles it's a very easy/basic arithmetic operation probably convenient for starters, but no on tile devices like MD.

I also recently pondered this functionality for my game and I can tell you the drawbacks of bitmap 'mode' on MD are:
- It uses a plane
- It uses a significant part of the vram
- Effectively lowers the resolution
- Takes a lot of cpu (it depends on how many raster ops)
- Lower fps
- Takes all (or a loooooot) bandwidth with vdp

The advantage is as long you have cpu available you can draw unlimitless.

You can reproduce rain/snow with sprites but with a 80 unit limit; or also you can use a plane with repeated pattern plus scroll(s) for better results and much less pain.
HELP. Spanish TVs are brain washing people to be hostile to me.

Sik
Very interested
Posts: 939
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: Pixel,circle,square and line draw

Post by Sik » Mon Jun 18, 2018 9:59 pm

Cristiano Sword wrote:
Mon Jun 18, 2018 5:45 pm
I'm doing rain and snow effects for my rpg, I'll analyze if I get more perfomance like this or with tiles.
Although I have already seen that the functions are very different from the "line" of the Amiga and Msx.
There's a game (forgot the name now) that multiplexes two sprites across the screen and uses them to do snow (the multiplexing is needed to avoid hogging the whole sprite table with snow sprites).

If you don't need a separate plane for background (e.g. no parallax, or only linescroll or software-rendered parallax) you'd be better off using one of the tilemap layers for the job instead.
Sik is pronounced as "seek", not as "sick".

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

Re: Pixel,circle,square and line draw

Post by Miquel » Tue Jun 19, 2018 12:01 am

Sik wrote:
Mon Jun 18, 2018 9:59 pm
There's a game (forgot the name now) that multiplexes two sprites across the screen and uses them to do snow (the multiplexing is needed to avoid hogging the whole sprite table with snow sprites).
And do you know how they did it ?
Perhaps using h-blank time to change x and y of sprites.. or maybe changing the address of the sprite table...
HELP. Spanish TVs are brain washing people to be hostile to me.

Sik
Very interested
Posts: 939
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: Pixel,circle,square and line draw

Post by Sik » Tue Jun 19, 2018 2:12 am

It just rewrites those sprite entries during hblank interrupts (possibly just the X and Y coordinates - an autoincrement of 6 can help here).

Note that you don't need to rewrite them every line (that'd be slow), just fast enough that it matches the difference between two uses of the same sprite (which was 8 lines in that case I think? would need to look up which game it was again to tell you). You don't even need to rewrite both sprites in the same line, you could alternate between each of them every time.
Sik is pronounced as "seek", not as "sick".

Cristiano Sword
Interested
Posts: 19
Joined: Mon Jul 03, 2017 2:23 pm
Location: Sao Paulo -Sp
Contact:

Re: Pixel,circle,square and line draw

Post by Cristiano Sword » Tue Jun 19, 2018 11:48 pm

I will try with sprites or a plan, thanks for the information, so I have managed to do post here in the forum :mrgreen:
The Mega Drive Will Never Die In Our Hearts.

Project Leyria RPG for Sega Mega Drive / Genesis
https://gendev.spritesmind.net/forum/vi ... php?t=2728

Post Reply