Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Work in Progress / BlitzTerrain

Author
Message
kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 24th Aug 2010 20:18
BMacZero, Wow, that looks great!

Not sure if your doing this already, but heres a few tips which I found when I was doing something simalar a while ago.


1) Square the distance you want to check against and dont square root the distance your checking.

if CheckDist#>sqrt(Distx#^2+Disty#^2)

is the same as

if CheckDist#^2>(Distx#^2+Disty#^2))

but the seccond one is alot faster.


2) Do a box check before a distance check. Box checks are alot faster than distance ones. Just simply make an imaginary box around your unit which is the same size as the circle. If a point is in the box then you can do a distance check on it.

3) Only do checks on objects that are moving.

BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 24th Aug 2010 22:19 Edited at: 24th Aug 2010 23:43
Thanks for the tips, kaedroho . I'm going to add in raycast checks as well, so I need to get this as fast as I can.

Quote: "Square the distance you want to check against and dont square root the distance your checking."

Doing that already

Quote: "Do a box check before a distance check. Box checks are alot faster than distance ones. Just simply make an imaginary box around your unit which is the same size as the circle. If a point is in the box then you can do a distance check on it."

Ooh, I didn't think of that one.

Quote: "Only do checks on objects that are moving."

Probably would be worth it to figure out how to do this. Right now it's completely erasing and recalculating the illuminated areas every update. Perhaps I could have it draw circles based on the location of each unit rather than scanning the entire map and checking distances pixel-by-pixel.

Just to draw this to your attention, it looks like the texture from the near edges of the map is getting wrapped onto the far edges by one pixel (you can see this slightly in the screenshot)

EDIT: You forgot one I just remembered - multiplication is faster than squaring. I replaced if x^2+y^2<dist#^2 with if x*x+y*y<dist#*dist# and knocked the calculation time from 270ms to 90ms .

EDIT2: Boo-ya! Running at 60FPS now! Thanks again .

ChozoMufin
19
Years of Service
User Offline
Joined: 19th Apr 2005
Location: Columbus, OH
Posted: 25th Aug 2010 00:04
I tip my hat to you all. I've been working with BlitzTerrain for a while; think I posted once.

Anyway, I don't know if this has cropped up before, but ever since I downloaded 2.0, my terrain is being rendered in strips, with big empty strips between them. I've tried replacing the (functional) example code with my own images, and I get the same thing. Tried with and without texture and detail.

Using your terrain works just fine.

Heightmap generated with L3DT Pro.

Running Windows 7 x64. Intel i7-720QM ATI Mobility Radeon HD 5870 1 GB VRAM, 8GB RAM

Somebody set up us the bomb.

Attachments

Login to view attachments
Virtual Nomad
Moderator
18
Years of Service
Recently Online
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 25th Aug 2010 02:13
looks like i have visual studio 8 installed (i dunno why/how). what do i need to do to get you the info u want?

Virtual Nomad @ California, USA . DBPro V7.5
AMD Phenomâ„¢ X4 9750 Quad-Core @ 2.4 GHz . 8 GB PC2-6400 RAM
ATI Radeon HD 3650 @ 512 MB . Vista Home Premium 64 Bit
kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 25th Aug 2010 02:22
When BlitzTerrain crashes, click Debug.

Then click new instance of Visual Studio 2008.

Visual studio should now open, get rid of any error messages that pop up then click Debug -> Save to dump file.

Then send me the dump file.



The Dump file is just a big file full of all the variables and registers at the time of the crash. I can use this to check all the variables and see which ones are misbehaving.

Could you please use the attached version of BlitzTerrain as any dumps you make with the current released version will not be compatible with the current code.

Thanks!

Attachments

Login to view attachments
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 25th Aug 2010 19:48
Hello, I have a quick question. I always get a crash when I call BT DeleteTerrain for the 2nd time.

I'm using BT in my game, and I can't change levels 3 times because of the delete terrain crash. I'm using code similar to the following, but I've cut it down for sanity's sake! lol

First I call,
Terrain.Id = BT MakeTerrain()
blah blah blah, terrain generated fine, I can play the level no problems.

I then change the level, call the following line:
If Terrain.Id Then BT DeleteTerrain Terrain.Id
I then delete the 3 images used to create the terrain, then set Terrain.Id to 0.

I then create a new terrain, again, no problems, it all works fine.

I change levels again, call If Terrain.Id Then BT DeleteTerrain Terrain.Id and boom! I get the dreaded "Application.exe has encountered a problem and needs to close." crash.
Apparently it's with ntdll.dll according to the windows error report.

Is there something I'm doing wrong, or the plugin buggy, or can I only delete terrains twice?

My signature is NOT a moderator plaything! Stop changing it!
kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 26th Aug 2010 00:32
That could mean a crash with the std library. I think the std library calls functions in ntdll.dll and maybe its not calling them properly. I will look into that tonight.

Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 26th Aug 2010 12:02
Thanks.

My signature is NOT a moderator plaything! Stop changing it!
Eminent
14
Years of Service
User Offline
Joined: 15th Jul 2010
Location:
Posted: 26th Aug 2010 22:36
Is there a tutorial for this? Because I could really use it.


Mugen Wizardry
User Banned
Posted: 27th Aug 2010 02:43
You might wanna check out smaas' post. He has put together an example using the landscape generator he created ^^

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 27th Aug 2010 15:38
Is there any way to make blitz terrains double sided?

My signature is NOT a moderator plaything! Stop changing it!
Weave
AGK Bronze Backer
18
Years of Service
User Offline
Joined: 26th Sep 2006
Location:
Posted: 27th Aug 2010 23:30
Keadroho, when I reposition the object that is the terrain I noticed that the environment map still thinks it`s at the original location. How does one reunite the two at the new location?

Still trying to figure the collision side of blitz. If I were to want a character to walk on the actual sector mesh and not just at `get ground height` I would need to turn the sector physical and pass it to the collision ie sparkys or xeno(as and when). Have you a suggestion as to sector identifying with regards our `character position`?

Great plugin


Thanks
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 28th Aug 2010 00:47 Edited at: 28th Aug 2010 00:47
To turn the BT into a collision mesh, you would indeed need to create an actual mesh from the terrain sectors.

This is what I use...


My signature is NOT a moderator plaything! Stop changing it!
Mugen Wizardry
User Banned
Posted: 28th Aug 2010 05:09
OR u could just save the terrain as a dbo object, then load it in as an object

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 28th Aug 2010 05:16
Quote: "OR u could just save the terrain as a dbo object, then load it in as an object"

I'm pretty sure you can't do that directly from Blitz - you have to make objects from the terrain first, which is what you're already doing so there's no point in saving them out after that.


Latest progress: Fog of War implemented
Weave
AGK Bronze Backer
18
Years of Service
User Offline
Joined: 26th Sep 2006
Location:
Posted: 28th Aug 2010 21:42 Edited at: 28th Aug 2010 21:53
@Mobius- thanks that looks usefull, with a distance check I guess you could just collision check the sector you are standing on, instead of all of them.

@MugenWizardry-did that last game and perhaps i feel that this would defeat the object of a system like blitz, which is built to lower the cpu impact yet give access to data about the terrain.

Take the situation where there are multiple characters on a terrain. With a sector call that turns physical the ground they are standing on it would be possible to have each character calling it and thus vastly reduce the time it takes to collision call...

Environment Map repositioning anyone? Seems the Env stays at 0,0....
Mugen Wizardry
User Banned
Posted: 28th Aug 2010 22:03
it did not. sheesh. if anything, it HELPS the system -.-

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 28th Aug 2010 23:30
I have to agree with weave. Having to create physical objects to be able to use collision does kinda defeat the point in the terrain engine, however, the LOD changing to reduce the polygon count of the terrain, added to the fact that the generated collision objects are hidden, should still provide a huge speed boost compared to advanced terrain. (Plus, the collision objects were generated from the lowest FOV terrain segment anyway.)

My signature is NOT a moderator plaything! Stop changing it!
Mugen Wizardry
User Banned
Posted: 28th Aug 2010 23:59
if anyone feels like TRYING my project, let me know how it works for you.

I know the lod reduction works, but i added TBM to all speeds in the game, and the fps increased significantly on this BAD gfx card.

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Gil Galvanti
19
Years of Service
User Offline
Joined: 22nd Dec 2004
Location: Texas, United States
Posted: 29th Aug 2010 00:18
Great plugin! I'm a bit confused by something though:
Quote: "RTTMS commands allow you to change terrains in real time. Making it easy to add explosive damage to terrains or create editors!"

What are RTTMS commands? I don't see any commands to edit it in real time, is that another plugin?


BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 29th Aug 2010 00:24
Quote: "What are RTTMS commands? I don't see any commands to edit it in real time, is that another plugin?"

I think they're coming in the full version. I know, I've been waiting for those for like a year .


Latest progress: Fog of War implemented
thenerd
15
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 29th Aug 2010 01:58
Ok, I'm having huge trouble with BlitzTerrain in conjunction with Newton...I've tried every different way of converting the terrain to an object and then making it a rigid body, and none of them ever work! has anyone gotten the terrain to work with Newton? If so, a little example on how it's done would help me a lot.

Oh, by the way BMacZero, that flame button in your sig is hilarious...


BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 29th Aug 2010 02:15
Sadly I just removed it for more Fields-related text . Thanks though, I'll put it back when I can .

I recall trying Newton a few months ago when I got frustrated with DarkPHYSICS...one thing I can say for DP, it only took a few minutes to get a BlitzTerrain up and running in it. Never managed to get them to work quite properly in Newton...


Latest progress: Fog of War implemented; frustrated by pathfinding >.>
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 29th Aug 2010 03:35
To get BT to work with newton, simply create a real object using the code I posted above, then save those sector objects, and load them as Newton rigid bodies.

No I haven't tried it as it's quite late, but it should work quite nicely.

My signature is NOT a moderator plaything! Stop changing it!
thenerd
15
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 29th Aug 2010 06:29
well, I must be doing something wrong because no matter how I set it up with that code, I just can't get it to work properly.


kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 30th Aug 2010 16:56
Sorry about going missing for a few days, I was on holiday in a place in Gloucestershire called Tewkesbury.


Quote: "Is there any way to make blitz terrains double sided?"


Yep,
set object cull ObjectID,0
use that on the object you set for the terrain.


Quote: "Keadroho, when I reposition the object that is the terrain I noticed that the environment map still thinks it`s at the original location. How does one reunite the two at the new location?"


I made the coordinates to be the coordinates on the environment map multiplied by the scale. I call it terrain space coordinates. The same coordinate system is used by get ground height, get point excluded, etc. The reason for this is because of the idea of spherical terrains. In spherical terrains, the terrains will be rotated in different angles making the calculations extremely complicated and slow.


Mobiius, you no longer need to position or hide your objects if you use R2. It now does it automatically.




Quote: "OR u could just save the terrain as a dbo object, then load it in as an object"


DBPro doesn't handle BlitzTerrain objects. It doesn't have access to any of the vertex data because its stored in a format which DBPro doesn't understand. The BlitzTerrain object isn't a real object. Its just a few data structures which BlitzTerrain accesses to figure out how to render the terrain. Using a DBPro object meant that I didn't have to write every single function to do everything with the terrain which you can already do with DBPro objects. BlitzTerrain can access the objects internal data but DBPro cant access BlitzTerrains internal data.


Quote: "Thanks that looks useful, with a distance check I guess you could just collision check the sector you are standing on, instead of all of them."


Thats exactly why I made BlitzTerrain do that. In an old project I was making along side a very very early version of BlitzTerrain (this must be over 2 years ago now). I put this check in and the FPS flew through the roof! It really improves FPS with Dark Physics.



Quote: "I have to agree with weave. Having to create physical objects to be able to use collision does kinda defeat the point in the terrain engine, however, the LOD changing to reduce the polygon count of the terrain, added to the fact that the generated collision objects are hidden, should still provide a huge speed boost compared to advanced terrain. (Plus, the collision objects were generated from the lowest FOV terrain segment anyway.)"


As BlitzTerrain doesn't store vertex data like DBPro does, I had to make this system to make it compatible with collision systems. Some collision systems such as xenophysics are able to access the vertexdata directly using a system I created inside BlitzTerrain. It is also able to update the vertexdata in all the plug ins which are using it when a user modifies the terrain.


Quote: "What are RTTMS commands? I don't see any commands to edit it in real time, is that another plugin?"


Real-Time Terrain Modification System. Its an internal system which allows TPCs to access and change vertexdata. There is an open source plugin in development to allow the user of DBPro to use these commands.

Mugen Wizardry
User Banned
Posted: 30th Aug 2010 18:32
but i need to smooth out my terrain. i used terrain smoothing, but there are still triangles popping out of the terrain

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 31st Aug 2010 14:36
Smoothing doesnt smooth out triangles as thats not possible. Computers can only draw dots, lines and triangles! Smoothing was originally designed to remove the stepping effect you get when using greyscale heightmaps on large terrains. Quad Rotation was designed to reduce the number of triangles popping out by rotating each quad to the best way (I invented this ). And the image resize button in paint was designed for people who need more detail in their heightmaps .

kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 31st Aug 2010 17:30
Today, I'm going to rewrite the seam fixing part of BlitzTerrain. It will be able to fix seams on edges which have different LODLevels all along it such as a quad reduced sector. It will also help with adding streaming and spherical terrains.

KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 31st Aug 2010 21:46
Can't wait for that streaming. That's going to be a lot of fun to play with.

Eminent
14
Years of Service
User Offline
Joined: 15th Jul 2010
Location:
Posted: 31st Aug 2010 23:18
Is there a program that can make textures like the one in the example? Because it looks really good.


kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 31st Aug 2010 23:22
The terrain used in the example was taken from the advanced terrain demos. Its probably from TGC but I dont know.

You can use a program called L3DT to really easily make heightmaps and textures. Or textures from heightmaps.

thenerd
15
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 1st Sep 2010 00:32 Edited at: 1st Sep 2010 01:09
Hey, just wondering, I couldn't find it, what is the command to detect if a terrain exists?
[edit] see post below.


Eminent
14
Years of Service
User Offline
Joined: 15th Jul 2010
Location:
Posted: 1st Sep 2010 00:36
I have another question, what is the detail.tga for?


thenerd
15
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 1st Sep 2010 01:06 Edited at: 1st Sep 2010 01:09
The detail map uses multitexturing to tile an image across the terrain above the main texture, to give it more detail instead of being blurry. this avoids you having to have a huge texture file for the main texture, and makes the terrain look a lot nicer.


Also, I figured out my above post, but now I cannot find the command to turn on a terrain's wireframe...


Attachments

Login to view attachments
Eminent
14
Years of Service
User Offline
Joined: 15th Jul 2010
Location:
Posted: 1st Sep 2010 01:58 Edited at: 1st Sep 2010 05:33
Its in the examples i think.
EDIT: When I use the a heightmap generated by L3DT, Blitz says the "BT Error:Height map height invalid Function:BT BuildTerrain".


Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 1st Sep 2010 13:27
I believe you can only use 256 colour heightmaps.

My signature is NOT a moderator plaything! Stop changing it!
Eminent
14
Years of Service
User Offline
Joined: 15th Jul 2010
Location:
Posted: 1st Sep 2010 17:43
The heightmaps that L3DT make have a red outlining on oceans I think. So its pretty much useless.


Indicium
16
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 1st Sep 2010 19:33
The heightmaps for L3DT work fine with BlitzTerrain, i have done this is project atomic.

The red outlining isn't exported.

kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 1st Sep 2010 21:16
Quote: "When I use the a heightmap generated by L3DT, Blitz says the "BT Error:Height map height invalid Function:BT BuildTerrain"."


This error doesnt exist. But Heightmap size invalid does.

You heightmap needs to be in the following to avoid this error:

Size must be power of 2 number (64, 128, 256, etc).
Width and Height must be equal.
Size must be from 64 to 1024 pixels in size (and up to 4096 pixels with full version).

Eminent
14
Years of Service
User Offline
Joined: 15th Jul 2010
Location:
Posted: 1st Sep 2010 23:21
@Mad what settings do you use to make the heightmap and terrain?? Cause it doesnt work for me.


Indicium
16
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 2nd Sep 2010 00:03
Pretty much default mate, except the settings for changing the average height, the amount of cliffs etc.

Are you texturing it with a color map and using the heightfield?

Eminent
14
Years of Service
User Offline
Joined: 15th Jul 2010
Location:
Posted: 2nd Sep 2010 02:53
Theres a color map? What I do is go to new project, make designable map let the comp do everything key pressing calc and ok the only thing I do is skip the lightmap. What width and height are you using?
What version are you using?


Mugen Wizardry
User Banned
Posted: 4th Sep 2010 04:23
You need DBPro 7.5. You also need to make sure your graphics card can HANDLE anything above 512.

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Eminent
14
Years of Service
User Offline
Joined: 15th Jul 2010
Location:
Posted: 4th Sep 2010 18:10
^It works. Its just that L3DT doesnt work with it.


Mugen Wizardry
User Banned
Posted: 4th Sep 2010 19:18
Use Smaas' Landscape Generator. It has FAR better graphics!

It's in this thread

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Eminent
14
Years of Service
User Offline
Joined: 15th Jul 2010
Location:
Posted: 4th Sep 2010 20:47
But its slow as hell.


kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 4th Sep 2010 23:30
I got L3DT terrains working with BlitzTerrain fine. Just export your heightmap to BMP and your texture to jpeg and it should work. Support for RAW files and 16 bit heightmaps will be available in the full version.

Indicium
16
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 5th Sep 2010 01:45
texture in .png works fine too.

Eminent
14
Years of Service
User Offline
Joined: 15th Jul 2010
Location:
Posted: 5th Sep 2010 16:58
Well it doesnt work for me. Ive attached the heightmap and terrain.


Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-11-23 18:43:53
Your offset time is: 2024-11-23 18:43:53