Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [SOLVED] Drawing sprites behind sprites (ideas?)

Author
Message
Brian Lancaster
10
Years of Service
User Offline
Joined: 20th Dec 2013
Location: Oakland, CA
Posted: 31st Jan 2021 20:19
Hello all,

I am well on my way with an RPG/RTS with graphics similar to JRPGs, and I'm wondering how I should deal with drawing items/characters that are behind other objects (like a tree). For example, it's possible to drop a sword behind a tree and completely not be able to see it. You can still click on it and pick it up, but I need some way to show the player that it's there. Is there an easy way to draw the outline of a sprite or something?

(Before I waste time doing something else. Thanks.)

The author of this post has marked a post as an answer.

Go to answer

Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 31st Jan 2021 20:23
Is SetSpriteDepth() what you are looking for?
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 31st Jan 2021 20:43
Reading from the manual:
"...For maximum performance it is recommended that every sprite has its own depth value unless the order they are drawn is not important, for example physics sprites that won't normally overlap...."
I suggest you, to make a plan on the creation order of the sprites without using the command 'SetSpriteDepth()' within the main game loop
Brian Lancaster
10
Years of Service
User Offline
Joined: 20th Dec 2013
Location: Oakland, CA
Posted: 31st Jan 2021 21:04
It's not about sprite depth. This question is more about how I represent a sprite drawn behind another sprite so the player knows it's there. Tis more of a philosophical question, but also I don't wanna overlook some easy command and waste a bunch of time.
Brian Lancaster
10
Years of Service
User Offline
Joined: 20th Dec 2013
Location: Oakland, CA
Posted: 31st Jan 2021 21:05
I need to be able to draw an outline of a sprite or something.
n00bstar
20
Years of Service
User Offline
Joined: 9th Feb 2004
Location: Montreal, Canada.
Posted: 31st Jan 2021 21:12 Edited at: 31st Jan 2021 21:13
Well, you're still going to have to deal with depth. Something like this:

peudo code...obviously


Or another way could be to actually put it over the tree, but bring down it's alpha value...

-----------------------------------------------------------------------------
We all got a chicken duck woman thing waiting for us
Brian Lancaster
10
Years of Service
User Offline
Joined: 20th Dec 2013
Location: Oakland, CA
Posted: 31st Jan 2021 21:18
Is there any easy way to check if a sprite is completely hidden behind another sprite?
Because what I'm thinking is I will make a little glimmer thing occasionally so the player will know something is there.
Brian Lancaster
10
Years of Service
User Offline
Joined: 20th Dec 2013
Location: Oakland, CA
Posted: 31st Jan 2021 21:19 Edited at: 31st Jan 2021 21:32
Mod Edit, I wanna just give out my code but I'm too paranoid. I've already done that. Thanks for helping, though.
Brian Lancaster
10
Years of Service
User Offline
Joined: 20th Dec 2013
Location: Oakland, CA
Posted: 31st Jan 2021 21:21
I'm thinking now that all obtainable items will occasionally glitter. It's probably the only solution.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 31st Jan 2021 21:39 Edited at: 31st Jan 2021 21:49
Quote: "ideas?"
yeah. watch your language and don't triple post or otherwise spam, as above.

otherwise,
Quote: "I need to be able to draw an outline...
...represent a sprite drawn behind another"
consider this discussion.

@n00bstar, please add the lang=agk part when Posting Code (see my sig and the Syntax Highlighting requirement).
[My Itch.io Home] [Now Playing]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=AGK] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[Google Forum Search]
n00bstar
20
Years of Service
User Offline
Joined: 9th Feb 2004
Location: Montreal, Canada.
Posted: 31st Jan 2021 23:23 Edited at: 4th Feb 2021 12:14
Quote: "
@n00bstar, please add the lang=agk part when Posting Code (see my sig and the Syntax Highlighting requirement).
"


HAHAHAHHAHAHHAHAHHAHAHHAHAHAHHAHHA

Seriously... syntax highlighting *REQUIREMENT* when posting a peudocode block. You people need to calm down. [MOD EDIT] Your "pseudocode" is in fact AppGameKit code and it is therefore a requirement as per the "Rules and Guidelines" of the "AUP" here

Don't know what's up with you this weekend, editing people's posts and acting like you're judge Dredd or something.. But you need to reevaluate your life buddy.

Read it under my avatar. 16 years of support for this stupid company. An now you've just lost another member of this community. See if that helps you or the product in the long run.
-----------------------------------------------------------------------------
We all got a chicken duck woman thing waiting for us
Brian Lancaster
10
Years of Service
User Offline
Joined: 20th Dec 2013
Location: Oakland, CA
Posted: 1st Feb 2021 00:06
Thanks for unblocking this. No more profanity.
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 1st Feb 2021 18:22 Edited at: 1st Feb 2021 19:28
these are solid sprites part transparent part not. Two images stacked. You can make a Third sprite with elements of both or using an alpha. Or u can use draw image sprite draw second image hidden sprite create sprite main sprite. There's prolly 5 different ways to do it inside agk plus a shader method.

Attachments

Login to view attachments
Brian Lancaster
10
Years of Service
User Offline
Joined: 20th Dec 2013
Location: Oakland, CA
Posted: 1st Feb 2021 20:49 Edited at: 1st Feb 2021 21:23
Yeah, it's just gonna look weird to have the entire sprite transparent (or differently shaded). An outline of the sprite would look best, but I think that's too difficult. I'm going for an occasional glittery sparkle, I think. ("glimmer", "glint", "gleam", some kind of G word)
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 1st Feb 2021 21:27
Do you think it might be possible to post the two sprites? or at least two sprites similar to the ones you're using
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 1st Feb 2021 23:18
Why not use particles?

Brian Lancaster
10
Years of Service
User Offline
Joined: 20th Dec 2013
Location: Oakland, CA
Posted: 2nd Feb 2021 00:43
I'll put up Demo v7 on itch.io in about 5 days or so and post it here so you can see. But I'm gonna use this quick sprite to let the player know there's an item hiding behind the tree/wall/etc.

blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 2nd Feb 2021 02:30 Edited at: 2nd Feb 2021 03:38
Is this what your looking for?

Attachments

Login to view attachments
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 2nd Feb 2021 04:48 Edited at: 2nd Feb 2021 04:53
if you have Studio, maybe play with:

(insert within Blink's code above)
[My Itch.io Home] [Now Playing]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=AGK] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[Google Forum Search]

Attachments

Login to view attachments
Brian Lancaster
10
Years of Service
User Offline
Joined: 20th Dec 2013
Location: Oakland, CA
Posted: 2nd Feb 2021 04:52
I have classic but I'll check both of these out tomorrow.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 2nd Feb 2021 04:57
Lol. I changed mine to sparkles.
Nice work though VN
Brian Lancaster
10
Years of Service
User Offline
Joined: 20th Dec 2013
Location: Oakland, CA
Posted: 2nd Feb 2021 23:10
@Virtual Nomad: any chance that SetSpriteBlendModes works in AppGameKit Classic? Otherwise I'll just make all obtainable items flash occasionally (it would be too slow to check it it's behind another sprite).
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 3rd Feb 2021 02:55
Quote: "any chance that SetSpriteBlendModes works in AppGameKit Classic?"


It appears not, Studio only
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 3rd Feb 2021 12:31 Edited at: 3rd Feb 2021 15:54
Im thinking a shader is what you want the blendman did a great example of blending sprite images on the shader thread
ideally you just want the sword to bleed through or perhaps an outline also i did something similar on the top of the below thread
https://forum.thegamecreators.com/thread/222027

but im def no expert and have no idea about how you would use an outline, Its also possible with memblocks where you would just get the
rgb channel of the sprite and the tree and then mix them onto another image maybe by just mutiplying etc

failing all that the outline could also be an approach in which case you would have an outline of the sword sprite and place infront of the tree
so you end up with three sprites . That i feel would be the fastest and simplest approach. a bit of opacity changing and depth setting but thats all thats needed

your imagination is the only limitation this is a 3D xray routine i did with the skeleton created by blink

this was achieved with a skeleton model being placed inside and attached to the person and animated the same then a transparency shader
was used made the person transparent revealing the other model(skeleton) within a zoned area. Some inspiration or you

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
Brian Lancaster
10
Years of Service
User Offline
Joined: 20th Dec 2013
Location: Oakland, CA
Posted: 4th Feb 2021 01:07
Maaan, I really wish I could use that blend mode in AppGameKit classic for animated characters, but oh well.

My main problem was dropping items behind other sprites. The characters move around a lot and can be selected on the sidebar, etc., so not a huge deal. I'm gonna just have the items flash with this little animation. Let me know if it's annoying. Thanks for all the help, too.

The next demo is gonna take another week, so here's a video:
https://www.youtube.com/watch?v=cADR5iegM8Y
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 4th Feb 2021 04:29
I'm not 100% sure the blend mode would work for you anyway.
I'm thinking it would show EVERYTHING behind the wall as that shadow.
So if you had a tree behind the wall it would show it in shadow
Brian Lancaster
10
Years of Service
User Offline
Joined: 20th Dec 2013
Location: Oakland, CA
Posted: 4th Feb 2021 05:14
Yeah, I also went out of my way to make sure characters would always be peeking their heads out from behind walls (if not trees) using collision, so I think I'm good now. Thanks again.
haliop787
4
Years of Service
User Offline
Joined: 22nd Mar 2020
Playing: With reality.
Posted: 5th Feb 2021 05:01 Edited at: 5th Feb 2021 05:04
I thought of 2 suggestions.
1st, does the players really needs to know all of the items that are behind trees?...

Is it possible that the players only needs to see the items that are behind the tree next to him? So a radar like code "if players is near, transparents this tree" same depth values as initiated, just a transparent tree and only when needed.

2nd.
Create a shader, for highlighting the edges of an item and drawing it last to screen before render() / sync()

So you would see all hiddent behind other sprites with a nice highlight , drawing the render image last to screen with absolute the depth problem.

If you cannot create a shader (like me.. i dont understand the concept of building shaders yet) use phoshop or gimp maybe to create a highlighted img to every item you have, it should not be hard just may take some time to go over all the items. Since it is just a highlight img of the same texture, yoy can save disk space and loading time by reducing the resolution.


Actually now i have another suggestion to rule them all.

You can use like a little pointer if two sprites overlap aka coin and tree, where the pointer points behind the tree (same depth as the item) only that it goes up on the y value and down, making you notice something is there.
This could actually be real fun, as only one item is being pointed by this pointer if you took it after some delay a new item that the player did not see yet. Wil be pointed.

Cheers.
Awesome thread.
Nadav "Haliop" Rosenberg
Lets make the world great forever.
Brian Lancaster
10
Years of Service
User Offline
Joined: 20th Dec 2013
Location: Oakland, CA
Posted: 10th Feb 2021 00:17
Hey haliop787, thanks for the suggestion. I already have moving arrows for the map transitions. So I decided on a little sparkle.

I'm gonna hopefully get the next demo out on the 14th, and I will post a link here so you can see it. But, the issue has been resolved.
Brian Lancaster
10
Years of Service
User Offline
Joined: 20th Dec 2013
Location: Oakland, CA
Posted: 14th Feb 2021 18:40 Edited at: 14th Feb 2021 18:41
Alright. Damn that took long enough:

https://blancaster45.itch.io/warlordocracy-demo

Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 14th Feb 2021 22:57
not seeing any Help for controls, etc? ie, how do we move, do things other than dialogue and pan the screen?
[My Itch.io Home] [Now Playing]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=agk] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[Google Forum Search]
JosephB
18
Years of Service
User Offline
Joined: 12th Sep 2006
Location:
Posted: 14th Feb 2021 23:22
I was able to move when the compass symbol, above the hand symbol was highlighted, by clicking the right mouse button on a position I wanted to move to. I could 'take' things and open doors, by right mouse clicking them when the hand symbol was highlighted. Still trying to figure other controls out, but seems very nice so far.
n00bstar
20
Years of Service
User Offline
Joined: 9th Feb 2004
Location: Montreal, Canada.
Posted: 15th Feb 2021 00:08 Edited at: 15th Feb 2021 10:52
Solid start! Keep it up!

I know it's only a demo, but a few suggestions/comments if I may:

1- Clicking to move somewhere that's beyond a closed door results in the character going haywire at the door until it's opened. Might want to check if the location is reachable before acknowledging the move command?
2- I like that the character keeps trying to move to where you click, but it also causes weird/funny behavior. I had a freaking chicken moving back and forth at the same time as my character was trying to go around it and it just looked like they were dancing together
3- Having to select the character before taking actions is a bit annoying. I don't know if later on in the game this control scheme serves a purpose, like having multiple characters or having to interact with the environment while not controlling the player, but as it stands right now, it's not the most user friendly control scheme.
4- Music feels out of place, a bit too spaghetti western for the fantasy style, and it doesn't loop either.

[mod edit] Renamed potentially offensive wording
-----------------------------------------------------------------------------
We all got a chicken duck woman thing waiting for us
Brian Lancaster
10
Years of Service
User Offline
Joined: 20th Dec 2013
Location: Oakland, CA
Posted: 15th Feb 2021 01:04 Edited at: 15th Feb 2021 10:53
This post has been marked by the post author as the answer.
@NoobStar: About that haywire behaviour, it's gonna take a long time to fix. Same with the pathfinding in general. I just had to get a story going first otherwise I would go insane, like the haywire chicken.

As for the click-select, there are already two other characters you can recruit in the demo. I think it would be impossible to beat the demo without them. You can get up to 5 on your main team. Then you can get another 20 in larger battles, and the maps will gradually get bigger as the game goes on and turns into more of an RTS as you recruit more people.

That music was commissioned by a fellow coworker for free when I thought the game would be more steampunk, but I couldn't find the art. Anyway, I might just stick to Kevin MacLeod, as we all do.

Later on I will throw in more tutorial.

EDIT: There are 5 maps you can go to in this one, just so everyone knows.

[mod edit] Renamed potentially offensive wording
Brian Lancaster
10
Years of Service
User Offline
Joined: 20th Dec 2013
Location: Oakland, CA
Posted: 16th Feb 2021 04:38 Edited at: 16th Feb 2021 04:41
Also, I just put in a quick update with objectives to recruit the two other party members, so you know there's other party members. I don't think it's possible to beat it without doing that.

EDIT: Also try going to the docks after midnight.
Brian Lancaster
10
Years of Service
User Offline
Joined: 20th Dec 2013
Location: Oakland, CA
Posted: 21st Feb 2021 00:36 Edited at: 21st Feb 2021 00:37
OH Yeah, one more thing just to help me out: is your FPS close to 60 and steady? Thanks.
Also, I uploaded a new demo that fixed a collision bug and more.

https://blancaster45.itch.io/warlordocracy-demo
n00bstar
20
Years of Service
User Offline
Joined: 9th Feb 2004
Location: Montreal, Canada.
Posted: 21st Feb 2021 01:50
A solid 60 on my side and I have a pretty old PC. Looks good.
-----------------------------------------------------------------------------
We all got a chicken duck woman thing waiting for us
Brian Lancaster
10
Years of Service
User Offline
Joined: 20th Dec 2013
Location: Oakland, CA
Posted: 21st Feb 2021 07:02
@n00bstar, sweet. My DBPro FPS/RPG barely hit 33 and the AI was so-so. Didn't much matter because it was primarily gunfights, so running up against a wall looked normal. Now I gotta seriously work on pathfinding and AI. But I also have to make sure it doesn't run like a tortoise (full of rigor mortis).

Login to post a reply

Server time is: 2024-11-24 06:11:48
Your offset time is: 2024-11-24 06:11:48