Mirage Source
http://web.miragesource.net/forums/

[Feature] Y-based sprite rendering!
http://web.miragesource.net/forums/viewtopic.php?f=183&t=5048
Page 1 of 68

Author:  Robin [ Sun Feb 01, 2009 10:02 pm ]
Post subject:  [Feature] Y-based sprite rendering!

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!

Author:  Matt [ Sun Feb 01, 2009 10:15 pm ]
Post subject:  Re: [Feature] Y-based sprite rendering!

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.

Author:  Doomy [ Sun Feb 01, 2009 11:32 pm ]
Post subject:  Re: [Feature] Y-based sprite rendering!

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: :P
:mrgreen:

Author:  genusis [ Mon Feb 02, 2009 12:25 am ]
Post subject:  Re: [Feature] Y-based sprite rendering!

:lol: thank you robin ^^.

Author:  Robin [ Mon Jun 01, 2009 6:31 pm ]
Post subject:  Re: [Feature] Y-based sprite rendering!

Bumping for great justice.

Author:  GIAKEN [ Tue Jun 02, 2009 3:47 am ]
Post subject:  Re: [Feature] Y-based sprite rendering!

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.

Author:  Robin [ Tue Jun 02, 2009 8:06 am ]
Post subject:  Re: [Feature] Y-based sprite rendering!

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.

Author:  Matt [ Tue Jun 02, 2009 3:20 pm ]
Post subject:  Re: [Feature] Y-based sprite rendering!

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.

Author:  Robin [ Tue Jun 02, 2009 3:54 pm ]
Post subject:  Re: [Feature] Y-based sprite rendering!

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.

Author:  DarkPhoenix [ Tue Jun 02, 2009 5:23 pm ]
Post subject:  Re: [Feature] Y-based sprite rendering!

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

Author:  Matt [ Tue Jun 02, 2009 5:26 pm ]
Post subject:  Re: [Feature] Y-based sprite rendering!

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.

Author:  Labmonkey [ Tue Jun 02, 2009 9:48 pm ]
Post subject:  Re: [Feature] Y-based sprite rendering!

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.

Author:  DarkPhoenix [ Fri Jun 05, 2009 4:36 pm ]
Post subject:  Re: [Feature] Y-based sprite rendering!

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

Author:  Rian [ Fri Jun 05, 2009 5:07 pm ]
Post subject:  Re: [Feature] Y-based sprite rendering!

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

Author:  DarkPhoenix [ Fri Jun 05, 2009 8:37 pm ]
Post subject:  Re: [Feature] Y-based sprite rendering!

ugh it's so annoying though.

Author:  Doomy [ Fri Jun 05, 2009 8:53 pm ]
Post subject:  Re: [Feature] Y-based sprite rendering!

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.

Author:  Robin [ Sat Jun 06, 2009 5:27 pm ]
Post subject:  Re: [Feature] Y-based sprite rendering!

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.

Author:  Doomy [ Sat Jun 06, 2009 5:31 pm ]
Post subject:  Re: [Feature] Y-based sprite rendering!

yay

Author:  DarkPhoenix [ Sat Jun 06, 2009 6:29 pm ]
Post subject:  Re: [Feature] Y-based sprite rendering!

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

Author:  Rian [ Sat Jun 06, 2009 7:46 pm ]
Post subject:  Re: [Feature] Y-based sprite rendering!

Ask all the stupid questions you want.

Author:  Hyperion [ Fri Jun 19, 2009 3:51 pm ]
Post subject:  Re: [Feature] Y-based sprite rendering!

Rian wrote:
Ask all the stupid questions you want.



Well now you've just opened the door for me ;)

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

Author:  Matt [ Fri Jun 19, 2009 4:02 pm ]
Post subject:  Re: [Feature] Y-based sprite rendering!

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

Author:  Hyperion [ Fri Jun 19, 2009 4:06 pm ]
Post subject:  Re: [Feature] Y-based sprite rendering!

Thank you so much :)
It Works now

Author:  Matt [ Fri Jun 19, 2009 4:54 pm ]
Post subject:  Re: [Feature] Y-based sprite rendering!

Hyperion wrote:
Thank you so much :)
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.

Author:  Mozza [ Wed Jul 22, 2009 9:01 pm ]
Post subject:  Re: [Feature] Y-based sprite rendering!

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 :) 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

Page 1 of 68 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/