Jump to content


Photo
- - - - -

Terrestrial Perfection, 3D Terrain Editor Engine


  • Please log in to reply
59 replies to this topic

#21 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14389 posts
  • Version:GM:Studio

Posted 17 October 2011 - 02:21 AM

It shouldn't be a problem with the file since I'm not getting this error nor anyone else.

I'm not entirely sure what could cause this problem but may I ask how much ram does your pc have?


If you are not checking the validity of the surface every time you use it and don't recreate it when it goes bad on you, you will get the error. Alt Tab out of the game for example... Or stay idle until the screen saver pops up.

//before using it
if(!exists(surf)) //first time or lost it
{
surf = create_surface(512,512) //create/re-create it
if(!exists(surf)) //really fail (not supported or too large)
{
Message "I cant do it anymore"
game_end();
exit;
}
}

use it
  • 1

#22 loverock125

loverock125

    GMC Member

  • GMC Member
  • 1599 posts
  • Version:GM8

Posted 17 October 2011 - 01:45 PM



It shouldn't be a problem with the file since I'm not getting this error nor anyone else.

I'm not entirely sure what could cause this problem but may I ask how much ram does your pc have?


If you are not checking the validity of the surface every time you use it and don't recreate it when it goes bad on you, you will get the error. Alt Tab out of the game for example... Or stay idle until the screen saver pops up.

//before using it
if(!exists(surf)) //first time or lost it
{
surf = create_surface(512,512) //create/re-create it
if(!exists(surf)) //really fail (not supported or too large)
{
Message "I cant do it anymore"
game_end();
exit;
}
}

use it



I see where the problem is. Thank you for pointing it out.

I'll fix it immediately.
  • 0

#23 loverock125

loverock125

    GMC Member

  • GMC Member
  • 1599 posts
  • Version:GM8

Posted 17 October 2011 - 05:55 PM

Hello

I begon to use this tool today. I made a map, and I want to save it, but I receive this message error
ERROR in
action number 2
of Draw Event
for object oController:

Trying to use non-existing surface.

How do I fix that?
thanks to answer^^
see ya ;)



Are you still getting that error or was it the usual Screen Saver error?

I uploaded another version of the Terrestrial Perfection.exe which saves the surfaces to sprites and every time they don't exist when they should they are re-created using the sprite.
This reduces performance when drawing on the terrain (because it saves the sprite) and it may also increase loading time.

Here is the new version. (It's only the exe, just replace it with the original exe)
Could you confirm that this version works? (If you are still getting that error)

Thank you
  • 0

#24 loverock125

loverock125

    GMC Member

  • GMC Member
  • 1599 posts
  • Version:GM8

Posted 19 October 2011 - 10:19 PM

New Version:

  • Fixed a bug that was causing buttons to be pressed even if they weren't (only released)
  • Added the ability to export a mini-map of your terrain. This is very useful if you are making an RTS game.

Edited by loverock125, 19 October 2011 - 10:19 PM.

  • 0

#25 jhett6

jhett6

    GMC Member

  • New Member
  • 54 posts

Posted 31 October 2011 - 11:54 PM

Heyy.... I have even more feedback for you.... i've been noticing errors occuring often when I use the load or export tools. I am forced to abort and lose all my work.... See what you can do on that.... and, also see if you can make an obj export option thx!!! PM me when You release the next version!!!
  • 0

#26 loverock125

loverock125

    GMC Member

  • GMC Member
  • 1599 posts
  • Version:GM8

Posted 01 November 2011 - 12:12 AM

Heyy.... I have even more feedback for you.... i've been noticing errors occuring often when I use the load or export tools. I am forced to abort and lose all my work.... See what you can do on that.... and, also see if you can make an obj export option thx!!! PM me when You release the next version!!!


I've tried it countless times and I don't get any error. Do you mind posting what error you are getting? That would really help me find the problem. I'm sorry for the lost of your work.
What do you mean obj export option? Export the terrain as an .obj model?
  • 0

#27 jhett6

jhett6

    GMC Member

  • New Member
  • 54 posts

Posted 01 November 2011 - 10:50 PM

yes, I do mean save as obj model file. You should also a add a quality option to the obj export so it can have high polys or very low, or in between.

here is the error I got when trying to export the texture map (this error happened on other exports and imports too):

___________________________________________
ERROR in
action number 2
of Draw Event
for object oController:

Trying to use non-existing surface.
  • 0

#28 loverock125

loverock125

    GMC Member

  • GMC Member
  • 1599 posts
  • Version:GM8

Posted 01 November 2011 - 10:52 PM

yes, I do mean save as obj model file. You should also a add a quality option to the obj export so it can have high polys or very low, or in between.

here is the error I got when trying to export the texture map (this error happened on other exports and imports too):

___________________________________________
ERROR in
action number 2
of Draw Event
for object oController:

Trying to use non-existing surface.


You can set the graphic detail when creating a new map. Ah this error only occurs in some computers, I created a new version a week ago for another person which was supporting all of them but I don't have it right now, I will re-create it and update the main post. Thanks for pointing it out.
  • 1

#29 borut

borut

    Courage Wolf Productions

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

Posted 09 November 2011 - 07:50 AM

looks great, is there an include script to import terrain in your game?
  • 0

#30 loverock125

loverock125

    GMC Member

  • GMC Member
  • 1599 posts
  • Version:GM8

Posted 09 November 2011 - 12:48 PM

looks great, is there an include script to import terrain in your game?



There's an example in the zip file that shows how to import the terrain in your game, along with some useful scripts like the one that returns the z position of the terrain at a certain x,y position. Thank you for the reply : )



Edit: New version, fixed minor bugs.

Edited by loverock125, 09 November 2011 - 01:39 PM.

  • 0

#31 willpoweredgames

willpoweredgames

    GMC Member

  • New Member
  • 10 posts

Posted 16 November 2011 - 11:36 PM

this program is amazing! i can't imagine the pages of code that you must have had to put into it!
do you think you could ever export these maps into an fps? it would be really cool if ppl could have this much control over their maps when they're customizing them
  • 0

#32 loverock125

loverock125

    GMC Member

  • GMC Member
  • 1599 posts
  • Version:GM8

Posted 16 November 2011 - 11:44 PM

this program is amazing! i can't imagine the pages of code that you must have had to put into it!
do you think you could ever export these maps into an fps? it would be really cool if ppl could have this much control over their maps when they're customizing them



Thank you very much for your reply and for the nice comments : )
I can't see why someone couldn't use this for an FPS game. It can pretty much be used for any type of 3D games. What I recommend
though when using it for FPS games is to use high resolution textures like 512x512, instead of the one used in this example which
are 256x256. That wouldn't affect the performance in the game, the only thing it would affect is the size of the exported maps.

By the way I can swear it was working perfectly before but I just re-downloaded and noticed a bug with the intensity and tool size sliders,
is my pc playing with me or are you getting those bugs as well?



Edit: Fixed bugs and re-uploaded

Edited by loverock125, 17 November 2011 - 12:07 AM.

  • 0

#33 Naterocks1

Naterocks1

    GMC Member

  • New Member
  • 10 posts
  • Version:GM8

Posted 11 December 2011 - 01:33 AM

Hey. I love using this to make my terrain with it and all that. The only (ONLY) part i don't like about it is that the heightmaps that it saves are a little inaccurate. I was just thinking of a .obj or .d3d save tool so I could load it in externially. Also a water tool would be nice.
  • 0

#34 loverock125

loverock125

    GMC Member

  • GMC Member
  • 1599 posts
  • Version:GM8

Posted 11 December 2011 - 01:35 AM

Hey. I love using this to make my terrain with it and all that. The only (ONLY) part i don't like about it is that the heightmaps that it saves are a little inaccurate. I was just thinking of a .obj or .d3d save tool so I could load it in externially. Also a water tool would be nice.


I'm working on a newer version which includes a water tool. Thank you for the feedback, I will put an option to save it as .d3d or .obj.

Thanks again :)

Edit: How is the heightmap inaccurate? I will try to fix it if you let me know. Thanks again!

Edited by loverock125, 11 December 2011 - 01:38 AM.

  • 0

#35 Naterocks1

Naterocks1

    GMC Member

  • New Member
  • 10 posts
  • Version:GM8

Posted 11 December 2011 - 08:03 PM

Actually, now that I'm thinking about it, I might just be setting the depth of the terrain a little off in my game. That would also be cool if you could make it tell us what the depth is so I could make it more accurate for myself. Thanks. When will the next update be?
  • 0

#36 slayer 64

slayer 64

    GMC Member

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

Posted 11 December 2011 - 11:55 PM

i haven't played any games that use heightmaps
  • 0

#37 loverock125

loverock125

    GMC Member

  • GMC Member
  • 1599 posts
  • Version:GM8

Posted 12 December 2011 - 07:23 PM

Actually, now that I'm thinking about it, I might just be setting the depth of the terrain a little off in my game. That would also be cool if you could make it tell us what the depth is so I could make it more accurate for myself. Thanks. When will the next update be?


The depth of the terrain is 50. It is drawn in the draw event of the oTerrain object. I'm not sure when the next update will be as I've just finished my courseworks, I'll do my best : )
Thanks for the post!

i haven't played any games that use heightmaps


I do believe that most games don't use heightmaps but we can never know for sure, can we?:P

It's just a way of creating a terrain very fast and can allow some great effects like for example making the terrain look like a photo. It can actually look like a 3D image if you load a heightmap of an image, and then load the texture of the same image. It does produce some really nice effects when you try it for example with a top-down moon image.

Also if you take a picture of a ground it would look very realistic. Since when you convert the photo to a black-n-white image, the rocks will appear whiter than the ground itself. As a result, the rocks would create mountains thus making it look exactly like the picture.

Edited by loverock125, 12 December 2011 - 07:29 PM.

  • 0

#38 Naterocks1

Naterocks1

    GMC Member

  • New Member
  • 10 posts
  • Version:GM8

Posted 12 December 2011 - 09:22 PM

Okay. That didn't really answer my question on what to put. I think I was looking for the terrain height. Do you know how i could get you my game file so you could have a look at it? Thanks:)
  • 0

#39 loverock125

loverock125

    GMC Member

  • GMC Member
  • 1599 posts
  • Version:GM8

Posted 12 December 2011 - 09:23 PM

Okay. That didn't really answer my question on what to put. I think I was looking for the terrain height. Do you know how i could get you my game file so you could have a look at it? Thanks:)


You can get the terrain height at a certain position using the script getTerrainHeight(x,y).

I'm not sure what you are trying to achieve though.
  • 0

#40 Naterocks1

Naterocks1

    GMC Member

  • New Member
  • 10 posts
  • Version:GM8

Posted 12 December 2011 - 10:11 PM

The scripts I am using are terrain_create, terrain_draw, and terrain_get_z. Here they are

terrain_create

//THE TERRAIN SHOULD HAVE THE HIGHEST DEPTH (10000 etc. - it gets set to -1 after initing this though)
//loads the terrain from a heightmap sprite - it does not matter what the size of the sprite is ( 32x32, 64x64 or 128x128 is recommended)
//argument0 = sprite
//argument1 = the size of the terrain squares
//argument2 = terrain height (Argument1 or 2 is my concern on what to put to make the terrain look right.)


global.swidth=sprite_get_width(argument0);
global.sheight=sprite_get_height(argument0);
global.terrainsize = argument1;
global.terraingrid=ds_grid_create(global.swidth,global.sheight);
global.terrainmodel=d3d_model_create();
draw_sprite_stretched(argument0,0,0,0,global.swidth+2,global.sheight+2)
for(w=0;w<global.swidth+2;w+=1){
for(h=0;h<global.sheight+2;h+=1){
val=draw_getpixel(w,h)
valex=color_get_value(val)
ds_grid_set(global.terraingrid,w,h,valex/240*argument2)
}
}
for(xx=0;xx<global.swidth-1;xx+=1){
d3d_model_primitive_begin(global.terrainmodel,pr_trianglestrip);
adraw=true;
for (yy=0;yy<global.sheight;yy+=1){
adraw = !adraw;
z2=ds_grid_get(global.terraingrid,yy,xx+1);
d3d_model_vertex_normal_texture(global.terrainmodel,yy*global.terrainsize,(xx+1)*global.terrainsize,z2,0,0,1,adraw,1);
z1=ds_grid_get(global.terraingrid,yy,xx);
d3d_model_vertex_normal_texture(global.terrainmodel,yy*global.terrainsize,xx*global.terrainsize,z1,0,0,1,adraw,0);
}
d3d_model_primitive_end(global.terrainmodel);
}
depth=-1;


terrain_draw

//argument0 = terrain texture (draws the floor)
d3d_set_culling(1);
d3d_model_draw(global.terrainmodel,0,0,0,background_get_texture(argument0))
d3d_set_culling(0);


terrain_get_z

//returns the height a a position
//argument0 = the x position to return the height at
//argument1 = the y position to return the height at (I think this one makes you guy go up and down with the terrain or something)

gx=floor(argument0/global.terrainsize);
gy=floor(argument1/global.terrainsize);
ox = argument0-global.terrainsize*gx;
oy = argument1-global.terrainsize*gy;
z1=ds_grid_get(global.terraingrid,gx,gy);
z2=ds_grid_get(global.terraingrid,gx+1,gy);
z3=ds_grid_get(global.terraingrid,gx+1,gy+1);
z4=ds_grid_get(global.terraingrid,gx,gy+1);
if(ox>oy){
mz=z1-ox*(z1-z2)/global.terrainsize-oy*(z2-z3)/global.terrainsize;
}
else{
mz=z1-ox*(z4-z3)/global.terrainsize-oy*(z1-z4)/global.terrainsize;
}
return mz+3

These are the scripts that i use. I got them from The Sivart on youtube.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users