473,807 Members | 2,830 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2077
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*****@bellsou th.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
3712
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 appreciated.
10
2512
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 spots on the webpage. with a delay timer on them, so they keep changing as the page is open. Not random each time the page is loaded. If anyone can help it would be greatly appreaciated, I have tried many of
1
2385
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
5993
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 System.Random iRnd = new System.Random(); string theNum = iRnd.Next(0,8).ToString(); lblAnswer.Text = iRnd.Next(0,8).ToString();
10
2514
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 me to believe that a seeded random number is still slightly random. I need a predictable random number. Here's my results Machine 1 Seed: 1453549276
15
2966
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 more random int ...? >>> random.randint(3, 8) 7 >>> random.randint(3, 8)
3
2820
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 need is to be able to determine the height of any given part of the map as well as the algorithm on how the shading works for the terrain.
14
2377
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 first prototype for doing this doesn't give good results, the map being far too random, can someone help me out or point me to a good resource please? The map will need to have sea in it and ideally rivers as well as the usual terrain, cities,...
6
4816
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
9721
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10628
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10374
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9195
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5547
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5685
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3859
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.