#pentagram@irc.freenode.net logs for 2 Aug 2004 (GMT)

Archive Today Yesterday Tomorrow
Pentagram homepage

[01:45:19] --> Sectus has joined #pentagram
[01:59:27] --> ElleVeeDee has joined #pentagram
[01:59:40] <ElleVeeDee> howdy peeps
[02:43:04] * watt waves frantically - HI!
[03:13:05] <ElleVeeDee> HI!!!
[03:13:08] * ElleVeeDee faints
[03:26:57] --> Sheng_Gradilla has joined #pentagram
[03:26:58] <Sheng_Gradilla> :)
[05:10:46] <-- ElleVeeDee has left IRC ()
[05:11:00] --> Colourless has joined #Pentagram
[05:11:00] --- ChanServ gives channel operator status to Colourless
[05:25:23] --> jsch has joined #pentagram
[05:34:27] <-- Kirben has left IRC ("System Meltdown")
[05:36:33] --> Kirben has joined #pentagram
[05:36:33] --- ChanServ gives channel operator status to Kirben
[05:37:01] <-- Interfection has left IRC (Read error: 110 (Connection timed out))
[05:50:44] * Sheng_Gradilla is away: No estoy
[05:57:26] --> ShadwChsr has joined #pentagram
[05:57:41] <ShadwChsr> Which file does most of pentagram's rendering occur? (ie/ the loop)
[05:58:02] <Colourless> err...
[05:58:11] <ShadwChsr> :P hehehe sorry :)
[05:58:23] <Colourless> it's kind of complex
[05:58:47] <Colourless> what loop are you talking about
[05:58:51] <ShadwChsr> I'm mostly curious as to any optimizations you do for world->screen coordinate conversion
[05:59:13] <ShadwChsr> but trolling through other people's code isn't easy when you first start *lol*
[05:59:15] <ShadwChsr> ;)
[05:59:19] <Colourless> most of the stuff occurs in World/ItemSorter
[05:59:47] * ShadwChsr nods
[06:01:24] <ShadwChsr> How many items (ground cells & items) are rendered at once on average would you say?
[06:03:41] <Colourless> hmm
[06:03:59] <Colourless> depends on the scene
[06:04:48] <Colourless> i'll just have a look
[06:05:44] <Colourless> hmm.. a few hundred you'll probably find
[06:06:09] <ShadwChsr> Thanks :)
[06:06:49] <ShadwChsr> Due to a nice bug in my engine I was rendering 100 chunks (blocks) at once - and they are 10x10 blocks
[06:07:13] <ShadwChsr> Gave me a good opporunity to tune the performance somewhat :)
[06:07:19] <Colourless> on extremely complex scenes as far as I know, it can get up to near a thousand, but those are very uncommon, and occur only because we are rending at 640x480 instead of the games native 320x200
[06:08:13] <ShadwChsr> I noticed that you were storing all of the game's coordinates in an array and then bitshifting them into uint16's, was there a reason for that, or just simplicity when loading or saving the data structures?
[06:10:29] <Colourless> compatibility
[06:10:49] * ShadwChsr nods
[06:10:56] <Colourless> what specifically were you looking at?
[06:11:09] <Colourless> the only code i can think of that would be doing that is the glob code
[06:11:27] <Colourless> but maybe you were looking at something else
[06:11:47] <ShadwChsr> struct WorldPoint
[06:12:01] <Colourless> lets have a looksie
[06:12:03] <ShadwChsr> uint8 buf[5];
[06:12:14] <Colourless> ah
[06:12:19] <Colourless> yeah
[06:12:21] <ShadwChsr> Was just curious :) I assumed that WorldPoint was used to store world coordinates for items
[06:12:32] <Colourless> WorldPoint is a little endian structure used with usecode
[06:12:38] <ShadwChsr> Ahhhh
[06:12:42] <ShadwChsr> That makes sense
[06:13:25] <ShadwChsr> You support Motorola?
[06:13:33] <Colourless> of course
[06:13:45] <Colourless> our code attempts to be platform independant
[06:15:02] <ShadwChsr> I dont really run into that problem much with .net :)
[06:15:19] <ShadwChsr> Technically it's platform independant but you almost never do bitshifting anyways :)
[06:16:21] <ShadwChsr> If I remember correctly, you said that you completely recaculate the scene each frame?
[06:16:32] <Colourless> yes we do
[06:16:43] <ShadwChsr> Do you calculate your CPS/FPS?
[06:16:50] <Colourless> yeah
[06:17:12] <ShadwChsr> What kind of rate do you generally get?
[06:17:39] <Colourless> we are mostly CPU bandwith limited
[06:17:54] <ShadwChsr> Aye but thats what I'm curious about :)
[06:17:54] <Colourless> when doing the rendering
[06:18:07] <Colourless> i usually get 40 FPS
[06:18:20] <ShadwChsr> what brand/model of CPU?
[06:18:31] <Colourless> Athlon 1000 (133x8.5)
[06:19:14] <ShadwChsr> I've been at about 50fps in debug mode on an XP 1800, but thats with a render list that tries to recalculate as needed
[06:19:21] <ShadwChsr> and not doing much at all :P
[06:19:47] <ShadwChsr> Not too happy with the performance so far, I think my screen coordinate calculations are pretty slow
[06:20:08] <Colourless> our world->screen is pretty simple
[06:22:08] <ShadwChsr> I have a "viewport" class that implements my IVisualLayer interface, and is added as the "base" layer for the render system
[06:22:46] <ShadwChsr> The viewport knows which block (chunk) is the "current" one, and it's screen offset from the block's origin
[06:23:50] <ShadwChsr> The coordinate conversion function is part of the viewport. It strips the block coordinate off of the world coordinate, then calculates the difference between the coordinate's block and the active block
[06:24:04] <Colourless> for us, ItemSorter doesn't pretty much everything
[06:24:07] <ShadwChsr> multiplies that by 1/2 the block size to get the coordinate's block position
[06:24:24] <Colourless> the GameMapGump feeds all the potentially visable items into the ItemSorter
[06:25:01] <Colourless> the ItemSorter then calculates onscreen position and generates the rendering order
[06:25:08] <ShadwChsr> I then take the coordinate's data (offset from the block instead of the world) and apply an algorithm to it to get the screen coord.
[06:25:11] <Colourless> finally it renders each item
[06:25:35] <Colourless> this is our world->screen
[06:25:35] <Colourless> // Screenspace bounding box bottom x coord (RNB x coord)
[06:25:35] <Colourless> si->sxbot = (si->x - si->y)/4 - cam_sx;
[06:25:35] <Colourless> // Screenspace bounding box bottom extent (RNB y coord)
[06:25:35] <Colourless> si->sybot = (si->x + si->y)/8 - si->z - cam_sy;
[06:25:42] <ShadwChsr> X = Every world "x" is 1/2 right, every world "y" is 1/2 left
[06:26:26] <ShadwChsr> Y = (worldX * tileHeight/2) + (worldY * tileHieght/2) + (worldZ * ZSize)
[06:27:26] <ShadwChsr> The multiplication happens as a float so I think the conversion back to int is killing the performance
[06:28:25] <Colourless> everything in pentagram is integer
[06:29:05] <ShadwChsr> Integer is nice, I was just worried about large maps and how to handle positions partway between cells.
[06:29:26] <ShadwChsr> What I'm doing right now isn't that great - storing XYZ as integer and an XYZOffset as float
[06:30:21] <ShadwChsr> the offset is -0.5 <= x < 0.5,
[06:30:37] <ShadwChsr> That way I don't run into nasty floating point precision errors
[06:30:52] <ShadwChsr> But uses more RAM and makes processing slower
[06:30:57] <ShadwChsr> :/
[06:34:11] <Colourless> our maps can only be 32k*32k
[06:35:32] <Colourless> really though, i don't think floating point is really required.... how big do you want your maps to be
[06:35:53] <Colourless> 32bit int will give you maps of 2billion*2billion
[06:35:56] <Colourless> which is massive
[06:36:34] <ShadwChsr> :)
[06:36:44] <ShadwChsr> or 4billion if you start from 0
[06:36:52] <Colourless> which isn't wise
[06:36:59] <ShadwChsr> Why not?
[06:37:12] <Colourless> will you then need to mix signed an unsigned
[06:37:44] <Colourless> better to use all signed
[06:38:33] <ShadwChsr> Well, the largest a map would ever be is 10kx10k, or so
[06:38:51] <ShadwChsr> heck all of UO is only 6000x4000 in size (or so) :)
[06:39:01] <ShadwChsr> (for the britannia map, anyways)
[06:39:31] <ShadwChsr> My main intellectual problem has been how to handle offsets between tiles.
[06:40:04] <ShadwChsr> smooth walking and objects halfway between tiles. The objects thing is a nice to have but not required, but smooth walking is.
[06:40:33] <ShadwChsr> I hated the way UO did it with the slice-n-dice renderer (remember the screenshots with the horse's heads cut off by walls? :P)
[06:41:16] <ShadwChsr> floats are nice because when I calculate the screen coordinates I don't need to do anything fancy. But they use alot more memory & disk space and require conversions :/
[06:42:03] <ShadwChsr> If your maps are 32k x 32k, I assume that means that the remaining 16 bits are used for the "sub" position, for lack of a better word?
[06:42:55] <Colourless> how big is a tile?
[06:43:41] <ShadwChsr> Ironically, the same as U8's. Total fluke.. well, sort of. I had permission from a Furcadia patcher to use his art in my game, and Furcadia was written by Dr Cat, who worked on U6
[06:43:46] <ShadwChsr> so.. there's probably some connection there ;)
[06:43:58] <ShadwChsr> But I didn't find out what U8's internal cell size was until later ;)
[06:44:09] <Colourless> well, technically u8 doesn't have 'tiles' as such
[06:44:10] <ShadwChsr> 62x32
[06:44:44] <ShadwChsr> err images are 62x32, but when placed it ends up being more like 64x32 due to the 1 pixel space on the edge where they align
[06:45:06] <ShadwChsr> By tiles I mean the ground shapes
[06:45:43] <Colourless> U8 uses coords that are accurate to half a pixel
[06:46:26] <ShadwChsr> What kind of coordinate system does it use?
[06:47:14] <Colourless> just a simple euclidian.
[06:47:16] <ShadwChsr> Are the axises aligned isometrically, or with the screen?
[06:47:27] <ShadwChsr> (45 degree rotation?)
[06:47:34] <Colourless> 45 degress
[06:47:58] <ShadwChsr> How many coordinates within one ground tile? do they line up exactially?
[06:48:21] <ShadwChsr> 128?
[06:49:11] <Colourless> should be 128x128
[06:49:37] <Colourless> yes
[06:49:39] <Colourless> 128x128
[06:50:12] <ShadwChsr> When you said your maps were 32k, did you mean in total coordinates, or in ground cells/tiles?
[06:50:22] <Colourless> total coords
[06:50:30] <Colourless> we don't talk in tiles
[06:50:47] <Colourless> we can consider globs (which as 4x4 set of tiles)
[06:50:47] <ShadwChsr> Even ground shapes are placed using the same system?
[06:51:08] <Colourless> yes
[06:51:33] <ShadwChsr> Interesting.. definately has some benefits, especially for larger ground tiles.
[06:51:42] <ShadwChsr> No chopping :)
[06:52:32] <ShadwChsr> So a U8 map would be about 512x512 in "tile" terms, seems about right, based on where they split things up.
[06:52:37] <ShadwChsr> Most of the data structures are 16bit?
[06:53:02] <Colourless> yes
[06:53:18] <Colourless> map will in general get no where near that size
[06:53:53] <ShadwChsr> Ahhhh the good old days of dos :)
[06:54:52] <ShadwChsr> Even the 386 was 32bit, I assume they chose 16bit to use less ram?
[06:55:56] <Colourless> 16bit was faster
[06:56:10] <Colourless> and larger was not necessary
[06:56:26] * ShadwChsr nods
[06:56:47] <ShadwChsr> I would have thought the native bit size would have been faster, but perhaps it was a bandwidth thing
[06:57:07] <ShadwChsr> And perhaps I should learn assembly and stop guessing ;)
[06:57:17] * Colourless grins
[06:57:56] <ShadwChsr> But yeah, integers are definately within my range hehe
[06:58:25] <ShadwChsr> Even with a collossal map I only get to about 1.2mil out of the 2 bil ;)
[06:59:13] <ShadwChsr> How is movement calculated in U8? Coordinates per... second? mp/s? Do the coordinates map to a realworld distance?
[06:59:40] <Colourless> disatances are coded into the animations
[06:59:47] <Colourless> we play the animations, the character moves
[07:00:32] <ShadwChsr> wow, that's unusual :)
[07:01:07] <ShadwChsr> Do the sprites move a constant distance throughout the animation cycle, or was it done that way to have more of a natural walking step?
[07:01:37] <Colourless> each frame has a specified distance to move
[07:01:50] <ShadwChsr> wow :)
[07:02:33] <ShadwChsr> Awhile back my boss at work was complaining that no games have done that and that if he ever made an FPS he would have a more natural walk cycle in it
[07:02:37] <Colourless> each animation is split into direction and frame
[07:02:44] <ShadwChsr> Even *I* wouldn't have guessed a 94 game did that ;)
[07:03:06] <Colourless> the frame has a signed value indicating the distance to move in the direction of the animation
[07:03:42] <ShadwChsr> Must have been a real pain for the developers to get that right :)
[07:03:52] <ShadwChsr> lots of tweaking of values by hand perhaps :P
[07:04:17] <Colourless> well, not really
[07:06:17] <-- ZutGu has left IRC (Read error: 104 (Connection reset by peer))
[07:06:33] <ShadwChsr> can you explain this? si->sxbot = (si->x - si->y)/4 - cam_sx;
[07:06:49] <ShadwChsr> It's obfusticated in the c++ coding style <grin>
[07:07:03] <ShadwChsr> j/k
[07:07:30] <ShadwChsr> not sure what the cam_sx is
[07:08:43] <Colourless> in the class
[07:09:14] <ShadwChsr> ahh probably camera ;)
[07:09:20] <ShadwChsr> Not sure why I didn't catch onto that until now :P
[07:10:26] <ShadwChsr> I think the main reason I was worried about using integers was the world to screen coordinate conversion and hitting overflows near the edges of large maps
[07:10:34] <ShadwChsr> but probably should have *checked* :P
[07:12:05] <ShadwChsr> How did you come up with the 4 and 8?
[07:14:04] <Colourless> um...we didn't *grin*
[07:14:15] <Colourless> someone else already figured that out
[07:14:27] <ShadwChsr> ;)
[07:14:54] <ShadwChsr> I'm debating switching over my coordinate system - is there anything you don't like about the way U8 does it?
[07:15:25] <ShadwChsr> I'm worried about performance when it comes to collision detection in larger maps - there was probably a good reason why UO uses the more simpler tile approach ;)
[07:19:25] <Colourless> for gross item culling with store all the items in glob sized blocks (512x512)
[07:20:26] <Colourless> if you are working with massive sized maps you may want to consider alternative methods of storage such as a bsp or quad tree
[07:20:52] <ShadwChsr> I never load the entire map on the client engine - just nearby blocks
[07:21:03] <ShadwChsr> My main concern is the server :P
[07:21:22] <ShadwChsr> I'm not making an *insanely* complex system, just something simple to walk around in.
[07:21:45] <ShadwChsr> But on a larger map even with a few users I could see the server collision detections getting out of hand very quickly
[07:22:22] <ShadwChsr> I could probably do some tricks though. I could keep some knowledge of a cell, even if coordinates are not tracked using them.
[07:22:46] <ShadwChsr> The map cells could then be flagged as "possibly blocked" if a collision bounding box overlaps it
[07:23:00] <ShadwChsr> That way the engine would know if it needed to do a more detailed check.
[07:23:20] <ShadwChsr> Sort of like how 3d engines check the AABB before they do more advanced collision detection
[07:23:32] <Colourless> we just do collision detection using AABB sweeps
[07:23:42] <Colourless> don't use blocked flags or anything
[07:23:48] * ShadwChsr nods
[07:23:56] <Colourless> things are treated mostly as if it was a modern 3d engine
[07:24:09] <Colourless> all int though
[07:25:31] * wjp yawns and waves
[07:26:28] <ShadwChsr> Hi :)
[07:26:52] <Colourless> GOOD MORNING WILLEM
[07:27:23] <wjp> brb, making some coffee :-)
[07:28:48] <-- jsch has left #pentagram ()
[07:34:05] <-- Sectus has left IRC ("Leaving")
[08:11:15] <ShadwChsr> Thanks Colourless :)
[08:11:26] <ShadwChsr> Changing the coordinate system gave me a 20+ FPS boost :)
[08:25:11] <Colourless> i'm surprised
[08:25:22] <Colourless> but float conversion can really suck
[08:28:54] <ShadwChsr> Well, we're talking about 10% the amount of code :)
[08:41:13] <ShadwChsr> nite!
[08:41:21] <wjp> night
[08:41:28] <ShadwChsr> thanks for all your help :)
[08:41:45] --> sbx|afk has joined #pentagram
[08:41:54] <-- ShadwChsr has left IRC (Read error: 54 (Connection reset by peer))
[08:43:25] --- sbx|afk is now known as sbx
[10:33:57] <-- Colourless has left IRC (Read error: 60 (Operation timed out))
[10:42:29] <-- Darke has left IRC (Read error: 60 (Operation timed out))
[11:07:07] --> Colourless has joined #Pentagram
[11:07:07] --- ChanServ gives channel operator status to Colourless
[11:07:32] <Colourless> yay for having to manually reset my router
[11:15:40] <-- sbx has left IRC (Read error: 60 (Operation timed out))
[11:25:09] --> ZutGu has joined #pentagram
[11:25:15] <ZutGu> hello
[11:42:21] <-- ZutGu has left IRC (Read error: 104 (Connection reset by peer))
[12:00:33] --> ZutGu has joined #pentagram
[12:17:38] <watt> hi all. That was a pretty interesting conversation over the night.. hmm... well shower time.
[12:27:56] --> ElleVeeDee has joined #pentagram
[12:30:07] --> Darke has joined #pentagram
[12:41:08] <watt> and off to work... hopefully, I won't be lazy when I get home.. I'll try to get something done for pentagram...
[12:41:13] <watt> bye
[12:46:48] <ElleVeeDee> ta taa
[13:03:25] * Sheng_Gradilla is back (gone 07:12:39)
[13:15:40] --> DarkeZzz has joined #pentagram
[13:34:51] <-- Darke has left IRC (Read error: 110 (Connection timed out))
[13:34:51] <-- ElleVeeDee has left IRC (Read error: 104 (Connection reset by peer))
[14:19:03] <-- Colourless has left IRC ("bbl")
[14:23:41] --> Colourless has joined #Pentagram
[14:23:41] --- ChanServ gives channel operator status to Colourless
[14:26:03] <-- Sheng_Gradilla has left IRC ("Terminando cliente")
[14:50:05] --> sbx|afk has joined #pentagram
[14:50:11] --- sbx|afk is now known as sbx
[15:00:56] <-- Kirben has left IRC ("System Meltdown")
[15:35:11] --> Sectus has joined #pentagram
[15:40:32] --> Fingolfin has joined #pentagram
[15:40:32] --- ChanServ gives channel operator status to Fingolfin
[17:22:24] --> toadsMoke has joined #pentagram
[17:23:05] <-- toadsMoke has left #pentagram ("Leaving")
[17:24:30] <sbx> hmm
[17:28:30] --> dwn has joined #pentagram
[17:30:48] <wjp> hmm?
[17:32:32] <sbx> mmhmm
[17:33:14] <wjp> mm
[17:33:54] <sbx> ho hum
[17:55:50] <-- Sectus has left IRC ("Leaving")
[18:02:23] <-- Colourless has left IRC ("casts improved invisibility")
[18:17:41] --> Sectus has joined #pentagram
[18:34:10] --- sbx is now known as sbx|afk
[20:43:50] <-- sbx|afk has left IRC (Read error: 104 (Connection reset by peer))
[21:17:10] <-- Sectus has left IRC ("Leaving")
[21:24:08] <-- ZutGu has left IRC ()
[21:28:07] --> ZutGu has joined #pentagram
[21:28:08] <ZutGu> back
[21:30:50] --- Fingolfin is now known as Endy
[21:30:57] --- Endy is now known as Fingolfin
[21:58:30] --> sbx has joined #pentagram
[21:58:47] --- sbx is now known as sbx|afk
[22:02:23] <-- sbx|afk has left IRC (Client Quit)
[22:29:20] <-- Fingolfin has left IRC ("42")
[22:42:28] <ZutGu> going to sleep, night
[22:42:31] <-- ZutGu has left IRC ()
[22:57:40] --> trin` has joined #pentagram
[23:11:55] <-- dwn has left IRC (Read error: 60 (Operation timed out))
[23:32:01] --> Sectus has joined #pentagram
[23:54:59] <-- trin` has left IRC ("You are heading for some face time with Mrs. Brick !")