|
||
|
|||||||
| Programming The language is your choice, everyone is here to help! |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Lurker
Join Date: Apr 2007
Location: NW USA
Age: 23
Posts: 13
|
I'm working on a UO client - not anything I'd ever release, more sort of a personal hobby project. So far, I have map0 displaying, with the appropriate textured 3d landscape and all the statics, and the client runs around as a naked dude with a diablo2 style of movement (the 'smooth' movement style is only clientside).
However, I don't have the tileengine set up to draw things in layers. Right now, the client iterates through each tile visible on screen, and draws that tile in its entirety (starting with the map tile, then drawing the statics and mobiles in order, bottom to top), then moves on to the next tile. Here's my question: how should a UO client draw the tiles on screen? Obviously drawing a tile-at-a-time isn't ideal, as this leads to graphical artifacts. One alternative would be to draw the map by altitude layer... so first I would draw everything at an altitude of -128, then -127, then -126... up to +127. But iterating 256 times through the draw loop would take a tremendous amount of resources, so obviously this isn't an ideal solution. Right now, my client runs at ~80 fps in the middle of a 3-story building filled with statics, on a 800mhz computer. I'd like to keep it that speedy. =) Could someone point me in the right direction as to drawing order? Does anyone know how other third-party clients handle this? |
|
|
|
|
|
#2 (permalink) |
|
Lurker
Join Date: Apr 2007
Location: NW USA
Age: 23
Posts: 13
|
For anyone looking at this thread in the future, here is my solution:
I've never programmed anything like this before, so it took me a few frustrating non-starters to come to this conclusion. First, I run through the entire tilemap in memory, drawing all the tiles, statics, game objects, and mobiles from altitude -128 to (player.altitude + 19). (I've noticed that there is generally 20 altitude units between each floor in buildings). At this point, I flag any tiles that are completely off the screen, and/or have no tiles or statics left to draw, as 'nodraw'. If the player is *not* under another 'surface' (and thus in a building, in which case we don't want to display the upper floors) I do the exact same thing, from (player.altitude + 20) to altitude +127. Somewhere in this process, I lost ~10% fps, and there might be graphical artifacts that pop up in the future, but for now, everything seems to be working just fine. No complaints. |
|
|
|
|
|
#3 (permalink) |
|
Forum Novice
|
Take a loot at Varans Palanthir Client. He released the source some weeks ago.
Palanthir: svn://uodev.de/palanthir Drawing is almost perfect and fast. Also Autopatcher and Mulpatcher are available: Autopatcher: svn://uodev.de/autopatcher Mulpatcher: svn://uodev.de/mulpatcher
__________________
http://crankgaming.blogspot.com/ | http://schattenkind.net/ | http://www.iris2.de/ | http://freedsa.schattenkind.net/
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|