Dynamic tile rendering question

Talk about making games.

Dynamic tile rendering question

Postby tzoli » Sat Jul 04, 2015 5:09 pm

Hi guys!

It's been a long time since I posted something here. :)
I have a question which I couldn't figure out, no matter how hard I was thinking about it. The current system of Pixelcraft is kinda lame, so I thought I would recreate it with a friendlier user interface and a cleaner code. One thing that I really want to change is the map system. I want it to be fluid (when passing from one 'map' (chunk) to another just like in Terraria, or any other game, the camera follows the character and you always see what is in front of you.
At one of my topics someone posted a system like that but I can't find it anymore...

If you have any ideas or complete system, I would be grateful if you would share it with me.
Thanks! :)
Creepers are capable of climbing ladders, despite lacking arms. (Minecraft wiki)
User avatar
tzoli
 
Posts: 343
Joined: Sat Jun 12, 2010 6:54 pm
Location: Behind you
Score: 15 Give a positive score

Re: Dynamic tile rendering question

Postby bat78 » Sun Jul 05, 2015 10:01 am

There are not much users available or at least not enough to answer on time.

So you better be a little more specific. Surely, I can create you or tell you how you can create any system all by yourself as long as I know exactly do you mind.
And in that case - I don't.
I haven't played Terraria, neither your Pixelcraft.

Why don't you provide a link to Pixelcraft so I can try it ( I don't have time to risk by searching it )
and a video of a game that implements what you call "Dynamic tile rendering".. or a wikipedia page maybe.
The future of "Game-Editor" here
User avatar
bat78
 
Posts: 816
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 88 Give a positive score

Re: Dynamic tile rendering question

Postby tzoli » Sun Jul 05, 2015 11:12 am

Imagine any platformer game. The camera follows the character seamlessly. I want that but in my case the map is built up by blocks (a lot of them) just like in Mincraft or my game Pixelcraft: http://game-editor.com/forum/viewtopic.php?f=6&t=11881&hilit=pixelcraft.
In my game if you leave a "chunk" you continue in an other but the camera is fixed. I want the camera to follow the player.
Creepers are capable of climbing ladders, despite lacking arms. (Minecraft wiki)
User avatar
tzoli
 
Posts: 343
Joined: Sat Jun 12, 2010 6:54 pm
Location: Behind you
Score: 15 Give a positive score

Re: Dynamic tile rendering question

Postby bat78 » Sun Jul 05, 2015 11:20 am

tzoli wrote:Imagine any platformer game. The camera follows the character seamlessly. I want that but in my case the map is built up by blocks (a lot of them) just like in Mincraft or my game Pixelcraft: http://game-editor.com/forum/viewtopic.php?f=6&t=11881&hilit=pixelcraft.
In my game if you leave a "chunk" you continue in an other but the camera is fixed. I want the camera to follow the player.


If this is what I think it is.. then why don't you just set the camera to follow the player.
For instance, setting view's parent to be the player entity.

If you want the camera to follow player entity conditionally (for instance when payer entity locates after the second half of the screen)
you can set the view's parent by virtue of the function ChangeParent
The future of "Game-Editor" here
User avatar
bat78
 
Posts: 816
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 88 Give a positive score

Re: Dynamic tile rendering question

Postby tzoli » Sun Jul 05, 2015 12:17 pm

The problem is not the camera following the player but the map rendering in front of him and optionally (for optimization) disappearing behind him.
Creepers are capable of climbing ladders, despite lacking arms. (Minecraft wiki)
User avatar
tzoli
 
Posts: 343
Joined: Sat Jun 12, 2010 6:54 pm
Location: Behind you
Score: 15 Give a positive score

Re: Dynamic tile rendering question

Postby bat78 » Sun Jul 05, 2015 12:45 pm

tzoli wrote:The problem is not the camera following the player but the map rendering in front of him and optionally (for optimization) disappearing behind him.


For dynamically generating terrain you must render those CHUNKS in real time.
Which means keeping track of offsets and using CreateActor when needed.
Minecraft actually loads terrain just like it is in your Pixelcraft btw.

For best performance I would re-render terrain only in the scope of the camera. One vertical of blocks at time.
The future of "Game-Editor" here
User avatar
bat78
 
Posts: 816
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 88 Give a positive score

Re: Dynamic tile rendering question

Postby bat78 » Sun Jul 05, 2015 5:14 pm

There, I just created this.
video.zip
(478.53 KiB) Downloaded 157 times


What you see is infinite terrain of real-time generating blocks.
The entire screen is one canvas that covers the view.
The future of "Game-Editor" here
User avatar
bat78
 
Posts: 816
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 88 Give a positive score

Re: Dynamic tile rendering question

Postby tzoli » Sun Jul 05, 2015 5:21 pm

Yeah it is what I meant.
Could you tell me what to do, or maybe a demo, because I'm not really into canvases. I would be really grateful. :)
Creepers are capable of climbing ladders, despite lacking arms. (Minecraft wiki)
User avatar
tzoli
 
Posts: 343
Joined: Sat Jun 12, 2010 6:54 pm
Location: Behind you
Score: 15 Give a positive score

Re: Dynamic tile rendering question

Postby bat78 » Sun Jul 05, 2015 5:32 pm

tzoli wrote:Yeah it is what I meant.
Could you tell me what to do, or maybe a demo, because I'm not really into canvases. I would be really grateful. :)


Okay I will send you this demo. This is a base system and I created it only as a question if this is what you needed.. So obviously it is far from perfect.
But I am so sure you can learn a lot from it:
merkyrial.zip
with a random name
(178.17 KiB) Downloaded 165 times
The future of "Game-Editor" here
User avatar
bat78
 
Posts: 816
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 88 Give a positive score

Re: Dynamic tile rendering question

Postby tzoli » Sun Jul 05, 2015 5:34 pm

bat78 wrote:Okay I will send you this demo. This is a base system and I created it only as a question if this is what you needed.. So obviously it is far from perfect.
But I am so sure you can learn a lot from it


I'm sure that I'll learn one thing or two, it doesn't matter if it's not perfect, since I only need a start and from there I will try to upgrade it.
Thank you! :D
Creepers are capable of climbing ladders, despite lacking arms. (Minecraft wiki)
User avatar
tzoli
 
Posts: 343
Joined: Sat Jun 12, 2010 6:54 pm
Location: Behind you
Score: 15 Give a positive score

Re: Dynamic tile rendering question

Postby bat78 » Sun Jul 05, 2015 6:10 pm

There are a lot of stuff that could be optimized.
The loop could be omitted entirely.
The future of "Game-Editor" here
User avatar
bat78
 
Posts: 816
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 88 Give a positive score

Re: Dynamic tile rendering question

Postby Zivouhr » Sun Jul 05, 2015 11:50 pm

Interesting approach with the canvas. I'll have to take a look.

I can imagine Bat's suggestion may be more efficient than the way I made Tomb of Twelve's giant world.

With all the backgrounds on, the game would run at a crawl, but once I set Green region boxes as On/Off zones using visibility (or transparency if you wanted to test that), the game ran a lot better and faster (though laptops it tends to run slow). If I had to make the game again, I'd consider eliminating the Warp Doors, since they require the "Warp to" landscape be visible before it's warped to, otherwise, there could be a delay when it becomes visible and the character would warp into empty darkness, which is what I experienced until I triggered its visibility before the character even reaches the Warp door.

Once he left the green box (the box with the green lines that you can program functions into) zone of background 1, he'd enter a midway zone that would keep zone 1 on, but activate zone 2 before he sees background 2. Then when he entered the zone 2 activation, that would shut off zone 1 from being visible, since it was no longer in view.
City of Rott Game created on Game Editor http://cityofrott.wordpress.com/
User avatar
Zivouhr
 
Posts: 549
Joined: Sat May 17, 2014 2:12 pm
Score: 59 Give a positive score

Re: Dynamic tile rendering question

Postby bat78 » Mon Jul 06, 2015 7:50 am

Zivouhr wrote:Interesting approach with the canvas. I'll have to take a look.

I can imagine Bat's suggestion may be more efficient than the way I made Tomb of Twelve's giant world.

May be.

Zivouhr wrote:With all the backgrounds on, the game would run at a crawl, but once I set Green region boxes as On/Off zones using visibility (or transparency if you wanted to test that), the game ran a lot better and faster (though laptops it tends to run slow). If I had to make the game again, I'd consider eliminating the Warp Doors, since they require the "Warp to" landscape be visible before it's warped to, otherwise, there could be a delay when it becomes visible and the character would warp into empty darkness, which is what I experienced until I triggered its visibility before the character even reaches the Warp door.

Once he left the green box (the box with the green lines that you can program functions into) zone of background 1, he'd enter a midway zone that would keep zone 1 on, but activate zone 2 before he sees background 2. Then when he entered the zone 2 activation, that would shut off zone 1 from being visible, since it was no longer in view.

Lol, we have the habit to talk about our own games in the other's posts.
Don't worry about fps Zivouhr. When the imminent big gE project comes out, I intend to also release wanle SCORE.
The future of "Game-Editor" here
User avatar
bat78
 
Posts: 816
Joined: Sun Dec 14, 2008 9:13 pm
Location: Bulgaria, Sofia
Score: 88 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron