1. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

Grass growth

Discussion in 'Suggestions & Ideas' started by Vermilicious, Aug 22, 2013.

Mods: Rainbows
  1. Jepton

    Jepton Shipwright

    Messages:
    147
    I think Geti said that it would cause lag.
     
  2. Fernegulus

    Fernegulus Bison Rider

    Messages:
    400
    Of fucking course it would cause lag, you would have to scan through the entire map, check if the tile is grass and check for nearby dirts and even fucking more. 30 times a second.
     
  3. are you bad
     
  4. Fernegulus

    Fernegulus Bison Rider

    Messages:
    400
    Okay fine not really
    still some of the suggested stuff would require pretty bad shit
     
  5. yellowwhy1

    yellowwhy1 Catapult Fodder

    Messages:
    100
    I wouldn't mind some lag for pretty landscape
     
  6. Fernegulus

    Fernegulus Bison Rider

    Messages:
    400
     
    Dargona1018, Klokinator and Anonymuse like this.
  7. Crabmaster

    Crabmaster Bison Rider
    1. Zen Laboratories

    Messages:
    322
    A serverside-mod I have for my texturepack randomly places grass (snow) on blocks around the map. It actually runs very smoothly and causes very little lag if any. It is a handful of ints, a slow loop that checks random blocks on the map, and a small if statement that checks if there is a dirt block with air above it to place grass on.

    Only two issues with this is the fact that I don't think the game has grass with dirt-backwall tiles behind it, so if you try to place grass on an area with backwall it might just replace it with air and look bad, and also I am unsure how to place short grass, if that can be done. (If someone knows how I would really like to know)

    So it is totally possible, and if the devs never do it, modders can easily add it in.
     
    norill and yellowwhy1 like this.
  8. Boea

    Boea Such Beta

    Messages:
    653
    (Also, look at how fish spawn, they spawn in mostly the same way we are asking for fish to spawn: automatically, map-wide, in any water bed.)
     
  9. mcrifel

    mcrifel Haxor Staff Alumni Tester
    1. MIST

    Messages:
    582
    Grass should regrow but bushes should stay in my opinion.
     
  10. primal-gamer

    primal-gamer Shipwright

    Messages:
    11
    I suport this idea
    -Primal Gamer 2014 :thumbs_up:
     
  11. Malitha

    Malitha Shipwright
    1. SIEGE Clan - SIEGE

    Messages:
    131
    Oddly enough, Geti hasn't shared his thoughts on this matter even though its been up for months now, @Geti
     
  12. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    Honestly I deliberately ignore a lot of S&I, it's rarely a good use of my time.

    Forcing grass to grow everywhere would prevent varied environments like the one seen on the badlands map from being possible. Grass could spread from trees, but then the locations of trees would have to be calculated each time and the script would get more complicated.

    Although it would definitely be possible to optimise this sort of script, it would add some strain where none is needed - at the moment I'm more for removing taxing scripts rather than adding more, as every day I get yelled at by someone "NO FPS, PLS MAKE RUN FASTER!!!".
     
    makmoud98, kodysch and Malitha like this.
  13. Malitha

    Malitha Shipwright
    1. SIEGE Clan - SIEGE

    Messages:
    131
    Your right Geti, sorry for tagging you here. Guess that somethings are more important than the others.
     
    yellowwhy1 likes this.
  14. Fernegulus

    Fernegulus Bison Rider

    Messages:
    400
    They're right, you know.
     
  15. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    If it wasn't another year-long thankless job I'd be game.
     
  16. PUNK123

    PUNK123 Hella wRangler Staff Alumni Tester

    Messages:
    1,275
    it would take a year to add in grass? or are you just being dramatic?
     
  17. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    Talking about making the game run fast, not adding growing grass.
     
  18. Vermilicious

    Vermilicious Ballista Bolt Thrower

    Messages:
    232
    An "ancient" suggestion this one, but it's mine. My own. My precious. Uh, yeah. If anyone would like to do something like this, like in a mod, if it's too much of a performance thing to update the entire map (even just rarely), one could perhaps just pick out some random zones or even random tiles every now and then. Fully understandable that it's not an important feature for a hectic 20 player vanilla match though.

    Let there be grass.
     
    norill likes this.
  19. BarsukEughen555

    BarsukEughen555 Ballista Bolt Thrower

    Messages:
    434
    there was a mod which was adding snow textures - it also added *snowfall* aka retextured grass growing + blocks turning into moss overtime
    is not best faeture for CTF/TDM, but it could be somewhat fun in mods
     
  20. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    Code:
    //Grow grass script for forums love from geti
    //Untested but "should work" if I haven't made any typos :)
    
    //only run on server (no cost for clients)
    #define SERVER_ONLY
    
    //checks this many tiles each frame
    //and if they need it, grows the grass
    
    int tiles_per_frame = 1;
    
    //NOTE: for big maps this means the grass will grow more slowly
    //however it keeps a cap on the performance cost
    //if you want you could specify a proportion of the map
    //to update each frame but then big maps will be more expensive
    //YMMV etc
    
    //index of the tile we're at this frame
    //restarted each time rules are restarted for consistency
    
    int check_tile_index = 0;
    void onRestart(CRules@ this)
    {
    	check_tile_index = 0;
    }
    
    void onInit(CRules@ this)
    {
    	onRestart(this);
    }
    
    void onTick(CRules@ this)
    {
    	CMap@ map = getMap();
    	int tilemap_size = map.tilemapwidth * map.tilemapheight;
    	for(int i = 0; i < tiles_per_frame; i++)
    	{
    		//next tile
    		check_tile_index = (check_tile_index + 1) % tilemap_size;
    		Tile t = map.getTile(check_tile_index);
    		//if it's grass and not fully grown
    		if(map.isTileGrass(t.type) && t.type != CMap::tile_grass)
    		{
    			Vec2f pos = map.getTileWorldPosition(check_tile_index);
    			//grow (grass tiles are in decreasing order)
    			map.server_SetTile(pos, t.type - 1);
    		}
    	}
    }
     
    Biurza, makmoud98, Magmus and 3 others like this.
Mods: Rainbows