473,399 Members | 4,254 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Random Terrain

I'm a new programmer on Visual Basic and for any of you who play tank
wars, I'm attempting to lay out a terrain similar to it. What I need
is a terrain that I can draw (Basically just a random line across the
screen). I have no idea how to do this though.
http://www-user.tu-chemnitz.de/~mali...ages/spiel.gif
Taht is a link to an idea of how it is to look. I have made the tanks
with the ability to rotate the barrells, shoot, and such. I'm not
looking to make explosions in the terrain or for the terrain to move
in any way after generating it. If you can use that link, the view is
from the side, so this is only 2D. The last thing I need to do is be
able to know where the terrain was generated so I can place a tank on
the actually terrain after having it created. Thanks to Anyone who
can help!
Jul 17 '05 #1
1 2056
xyz
Define two imaginary parallel lines along the horizon separated by 100
units. The bottom line is the base of the mountains. Assuming that
the horizontal length of the lines is 500 units, start a loop (for
x=1 to 500) to generate the coordinates of the landscape. Your first
coordinate
will be x, y where y will be your previous y coordinate (originally
the y coordinate of your bottom line) plus a random number between -10
and +10. Any y values outside the range of the imaginary lines are
made equal to the previous y value. Draw a line between the previous
x,y coordinate and the new one. The result will be a random walk
between the two imaginary lines that will represent the mountain
landscape. By adjusting the number of units separating the imaginary
lines, the horizontal length, and the step of the random walk, you can
get different terrains.

xyz
On 19 Nov 2003 09:22:55 -0800, er*****@bellsouth.net (Eric) wrote:
I'm a new programmer on Visual Basic and for any of you who play tank
wars, I'm attempting to lay out a terrain similar to it. What I need
is a terrain that I can draw (Basically just a random line across the
screen). I have no idea how to do this though.
http://www-user.tu-chemnitz.de/~mali...ages/spiel.gif
Taht is a link to an idea of how it is to look. I have made the tanks
with the ability to rotate the barrells, shoot, and such. I'm not
looking to make explosions in the terrain or for the terrain to move
in any way after generating it. If you can use that link, the view is
from the side, so this is only 2D. The last thing I need to do is be
able to know where the terrain was generated so I can place a tank on
the actually terrain after having it created. Thanks to Anyone who
can help!


Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
by: Paul Rubin | last post by:
http://www.nightsong.com/phr/python/sharandom.c This is intended to be less predicable/have fewer correlations than the default Mersenne Twister or Wichmann-Hill generators. Comments are...
10
by: Virus | last post by:
Ok well what I am trying to do is have 1.) the background color to change randomly with 5 different colors.(change on page load) 2,) 10 different quotes randomly fadeing in and out in random...
1
by: Rol | last post by:
Hi, Does anybody has the real-time 3d terrain engines using directx 9 source code (basically the gaia engine) or knows where to find it? I could only find the updates... Thanks, Rol
10
by: Johnny Snead | last post by:
Hey guys, Need help with this random sort algorithm private void cmdQuestion_Click(object sender, System.EventArgs e) { Random rnd = new Random(); //initialize rnd to new random object...
10
by: Marshall Belew | last post by:
I'm trying to synchronize a network app that uses random numbers generated by System.Random. Rather than pass every randomly generated number, I just pass the seed. I'm seeing a result that leads...
15
by: Steven Macintyre | last post by:
Hi all, I need to retrieve an integer from within a range ... this works ... below is my out puts ... it just does not seem so random ... Is there perhaps a suggestion out there to create a...
3
by: liquidice | last post by:
Hello, I was wondering if anyone had any information on how to do bump mapping on a 2d terrain. Yes, this is for a game and the terrain will consist of tiles. One of the important things I...
14
by: skulkrinbait | last post by:
I'm wanting to write a browser based wargame and am going to use PHP to it. The game requires a big map and I want to generate this randomly as it will be a lot of work to do it manually. My...
6
by: Mike Langworthy | last post by:
i can not seem to get this code to work. someone please help using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication1 { class Program {
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.