Changing the map texture?

Changing the map texture?

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
yanom
Posts: 323
Joined: 10 Jul 2009, 23:34

Changing the map texture?

Post by yanom »

So I've noticed that when I terraform things in Zero-K it makes the ground all brick-textured, to look like manmade construction rather than natural terrain. How do I do that? I've got buildings in my game that make the ground around them flatter when they're built, and I'd like to apply a cobblestone or concrete texture to the ground it flattens.
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: Changing the map texture?

Post by gajop »

Changing map texture is not easy in my experience.
Not sure how ZK does it (check their code) but I'm doing this the following way in ToolBox:
1. When the game starts I generate new textures for each map square (map squares are rectangles of 1024x1024 size). The reason for this is that for some reason the textures you get by default don't support rendering (FBO disabled or sth). code
2. I set those newly generated textures using Spring.SetMapTexture(tex).code
3. When needed I render to those textures using gl.RenderToTexture(tex, function()). I also use shaders in this step (not sure if it's necessary). code

All this should be done in one of the GL calls, like widget:DrawWorld.

Check my code here: https://github.com/gajop/Toolbox/blob/m ... exture.lua it is complex and ugly atm.

PS: Maybe there's an easier way (read: there probably is), so please share it if you find it :)
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: Changing the map texture?

Post by FLOZi »

User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

Re: Changing the map texture?

Post by zwzsg »

Err, wouldn't the simple BuildingGroundDecal tags cover yanom's need?
yanom
Posts: 323
Joined: 10 Jul 2009, 23:34

Re: Changing the map texture?

Post by yanom »

oooh, that's right. Building ground decals! Do those dissapear after the building dies?

it appears that ground decals aren't turned on in Low or Very Low graphics mode, though. Anyway for the mod to force them to show up? They're kind of important, I don't want users on slow PC's to miss out. I can make them non-transparent and low-res if that helps.
Post Reply

Return to “Game Development”