Go Back   RunUO - Ultima Online Emulation > Developer's Corner > Programming

Programming The language is your choice, everyone is here to help!

Reply
 
Thread Tools Display Modes
Old 04-16-2007, 03:21 AM   #1 (permalink)
Lurker
 
Join Date: Apr 2007
Location: NW USA
Age: 23
Posts: 13
Default UO Client programming: 'order' of drawing map, statics, mobiles

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?
Farfromhomefish is offline   Reply With Quote
Old 04-18-2007, 12:23 AM   #2 (permalink)
Lurker
 
Join Date: Apr 2007
Location: NW USA
Age: 23
Posts: 13
Default

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.
Farfromhomefish is offline   Reply With Quote
Old 08-30-2007, 06:01 AM   #3 (permalink)
Forum Novice
 
SiENcE's Avatar
 
Join Date: Jul 2005
Location: Berlin (Germany)
Posts: 124
Send a message via ICQ to SiENcE Send a message via AIM to SiENcE Send a message via MSN to SiENcE
Default

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
SiENcE is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5