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.

Game Design Theory / Lander / Zarch / Virus Style Landscape Generation and Movement

Author
Message
StevetS
21
Years of Service
User Offline
Joined: 19th May 2004
Location:
Posted: 15th Oct 2010 01:21
I've been searching round the forums for a while and wondering whether anyone has attempted a Zarch/Virus style game in DBPro?



It was pretty much cutting edge in 1987 when David Braben wrote the 'Lander' demo for the Archimedes and it looks like the sort of thing DBP should be able to handle without problem though I don't think I've seen any remakes. Does anyone know any different?

The meat of the game has to be in the landscape generation and manipulation code where the extents of the screen consist of a 12x12 grid of squares at varying height making up the ground. The game map is square (about 20x20 screens = about 240x240 landscape squares wide and deep) but the game 'wraps around', so the player leaving one side of the screen appears seamlessly on the opposite side without interruption to the 3D view.

Link the game in motion:
http://www.youtube.com/watch?v=ZiixfIXMNGA

As the player is always in the centre of the screen I'm guessing the player object is stationary in x and z co-ords and the landscape 'scrolls' around it lifting data from a height map of sorts (so there is no flipping effect which would otherwise be apparent should the player position jump to opposite sides of a 3D map). i.e the player would never encounter a map 'edge'.

Setting up the landscape array for 256x256 squares would be a simple case of



Lifting the data from the array for the local squares is also straightforward and fast but generating the actual 12x12 landscape I'm guessing would present several options:

1. A matrix (everyone seems to hate them!)
2. Object/s (would possibly need 4 of them flick/flacking around to keep the landscape seamless but removes the need to generate the landscape - predesigned as objects)
3. A terrain (a bit like a matrix object?)
4. Manually defining polygons to create the 12x12 grid (doubling up triangle objects)

I think I like the idea of '4' as each polygon as an object can be recoloured and interacted with (respond individually to a collision command - e.g. when a virus particle hits it then change its colour to red) whereas as the others are individual items also requiring a separate texture to colour them (or am I wrong?) which then needs to be repasted everytime a landscape square needs to change colour.

Using polygons we'd be moving the 12x12 landscape grid until it reached a boundary edge then generating the next row or column of 12 squares (24 polygons) while deleting the opposite edge of squares. Sounds quite simple but there'd be big performance hit with running through two 24 cycle loops every couple of game loops (when an edge was reached) and having to delete 24 objects then create a replacement 24 objects at the opposite side.

Does anyone have any thoughts on what the most efficient method of doing all of the above would be?

Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 15th Oct 2010 12:48
I think the best method for a Virus game would be a matrix - because you would have a tile sheet, and updating the tile on the matrix, or indeed updating the terrain would be very easy with a matrix. Plus, you can scroll and update as well, so having just a small 32x32 matrix for instance means you could update it with the camera scrolling, matrices should be perfect for such a task.

For actually generating the landscape, well it can be very simple too, it depends on your approach. I mean, you could make a random terrain just using random values then smoothing several times, with a small terrain it should be quick to generate too.


I always liked Virus, but not necesserily the plot - I just liked to fly about the place trying not to crash. You should check out Hunter too, on the Amiga and Atari-ST, was an awesome game that used a similar terrain system to Virus, but was more about combat and vehicles and searching.

Health, Ammo, and bacon and eggs!
StevetS
21
Years of Service
User Offline
Joined: 19th May 2004
Location:
Posted: 15th Oct 2010 22:06 Edited at: 16th Oct 2010 19:26
Thanks for the reply Van!

I loved Virus - I think I've still got the original Virus, and Hunter (belive it or don't) for the ST in a big sealed plastic box (along with my ST1040) in my parents loft - if my dad's not dumped it yet! I'm thinking I might just dig it out and fire it up!

I wasn't thinking of remaking the game, just thinking of how easy to code in DBPro. Tho, then again, when I finish Quazatron I might just look at a Virus/Hunter crossover. People in Virus, a Defender style 'protect the innocent' option as a side mission to stopping the virus spread. Could be a goer!

A matrix you say??!!

I've put a little bit of code together (using notepad, at lunchtime, at work though I've checked in compiles and complies tonight!):



Just moving a very basic visible landscape around the screen.

I'm getting around 530fps shifting my 288 polygon round (without regenerating or replacing them), compared to 1770 with an identical textured matrix.

Looks like the matrix is a lot faster, though I'm not yet so sure about the interactivity of the matrix, nor does it look at the constant regeneration of the landscape required. (Mind modification of vertices has to be quicker than deletion and regeneraton of objects in each affected row and column).

You need to be able to register changes to the colours of the individual squares to show the virus spreading. So basically the texture (or at least part of it) has to be re-applied every game cycle to reflect any virus spread. Will have to have a look at that!

Edit:

As an edit (not wanting to double-post)!

I've been thinking about the ingame objects - enemies and such - I guess there's no real need to run through the drawing commands if they're not physically within the 12x12 visible screen.

Could just bypass the draw commands in each cycle and only update their co-ordinate positions in the game world (as opposed to using the hide object command or simply letting them exist outside a 12x12 skybox. If they then fall within a 6/7 square radius around the player they could be added back in as physical objects.

Not sure whether this would save some processing time?

Dr Tank
16
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 11th Nov 2010 20:29 Edited at: 12th Nov 2010 17:29
Virus is a cool game. I had v2000 for playstation and it was very impressive and attractive, but the controls and gameplay were a bit too hard and unforgiving. Zeewolf on the Amiga used the same kind of engine. That was an awesome game!

Your demo looks nice. If you want speed you would be better off using memblocks, but a matrix will do OK.

To get wrapping mechanics, i recommend using dwords for object positions. This way, to get the position of anything relative to the player, you subtract the player's dword co-ordinates from those of the other thing.

To get the landscape working fast, a matrix isn't ideal because when you update a line it can slow down, but I think for something like 12x12 it won't really be a problem. You don't want to be repositioning the matrix each frame though. Centre the matrix about the origin and don't move it. Let the player model stray from the origin horizontally (it can move up or down), within a grid square. Once it goes out of the grid square, you move it by a grid square back into the square around the origin, and shift the matrix, updating the new edge from the map.

You could get the sharp cutoff and hide the jerky matrix update by making an inverted black box centred on the player.

I should really be doing other things but I might make an example of this!
Dr Tank
16
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 12th Nov 2010 04:08 Edited at: 12th Nov 2010 17:23
SKIP TO NEXT POST. SORRY.
Dr Tank
16
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 12th Nov 2010 17:04 Edited at: 12th Nov 2010 17:28


Check this out. No media required. Mouse to tilt, mouseclick to thrust. Next up: tank and map, but I should leave that for a bit later.




Quote: "You need to be able to register changes to the colours of the individual squares to show the virus spreading. So basically the texture (or at least part of it) has to be re-applied every game cycle to reflect any virus spread. Will have to have a look at that!"

That's very doable. You just change the matrix tiles and update the matrix. You wouldn't need to do it every frame. You could update every 10 frames or so, or when virus "bombs" or whatever are dropped.
Dr Tank
16
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 14th Nov 2010 02:19 Edited at: 14th Nov 2010 02:21
I've been playing a bit more with this. Here's a vid showing the camera in action. More info in the vid description.

Here's a retro remake of Virus made in Blitz Basic. It's pretty awesome. Check it out.

One thing that I forgot about Virus was that the controls were horrible for a non expert, with the mouse moving left/right to turn the ship, and up/down to pitch. My thing uses a system like in Zeewolf which I find more intuitive, but limits the pitch of your vehicle.

Do you guys actually like the original control system from Zarch?

Login to post a reply

Server time is: 2025-06-09 06:51:03
Your offset time is: 2025-06-09 06:51:03