Mirage Source
[Feature] Y-based sprite rendering! - Printable Version

+- Mirage Source (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: Source Code Development (https://mirage-engine.uk/forums/forumdisplay.php?fid=51)
+----- Forum: Mirage Source 4 (Visual Basic 6) (https://mirage-engine.uk/forums/forumdisplay.php?fid=44)
+------ Forum: Tutorials (https://mirage-engine.uk/forums/forumdisplay.php?fid=13)
+------ Thread: [Feature] Y-based sprite rendering! (/showthread.php?tid=2544)

Pages: 1 2


[Feature] Y-based sprite rendering! - Robin - 01-02-2009

Y-based sprite rendering!! Now 100% free!

Find;
Code:
Call BltPlayer

and replace both the BltPlayer block of code, and the BltNPC block of code with;
Code:
' Blit out players and NPCs
        For Y = 0 To MAX_MAPY
            For i = 1 To PlayersOnMapHighIndex
                If Player(i).Y = Y Then
                    Call BltPlayer(PlayersOnMap(i))
                End If
            Next
            For i = 1 To High_Npc_Index
                If MapNpc(i).Y = Y Then
                    Call BltNpc(i)
                End If
            Next
        Next

This removes the need for BltPlayerTop for larger sprites, and compliments my Dynamic sprite sizes! tutorial perfectly. You can find that tutorial via this link;
http://web.miragesource.com/forums/viewtopic.php?f=124&t=5047

Can use this tutorial freely in your game/engine, as long as you don't claim it as your own. That means you, Frozengod!


Re: [Feature] Y-based sprite rendering! - Matt - 01-02-2009

Quote:Can use this tutorial freely in your game/engine, as long as you don't claim it as your own. That means you, Frozengod!

Rofl.


Re: [Feature] Y-based sprite rendering! - Doomy - 01-02-2009

Quote:Can use this tutorial freely in your game/engine, as long as you don't claim it as your own. That means you, Frozengod!
ROFL
:lol: Tongue
:mrgreen:


Re: [Feature] Y-based sprite rendering! - genusis - 02-02-2009

:lol: thank you robin ^^.


Re: [Feature] Y-based sprite rendering! - Robin - 01-06-2009

Bumping for great justice.


Re: [Feature] Y-based sprite rendering! - GIAKEN - 02-06-2009

You actually need to convert a lot of stuff to Y-based rendering...IE there's a problem with fringe layers where if you walk under one and you're taller than 64 pixels, your head will go over the stump but under the tree part.


Re: [Feature] Y-based sprite rendering! - Robin - 02-06-2009

GIAKEN Wrote:You actually need to convert a lot of stuff to Y-based rendering...IE there's a problem with fringe layers where if you walk under one and you're taller than 64 pixels, your head will go over the stump but under the tree part.

"I" need to convert it?

Y-based rendering on players is there to make it so you don't need BltPlayerTop or any of that crap.

It does it's purpose.

If you're creating maps which can't handle any sprites bigger than 32x32, that's your problem. Take the tutorial for what it is.


Re: [Feature] Y-based sprite rendering! - Matt - 02-06-2009

Robin Wrote:
GIAKEN Wrote:You actually need to convert a lot of stuff to Y-based rendering...IE there's a problem with fringe layers where if you walk under one and you're taller than 64 pixels, your head will go over the stump but under the tree part.

"I" need to convert it?

Y-based rendering on players is there to make it so you don't need BltPlayerTop or any of that crap.

It does it's purpose.

If you're creating maps which can't handle any sprites bigger than 32x32, that's your problem. Take the tutorial for what it is.

I think he said "you" as a generalization. Meaning it towards everyone.


Re: [Feature] Y-based sprite rendering! - Robin - 02-06-2009

Matt Wrote:
Robin Wrote:
GIAKEN Wrote:You actually need to convert a lot of stuff to Y-based rendering...IE there's a problem with fringe layers where if you walk under one and you're taller than 64 pixels, your head will go over the stump but under the tree part.

"I" need to convert it?

Y-based rendering on players is there to make it so you don't need BltPlayerTop or any of that crap.

It does it's purpose.

If you're creating maps which can't handle any sprites bigger than 32x32, that's your problem. Take the tutorial for what it is.

I think he said "you" as a generalization. Meaning it towards everyone.

I don't see why everyone should. I can't think of many people who can't make a map which doesn't have fringing issues.


Re: [Feature] Y-based sprite rendering! - DarkPhoenix - 02-06-2009

When GIAKEN was a friend of mine, we were on his Asphodel test server and he had problems with the fringing.


Re: [Feature] Y-based sprite rendering! - Matt - 02-06-2009

Robin Wrote:
Matt Wrote:
Robin Wrote:
GIAKEN Wrote:You actually need to convert a lot of stuff to Y-based rendering...IE there's a problem with fringe layers where if you walk under one and you're taller than 64 pixels, your head will go over the stump but under the tree part.

"I" need to convert it?

Y-based rendering on players is there to make it so you don't need BltPlayerTop or any of that crap.

It does it's purpose.

If you're creating maps which can't handle any sprites bigger than 32x32, that's your problem. Take the tutorial for what it is.

I think he said "you" as a generalization. Meaning it towards everyone.

I don't see why everyone should. I can't think of many people who can't make a map which doesn't have fringing issues.

It is Harold we're talking about. *shrugs* I dunno.


Re: [Feature] Y-based sprite rendering! - Labmonkey - 02-06-2009

The reason Harold posted this was because of something I showed him (in the context of y-based rendering in asphodel). Here is what happens.

If you have a sprite that is over 2x the tile (32x32 tiles would mean a 65x65 sprite or above). You need extra information on the fringe tile to know where the "base" of the tiles are.

So if you have a tree, you would want the sprite to be drawn under it if the sprite is higher then the base, and above it if the sprite is lower then the base. To fix this problem, a mapper would have to "tell" the computer where the base was for each set of fringe tiles. This is tedious, and for the most part not needed. Giaken wanted to require this for all maps with asphodel, and thankfully I convinced him not to.

So this is not a major problem, but if people are using a tileset that has fringe parts (trees) that are longer then 1 tile in height (rmvx is fine, rmxp is a problem) you cannot use sprites that are larger then pic_y*2. Those sprites are usually only used for bosses though, so it is easy to make the boss map not include trees, or atleast npc avoid.

@Giaken, If you forgot our conversation about this, there is no real way to "fix" this problem without getting much more information from the mapper. It would be easier to do in an object based mapping system, but that is usually a pain to get started with (and is why many people don't use vbgore). So do not ask Robin to "fix" this.


Re: [Feature] Y-based sprite rendering! - DarkPhoenix - 05-06-2009

I don't know where this goes O_o...... I tried searching for Call BltPlayer but all I find is Call BltPlayer(PlayersOnMap(i))


Re: [Feature] Y-based sprite rendering! - Rian - 05-06-2009

Lol. You found it. Not everything tutorials tell you to find is going to be word for word.


Re: [Feature] Y-based sprite rendering! - DarkPhoenix - 05-06-2009

ugh it's so annoying though.


Re: [Feature] Y-based sprite rendering! - Doomy - 05-06-2009

imma tell you something about robin.
he/she might post great features but they will not tell you how to do the whole thing. They will only get you to a certain point or they will leave stuff out just so you can learn how to do stuff. if you ask robin will most likely help you learn how to do it.


Re: [Feature] Y-based sprite rendering! - Robin - 06-06-2009

Doomy Wrote:imma tell you something about robin.
he/she might post great features but they will not tell you how to do the whole thing. They will only get you to a certain point or they will leave stuff out just so you can learn how to do stuff. if you ask robin will most likely help you learn how to do it.

You're no longer an idiot in my eyes.


Re: [Feature] Y-based sprite rendering! - Doomy - 06-06-2009

yay


Re: [Feature] Y-based sprite rendering! - DarkPhoenix - 06-06-2009

Alright. Sorry I probably have been asking stupid questions, I'm just new to programming in VB6.


Re: [Feature] Y-based sprite rendering! - Rian - 06-06-2009

Ask all the stupid questions you want.


Re: [Feature] Y-based sprite rendering! - Hyperion - 19-06-2009

Rian Wrote:Ask all the stupid questions you want.


Well now you've just opened the door for me Wink

Hmmm Okay So tell me where I've gone wrong because I definitely have

Replaced this
Code:
' Blit out players
        For i = 1 To PlayersOnMapHighIndex
            Call BltPlayer(PlayersOnMap(i))
        Next
                
        ' Blit out the npcs
        For i = 1 To MAX_MAP_NPCS
            Call BltNpc(i)
        Next

With This
Code:
' Blit out players and NPCs
            For Y = 0 To MAX_MAPY
                For i = 1 To PlayersOnMapHighIndex
                    If Player(i).Y = Y Then
                        Call BltPlayer(PlayersOnMap(i))
                    End If
                Next
                For i = 1 To High_Npc_Index
                    If MapNpc(i).Y = Y Then
                        Call BltNpc(i)
                    End If
                Next
            Next

Now Starting the game It Highlights
Code:
High_Npc_Index
and says

Compile Error
Variable Not Defined


Any Ideas ^.^
Sorry I'm just starting out with VB


Re: [Feature] Y-based sprite rendering! - Matt - 19-06-2009

Replace:

Code:
' Blit out players and NPCs
            For Y = 0 To MAX_MAPY
                For i = 1 To PlayersOnMapHighIndex
                    If Player(i).Y = Y Then
                        Call BltPlayer(PlayersOnMap(i))
                    End If
                Next
                For i = 1 To High_Npc_Index
                    If MapNpc(i).Y = Y Then
                        Call BltNpc(i)
                    End If
                Next
            Next

With:

Code:
' Blit out players and NPCs
            For Y = 0 To MAX_MAPY
                For i = 1 To PlayersOnMapHighIndex
                    If Player(i).Y = Y Then
                        Call BltPlayer(PlayersOnMap(i))
                    End If
                Next
                For i = 1 To MAX_MAP_NPCS
                    If MapNpc(i).Y = Y Then
                        Call BltNpc(i)
                    End If
                Next
            Next



Re: [Feature] Y-based sprite rendering! - Hyperion - 19-06-2009

Thank you so much Smile
It Works now


Re: [Feature] Y-based sprite rendering! - Matt - 19-06-2009

Hyperion Wrote:Thank you so much Smile
It Works now

I suggest reading the code before you use it next time. Read both the code in the tutorial and the code in your source.


Re: [Feature] Y-based sprite rendering! - Mozza - 22-07-2009

if i was you i would remove PlayersOnMapHighIndex, put it this way.

Your index = 2. Your the only one on the map so PlayersOnMapHighIndex = 1, the loop will only draw index 1 so you will not draw. Well thats what from veiwing the code in mirage. If im wrong let me know

EDIT
ok i just seen the playeronmap bit so i guess im wrong about that, but Robin i did think highly of you until now.

If Player(i).Y = Y Then TUT TUT your checking the I not playersonmap so if your the only one on the map your checking the position of Index 1 not nessesary your Index. so if you are the only one on the map and your index is 2 If Player(i).Y = Y Then will return 0 every time Smile as the PlayersOnMapHighIndex will be 1 so the loop will only check for 1

Change
Code:
Player(i).Y = Y

to
Code:
Player(PlayersOnMap(I)).Y = Y