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 / How to refine my Line of Sight (LOS)?

Author
Message
Zwarteziel
13
Years of Service
User Offline
Joined: 22nd Jan 2011
Location: Netherlands
Posted: 3rd Apr 2013 14:11 Edited at: 3rd Apr 2013 15:03
Hi all,

since AppGameKit now supports 3D, I was having a go at converting some old DBPro-code in order to create a maze game (a bit like Cliff Mellangard and Van B's dungeon game, but far less impressive). I'm having trouble with my LOS-function though: the part that calculates which parts of the map are visible to the player and which parts should remain hidden. I've used code originally posted by Todd Riggins.

My problem is that (my use) of the LOS-function is not very refined: some tiles that should not be visible to the player are displayed, while others that should be, are.. well.. not. I've illustrated the problem by providing two images, besides posting a quickly made test-application. Can someone help me refine the LOS? Any help would be greatly appreciated!


(the line in the indicated circle should not be visible)


(the two while blocks in the circle should be visible)

Here's the part of the code that calculates the LOS (should you not wish to download the program):

Attachments

Login to view attachments
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 3rd Apr 2013 20:19
??? 3d auto hide hidden planes and useing backface culling.
Zwarteziel
13
Years of Service
User Offline
Joined: 22nd Jan 2011
Location: Netherlands
Posted: 3rd Apr 2013 21:00 Edited at: 3rd Apr 2013 21:01
That's true, AppGameKit hides stuff that can't be seen. Still: there's a significant decrease in FPS when I render the whole map in 3D, compared to using the LOS-function.

The whole map renders about 12288 objects (64*3*64) at 4.3 fps on my HTC One S, while using the los renders about 192 objects (8*3*8) at 47.8 frames per second.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 3rd Apr 2013 21:48 Edited at: 3rd Apr 2013 21:49
maybe you use/create much the same objects and you not use InstanceObject() ?

(and some new/missing 3d functions will be come this year.)
Zwarteziel
13
Years of Service
User Offline
Joined: 22nd Jan 2011
Location: Netherlands
Posted: 3rd Apr 2013 22:28
Ah, I forgot to point that out: I do use the Instance- instead of the Clone-command. I appreciate the thought, though!

There must be a way of creating a better LOS-algorithm, I think. Still, it has eluded me for several days now.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 4th Apr 2013 00:22
did you use GetObjectInScreen( objID ) yet or you will only use
a better working LOS on principle?
i read your handy HTC One S have a Adreno 225 gpu,looks fast,
i think it can render your whole level map in realtime.
and the HTC One S have a Qualcomm Snapdragon ( 1.500 MHz )
Dual-Core cpu.
can you show your 3d part too?
did you use syncrate with energy saving?
Zwarteziel
13
Years of Service
User Offline
Joined: 22nd Jan 2011
Location: Netherlands
Posted: 4th Apr 2013 15:53
Currently, I don't use the GetObjectInScreen-command. It's worth giving this a try. The HTC One S is indeed quite fast when it comes to OpenGL-rendering. Still, I'd like the application to function on older hardware as well, hence my search for methods to increase the frame-rate. I'll try the different syncrate-settings this evening if I can find some time and I might have an idea for an alternative LOS.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 4th Apr 2013 20:13
what you need is similar a flood fill function and then
all behind the player is invisible.

Login to post a reply

Server time is: 2024-05-06 03:54:08
Your offset time is: 2024-05-06 03:54:08