Jump to content


Photo

Easy Heightmap Scripts


  • Please log in to reply
42 replies to this topic

#31 brett14

brett14

    GMC Member

  • GMC Member
  • 1151 posts
  • Version:GM8

Posted 01 December 2010 - 12:51 AM

same problem as the last person, I can't help you without you supplying code. Chances are (judging by the random X values) you acidently are creating it at
instance_create(terrain_get_z(x,y),y,instance);
however that is a complete guess.

and lastly how do you change the z value of the player to the terrain? :blink:

z=terrain_get_z(x,y);
and in you're projection code put the zfrom variable to either z or z+(how tall the player is). Put the zto variable to the same thing as zfrom +/- your zdirection


hey i cant place any of my models in this example

You should really use an editor MADE for 3D to do this, not the built in 2D editor for gamemaker. There have been many made (just search for some) and I too have made a couple (Editor14, Dark Region)

Edited by brett14, 01 December 2010 - 12:54 AM.

  • 0

#32 monstrous123

monstrous123

    GMC Member

  • New Member
  • 1 posts

Posted 14 December 2010 - 06:18 PM

Cheers it was really quick and easy to use :) - is there any way i can stretch one large texture over the whole map though? I've seen it done before and it would be perfect for my game... Any ideas?
  • 0

#33 brett14

brett14

    GMC Member

  • GMC Member
  • 1151 posts
  • Version:GM8

Posted 15 December 2010 - 01:46 AM

read the first post.
  • 0

#34 dohyung97022

dohyung97022

    GMC Member

  • New Member
  • 2 posts

Posted 26 January 2011 - 11:52 PM

When this game goes to another room, it makes all the stuff in variable y upsied down.
What is the variable in one of your script that makes it happen??
(When it goes to a 2d demention room);

Edited by dohyung97022, 27 January 2011 - 12:00 AM.

  • 0

#35 Venomous

Venomous

    GMC Member

  • GMC Member
  • 1562 posts
  • Version:GM:Studio

Posted 27 January 2011 - 12:05 AM

When this game goes to another room, it makes all the stuff in variable y upsied down.
What is the variable in one of your script that makes it happen??
(When it goes to a 2d demention room);

Call d3d_end().
As long as 3d mode is on, 2d rooms will be drawn upside down.

Edited by XtraButter, 27 January 2011 - 12:44 AM.

  • 0

#36 brett14

brett14

    GMC Member

  • GMC Member
  • 1151 posts
  • Version:GM8

Posted 27 January 2011 - 01:00 AM

It is not my scripts, its due to the fact the 3D mode is turned on. When 3D is turned of the view gets flipped. Call d3d_end.

Edited by brett14, 27 January 2011 - 01:01 AM.

  • 0

#37 dohyung97022

dohyung97022

    GMC Member

  • New Member
  • 2 posts

Posted 27 January 2011 - 09:10 AM

WOW
this was simple...
I thought this happened because of the scripts...

Have my Thanks!
  • 0

#38 GS-games

GS-games

    Creative

  • GMC Member
  • 353 posts
  • Version:GM:Studio

Posted 17 February 2012 - 05:58 PM

Works nice, but how do I change the texture repeats within the model?Posted Image

Edited by GS-games, 10 February 2013 - 11:51 AM.

  • 0

#39 aburgin

aburgin

    GMC Member

  • GMC Member
  • 48 posts
  • Version:GM8.1

Posted 23 February 2012 - 05:49 PM

Greetings !!

to Brett14....

I love the work here, but there is an issue. It appears that for some reason, when changing rooms, the terrain is not fully regenerated. It appears the height map array is inverted or changed with random numbers.

As an example I used your demo (which is great)... but if you add a second room that is a duplicate of the first room (except use a different texture map) and program the "F" and "B" keys to from room to room, the array is not re-generated, as you would expect. It appears corrupted (?!?).

I've noted, in GM8x, you can use the "persistence" check box to keep the terrain the same, except then the global terrain array is kept the same through all rooms. The texture doesn't change as it should.

Any Ideas ?????

nope... not using d3d_end()

I tried playing with d3d_start() in the terrain object, but that yields a flat texture map.

Maybe the question is....... How do I make the room re-load the terrain as it does on first load. Do I need to destroy the array in memory ?? ... load the height map and texture from file ??

What am I missing ????

yes, I have created a GM8 file, if needed.

Edited by aburgin, 23 February 2012 - 11:12 PM.

  • 0

#40 denton

denton

    GMC Member

  • GMC Member
  • 35 posts
  • Version:Unknown

Posted 04 November 2012 - 11:23 AM

Greetings !!

to Brett14....

I love the work here, but there is an issue. It appears that for some reason, when changing rooms, the terrain is not fully regenerated. It appears the height map array is inverted or changed with random numbers.

As an example I used your demo (which is great)... but if you add a second room that is a duplicate of the first room (except use a different texture map) and program the "F" and "B" keys to from room to room, the array is not re-generated, as you would expect. It appears corrupted (?!?).

I've noted, in GM8x, you can use the "persistence" check box to keep the terrain the same, except then the global terrain array is kept the same through all rooms. The texture doesn't change as it should.

Any Ideas ?????

nope... not using d3d_end()

I tried playing with d3d_start() in the terrain object, but that yields a flat texture map.

Maybe the question is....... How do I make the room re-load the terrain as it does on first load. Do I need to destroy the array in memory ?? ... load the height map and texture from file ??

What am I missing ????

yes, I have created a GM8 file, if needed.



Yeah I'm having the same problem, I got around it by just making the heightmap massive and just keeping it persistent. but now i need to do something that requires me to have more terrains, Did anyone figure this out?
  • 0

#41 _171863

_171863

    GMC Member

  • GMC Member
  • 14 posts

Posted 28 January 2013 - 10:15 AM

sorry for reviving this thread, but is there a possible reason the drawn model is flat

pm me if you want the gmk
  • 0

#42 justmiff

justmiff

    GMC Member

  • GMC Member
  • 56 posts
  • Version:GM:Studio

Posted 10 February 2013 - 10:49 AM

sorry for reviving this thread, but is there a possible reason the drawn model is flat

pm me if you want the gmk


Heightmaps are measured usually by their colour values. If your heightmap is completely black, then that will register as the minimal height for the entire model. Try drawing grey or white shades on your heightmap and see if there's any results. (Black=0 White=255) If you are already aware of this then try and make sure there is no transparent pixels, I'm not entirely sure what would be up if you are doing it correctly.
  • 0

#43 derptomi

derptomi

    GMC Member

  • GMC Member
  • 24 posts
  • Version:GM:Studio

Posted 08 March 2013 - 02:27 PM

It doesn't seem to work with GM: Studio. It just draws a flat surface... Any thoughts?
  • 1




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users