Rendernet

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
Imerion
Posts: 200
Joined: Sun Feb 09, 2014 4:42 pm

Rendernet

Post by Imerion »

Maybe I'm trying to run before I can walk here, but I tried to use a Rendernet to create a background which would react to player movements. I was thinking that if I saved the player coordinates I could check if any vertex where close to the player and then change it's z value, so the background would "budge" under the player. I didn't get this to work though. I was thinking of putting something along these lines :
if (PlayerX > this.Vertex.X-1) {
if (PlayerX < this.Vertex.X+1) {
if (PlayerY > this.Vertex.Y-1) {
if (PlayerY < this.Vertex.Y+1) {
this.Vertex.Z=-1;
}
}
}
}
in the RenderVertexExpression, but this got very weird.
Any pointers on how to handle rendernets if I want to accomplish something like this?
User avatar
Kjell
Posts: 1883
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hi Imerion,

Attached is a example :wink: Even though you generally want to use a shader for these kind of effects ( because of performance ).

NiGHTS into Dreams actually uses a similar technique for terrain deformation in the Soft Museum stage.

K
Attachments
Soft.zgeproj
(1.46 KiB) Downloaded 410 times
Imerion
Posts: 200
Joined: Sun Feb 09, 2014 4:42 pm

Post by Imerion »

Thanks again Kjell, another excellent example!

Ah, I remember that level! Nights is a great game, really should pick it up and play through it again some day soon. ;)
Imerion
Posts: 200
Joined: Sun Feb 09, 2014 4:42 pm

Post by Imerion »

Yep, works perfect in my game too!

I also tried to make it track multiple objects, but failed. I guess that would need another kind of approach.
User avatar
Kjell
Posts: 1883
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hi Imerion,
Imerion wrote:I also tried to make it track multiple objects, but failed. I guess that would need another kind of approach.
Attached is a example that uses multiple objects. Although you really want to use a shader at this point ..

K
Attachments
MultiSoft.zgeproj
(2.11 KiB) Downloaded 416 times
Imerion
Posts: 200
Joined: Sun Feb 09, 2014 4:42 pm

Post by Imerion »

Modified it a bit and made it work with my game. Looks absolutely awesome! So happy with this! Thanks a lot!

Will look into shaders for this type of thing eventually, but decided I needed to learn that from the ground up using tutorials or so, in order to know exactly what those opengl calls do. ;)
Post Reply