See what's going on with flipcode!




 


Submitted by Graham, posted on 28 May 2001



Image Description, by Graham


this is a screenshot from my game in development, which i [eventually] intend to turn into a full game, ill just have to hire some others to do my media (textures, modelling etc) anyways, onto the techy stuff

first the console, the heart of my game. the console consists of an output and input (displayed in a dos console for servers and an on-screen display for users and clients). when an input is proccesed, it splits up the char* to match the command to a list in a hash table. commands are added with a name and a function inside my code (yay function pointers) as are variables. theyre either added beforehand as actual variables (pointers to screenwidth/height etc). this great console allows me to test stuff quickly and easily. oh and it loads cfg files too :]

next the terrain; (everyones doing it! <-- ive given in to peer pressure) the whole map is tile based, with a grid of 4x4 heightmap per tile. when a tile is drawn, it matches up the corners with the adjacent tile, so theres no gaps(theres a bit on this at the end) i load an image and get the average greyscale and set the height of that particular tile's heightmap. rather than pre-determine the normals i work them out on-the-fly as in the future the heightmap will be changed (destructable :D)

as for drawing, ive recently switched to a new "scaledistance" (its a varible in my console) so, (based on the viewdistance/culling distance and the scaledistance) the further away the particular tile being drawn is, the lower quality the tile (tiles per tile :) with just a level of 1,2 and 3. this has helped me speed up the cfgs for lower range gfx cards :]

lastly, what i render, rather than a basic for(x=0) for(y=0) pair of loops, i worked out a new method for what i should draw; i have a grid of bytes (the same size as the amount of tiles existing on the map) and work out a bounding rectangle of tile that should be drawn based on the viewdistance, and less behind and to the side etc. then i just use a floodfill algorithm to fill in the grid. this works a treat, saves a lot of cpu time, and is very efficient :]

ive moved onto bringing in the networking stuff now (the site has a quick mention on how to use it) and its going fine.

the *only* problems i have are that the method of the floodrender (as i call it :) is that i cant to a total tri-strip render (its just per-tile atm). Also when the scale changes, you can see gaps in the terrain as not as many points match up (in-betweens of the heigtmaps on the tiles). my other problem is my programmers art syndrome :]

anyone feedback is much appriciated and any solutions would also be cool.

the latest demo is avaible (and updates to the site) at www.uberspace.net :]

-- Graham at deadpenguin dot org
-- www.uberspace.net
-- www.deadpenguin.org
-- icq 13548542



[prev]
Image of the Day Gallery
www.flipcode.com

[next]


 


Copyright 1999-2008 (C) FLIPCODE.COM and/or the original content author(s). All rights reserved.
Please read our Terms, Conditions, and Privacy information.