Super High Resolution

This forum is for the Lua scriptable clone of DM/CSB called Dungeon Strikes Back by Sophia. Use DSB to build your own highly customised games.

Moderator: Sophia

Forum rules
Please read the Forum rules and policies before posting.
Post Reply
User avatar
Gambit37
Should eat more pies
Posts: 13720
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Post by Gambit37 »

Sophia wrote:DSB just plain doesn't support any resolution greater than 640x480, and it's not just lack of graphics-- that's one limitation, sure, but I'd have to rewrite all of the rendering code, clickzone handlers, and so on, and I'm not exactly excited at the prospect.
I think both DSB and RTC are pure awesomeness and great at what they do but my only real complaint with both is lack of support for higher resolutions.

It would be super awesome if one, either or both could support higher resolutions with UNSCALED graphics, that is: actually allow us to build a dungeon with images designed for say 800x600 or 1280x960. Memory considerations would go up considerably, but it would be really, really cool to play a proper DM style game with step movement that has super detailed and sharp graphics. 640x480 isn't bad, but after playing around with monsters and the like in RTC for some time, it's still not easy to get great detail in there at that resolution.

Anyway, sorry, going off topic! oops
Sophia wrote:and in the meantime it'll be good to be able to get them to play with yourself.
I read this completely wrong... :shock: :)
User avatar
Parallax
DMwiki contributor
Posts: 424
Joined: Mon Aug 28, 2006 7:56 pm
Location: Back in New Jersey

Post by Parallax »

On the other hand, very high resolution is not all rosy either. Some of the things that you can get away with at low res. may just not fly at hi res.

- Tiling: The graphics on consecutive tiles need to mesh perfectly with one another. This is a problem for wallsets if they are modified after generating them as there is no guarantee of a smooth transition unless the consecutive bitmaps are treated together. Unfortunately, even that is not possible because most bitmaps' edges must match two other bitmaps, not just one. For instance, take a 'pers'-type bitmap, say pers1. Its far end must mesh with the next pers bitmap along the perspective, which should be pers2_alt, if there is a hallway, but with the front bitmap (front1? front2?) if there is a corner. Wait, is that the mirror image of that front bitmap, instead? I can't remember.
One possible solution might be to make some or all bitmaps slightly oversized with alpha-channel edges, but that might look good either.

- Thickness: When a door with a vertical crack opens, the two halves should be seen in perspective, meaning the thickness of the door should be apparent. In low res. it does not matter as it's not quite clear where the edge of the door is, and the animation doesn't last long enough to let the user dwell on it. I'm afraid that, with very high resolution doors, the two halves of an opening door will clearly appear as paper-thin. Solutions for fixing this are... well, complex.

- Blending: Wallitems, even default DM wallitems, merge relatively well with custom wallsets in most instances, at low res. How well will that work in high res.? I think alpha channel for shading, at the very least, will be necessary, but it may be the end of general-purpose wallitems altogether.

Linflas, Gambit, Cows and others with actual talent for custom graphics can probably provide more educated answers for these concerns than I can, but right now these are my main worries when it comes to increasing resolution.
User avatar
Gambit37
Should eat more pies
Posts: 13720
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Post by Gambit37 »

All very valid points on which I have a few thoughts:
Parallax wrote:- Tiling: The graphics on consecutive tiles need to mesh perfectly with one another. This is a problem for wallsets if they are modified after generating them as there is no guarantee of a smooth transition unless the consecutive bitmaps are treated together.
This is *very* difficult to do well for exactly the reasons you specify, but it *is* possible to create the necessary seamless edges in two different positions if you're very clever. Personally I haven't managed to do a good job of it yet, which is why I've never released any hi-res wall sets, but Cows did some good work there:

http://www.dungeon-master.com/forum/vie ... hp?t=25753

The 'oversized' approach you mention is probably the best way of doing it and you get the benefit that your wall edges aren't all pixel sharp/straight which adds to the realism. I did a quick experiment with that a couple of years ago but made a mess of it. However, once I've got DM codex a bit more in shape, I'm going to have another look at this issue because I need it for my own dungeon I'm working on.
Parallax wrote:- Thickness: When a door with a vertical crack opens, the two halves should be seen in perspective, meaning the thickness of the door should be apparent... I'm afraid that, with very high resolution doors, the two halves of an opening door will clearly appear as paper-thin. Solutions for fixing this are... well, complex.
Indeed! Very tricky.

The only way I could see this being fixed is to create four images and foor doors that all operate at the same time. Two images are simply the left side and right side of the door. The other two are just sliver image of the 'depth' of the door and are offset to appear next to the edge of the straight door image. With careful layering (ie, the slivers are rendered behind the actual door images), you could fudge the effect. Not totally convincing, but it would probably be good enough.
Parallax wrote:- Blending: Wallitems, even default DM wallitems, merge relatively well with custom wallsets in most instances, at low res. How well will that work in high res.?
Personally, this doesn't concern me. If you're of the mind to create high-quality wallsets, you're not going to be concerned about how they merge with low quality default stuff because you'll be replacing all that with hi-res stuff too.

I'll split this discussion off to a new thread as iit's off topic, but should it go in DSB forum or somewhere more generic as it applies to RTC too?
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Post by Sophia »

Gambit37 wrote:The only way I could see this being fixed is to create four images and foor doors that all operate at the same time. Two images are simply the left side and right side of the door. The other two are just sliver image of the 'depth' of the door and are offset to appear next to the edge of the straight door image. With careful layering (ie, the slivers are rendered behind the actual door images), you could fudge the effect.
I'd set up a more complicated door triggering mechanism, where each set of doors require an instance of some sort of "door trigger" object to control them. It's not as troublesome as it sounds, because I'm sure spawn_door can be hacked so this is transparent in DDM or in the Lua file. Then, I'd dsb_qswap the associated door from a door with a "closed" image to a door with an "opening" image as needed. The upside is that the dungeon mechanics are cleaner and you only need one door. The downside is that it takes a fair bit of Lua coding. (adding the associated downside that this fix is DSB-only)

Anyway, as if the previous concerns aren't enough, I'll throw in my own thoughts--

On the topic of doors, I have a sinking feeling the rather "clunky" animation used by DSB (and RTC) for an opening door just won't fly. You know what I mean, clank clank clank and it goes up in large steps. It looks fine with the original DM graphics (or lo-res custom graphics), because it gives that authentic DM feel. However, even in a highly detailed 640x480 dungeon, it would start to look a little, shall we say, dated.

Right now, DSB's Lua functions expect a 640x480 screen. All coordinates pertaining to drawing, clickzones and the like expect one. If the resolution is increased, suddenly all that code breaks. Granted, you'd probably to write new code to support some of the new features of a high resolution dungeon anyway, but I'm sure at least some of the base code would still be usable. The quick, but not necessarily good, solution (and I don't particularly like it) would be to just define "virtual pixels" and let DSB assume it's on a 640x480 screen regardless of the actual screen size. If you're running at 1280x960, this isn't too bad; your main problem is that you lose very fine control over where things are positioned. However, if you're running at something like 800x600, where there's no integer ratio between a real pixel and a "virtual pixel," precise positioning would become more or less a game of chance.

Running at extreme resolution might be slow. This could be anywhere from "kinda" slow to "really really" slow, but pushing that many pixels using software rendering is not going to be very quick. DSB's backend is software rendering via DirectX 7, and though I do use a triple buffer and a few other optimizations, modern video cards are optimized for 3D and will be very little help in these modes. An increasing number of games, even though they're in 2D, will use OpenGL to draw their screens. It's typically much faster and smoother than using software rendering, and you get scaling, blending, rotation and smoothing "for free." This would be the eventual solution, but making this conversion is a rather monumental task in itself.
Gambit37 wrote:I'll split this discussion off to a new thread as iit's off topic, but should it go in DSB forum or somewhere more generic as it applies to RTC too?
I left it here because I wouldn't know where to move it if we wanted to move it. There is no generic "clone development" forum, except for the "Other Clones," but it seemed silly to have a post in there that applies to clones that have their own forums. I also added some DSB-specific stuff, so I think it's ok here.

Or, hey, let's just make it global announcement and have it show up on every forum. :P :roll: :wink:
User avatar
linflas
My other avatar is gay
Posts: 2445
Joined: Tue Nov 04, 2003 9:58 pm
Location: Lille, France
Contact:

Post by linflas »

ahhh... playing a super high res dungeon crawler is actually something i've dreamt about for years...

if i was RTC or DSB coder and wanted to implement higher res, i would deny to use intermediate resolutions such as 800 or 1024 and only allow 320/640/1280 as a flag in global variables, so that i would only have to double/quadruple values (or divide them by 2 if the dungeon has been made in 1280 and is displayed in 640 for example, but who would be interested in that ???).

anyways, i would probably restart FoD from scratch if 1280 resolution was possible in either clone btw and it would be easier i think. i start from very high res photos mostly and use photoshop bicubic sharp resize, but it's still too smooth in 640 and i must pencil with the brush a lot to obtain a neat render.
User avatar
Gambit37
Should eat more pies
Posts: 13720
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Post by Gambit37 »

Sophia wrote:I'd set up a more complicated door triggering mechanism, where each set of doors require an instance of some sort of "door trigger" object to control them. It's not as troublesome as it sounds, because I'm sure spawn_door can be hacked so this is transparent in DDM or in the Lua file. Then, I'd dsb_qswap the associated door from a door with a "closed" image to a door with an "opening" image as needed.
Ah, right, I was thinking in terms of RTC as I haven't really played with DSB much. I wonder if your technique is somehow applicable to RTC... I wish there were more hours in the day, so much to experiment with, so little time....
Sophia wrote:On the topic of doors, I have a sinking feeling the rather "clunky" animation used by DSB (and RTC) for an opening door just won't fly.
I have some 640x480 stuff in RTC and the door animation is just about OK, but yes, a smoother animation would be welcome, and probably required for super-hi-res.
Sophia wrote:DSB's Lua functions expect a 640x480 screen...If the resolution is increased...the quick, but not necessarily good, solution would be to just define "virtual pixels" and let DSB assume it's on a 640x480 screen regardless of the actual screen size.
Probably an acceptable compromise if you were seriously considering implementing the possibility of higher resolutions.
Sophia wrote:If you're running at 1280x960, this isn't too bad; your main problem is that you lose very fine control over where things are positioned.
Ah, yes, this could be a bit of a pain indeed.
Sophia wrote:However, if you're running at something like 800x600, where there's no integer ratio between a real pixel and a "virtual pixel," precise positioning would become more or less a game of chance.
Yes, this would be a big issue. How would one limit that -- by restricting the resolutions the game can be played at? Would that not piss people off just as much as the current situation? In RTC for example, I find it quite annoying that it supports higher resolutions but doesn't actually take advantage of them -- might as well not bother really.
Sophia wrote:pushing that many pixels using software rendering is not going to be very quick... An increasing number of games, even though they're in 2D, will use OpenGL to draw their screens.
I'm quite interested in that -- could you give me some examples?
Sophia wrote:It's typically much faster and smoother than using software rendering, and you get scaling, blending, rotation and smoothing "for free." This would be the eventual solution, but making this conversion is a rather monumental task in itself.
So, we could use 3D tech to speedily render 2D imagery that was hand drawn to simulate a 3D view? Am I the only one to find this amusing? :)
Sophia wrote:There is no generic "clone development" forum, except for the "Other Clones," but it seemed silly to have a post in there that applies to clones that have their own forums.
No worries, makes sense.
User avatar
zoom
Grand Master
Posts: 1819
Joined: Tue Sep 23, 2003 1:27 am
Location: far away but close enough

Post by zoom »

My monitor is widescreen.

Seems to work fine with clickable spots
.....................................................
I cannot really imagine how a high res dungeon
crawler would look like. I'd like to see some
screenshots :shock:

I have played wizardry 123 NES remake and
it had nice graphics, which was pleasing.
The oldfashioned movement did not destroy
the immersion for me.

I probably vote for high res imagery.

However, the clank clank clank and
movement of monsters
gives the game the unique feeling it got.

It's like a clockwork.you can react to it.

just read Gambit's response.
imho,
the clank clank steps should still be noticeable,
but maybe with a smoother animation in between,
stopping at each clank for a short time.

And there should be a way for us to
tweak the images to fit in high resolution mode,
by posting about it?!
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Post by Sophia »

Gambit37 wrote:I wonder if your technique is somehow applicable to RTC
As far as I know, after a door in RTC has been subject to a SWAP action, triggers targeting it will no longer work. This is certainly how it worked when I made Dark Portal, though I haven't kept up with it since then. Perhaps you could get around this limitation by using a SWAP_FAST, but there is currently no "FAST" swap that affects only the local area. DSB's dsb_swap will preserve an object's id number (so triggers targeting it will still work), but it will obliterate any internal properties, as it effectively destroys the instance and creates a new one with the same id number-- that's why I used dsb_qswap.
Gambit37 wrote:Yes, this would be a big issue. How would one limit that -- by restricting the resolutions the game can be played at? Would that not piss people off just as much as the current situation?
Well, there'd always have to be limits, it's just a question of getting limits that everyone can live within. Right now, the limits for DSB (and RTC) are rather firm: One resolution. Even this isn't horrible, but as this thread has mentioned, supporting other resolutions would be a step up-- but how many others? The simplest answer is to only support resolutions that are integer multiples of 640x480, but that's probably only one more (1280x960), but is that enough? Does anyone want to play at 800x600? Will there be dungeons that actually support it?

I suppose an associated question would be: does the dungeon designer or the user assert the resolution? I was working under the assumption that a 1280x960 (or whatever) dungeon would force the game into 1280x960 resolution, and that's that; forcibly scaling the graphics up or down if the player chooses a resolution different from the dungeon's "native" resolution would be yet another layer of complexity.
Gambit37 wrote:could you give me some examples?
I'm not sure if I can name too many games, since there haven't been too many high-profile 2D games on the PC in general (that aren't Flash-based or something, I mean), but lots of indies and small coders use hardware accelerated 2D in their 2D games. The Linux Game Tome is full of 2D OpenGL games. :) Of course, the best example from the non-game arena might be Windows Vista itself, drawing the desktop in Direct3D all the time. Java now uses (or will use, I'm not sure how far along it is) OpenGL for its 2D backend, too.
Gambit37 wrote:So, we could use 3D tech to speedily render 2D imagery that was hand drawn to simulate a 3D view? Am I the only one to find this amusing?
Definitely not :D
User avatar
Parallax
DMwiki contributor
Posts: 424
Joined: Mon Aug 28, 2006 7:56 pm
Location: Back in New Jersey

Post by Parallax »

Gambit wrote: Personally, this doesn't concern me. If you're of the mind to create high-quality wallsets, you're not going to be concerned about how they merge with low quality default stuff because you'll be replacing all that with hi-res stuff too.
Actually, I was talking about the transferability of hires wallitems across hires wallsets. One of the underlying problem with having more detail is that defects become more visible.

In 320x240 the dungeon walls, although flat, look rugged and rough. If you increase the resolution 16 times to 1280x960 but do not account for unevenness between bricks, and the depression of the mortar, you end up with dungeon walls that look like painted glass. Similarly, Conflux shows that a ring or switch that was made for the DM wallset works (visually) on most of the other custom wallsets. I doubt this will hold for hires wallitems on hires wallsets without some effort and transparency effects.
User avatar
Gambit37
Should eat more pies
Posts: 13720
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Post by Gambit37 »

Right, OK, I misunderstood.

Using PNG with alpha-channels can go a long way to alleviating that, but it does mean the files can be quite large -- a LOT larger than an 8-bit optimized version without an alpha channel for example.

As always, it's about trade-offs I guess.
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Post by Sophia »

Gambit37 wrote:Using PNG with alpha-channels can go a long way to alleviating that, but it does mean the files can be quite large
Unfortunately, doing this will also worsen any performance problems that super high res introduces. Drawing bitmaps with alpha channels in software rendering mode is slow. It's not in general unacceptably slow, of course, but the more bitmaps there are and the more pixels to push, in general, the slower it gets.
User avatar
Parallax
DMwiki contributor
Posts: 424
Joined: Mon Aug 28, 2006 7:56 pm
Location: Back in New Jersey

Post by Parallax »

Do I have delusions about the capabilities of today's (or even yesterday's) computers? I would have thought that drawing a few hundred bitmaps, even with alpha transparency and other concerns, wouldn't take enough time to be a concern at this point. Of course that's because I am under the impression that drawing one pixel takes roughly as much effort as drawing thousands, if you know exactly what needs to be drawn (one bitmap that's already stored in memory), and that rendering concerns only emerged when every pixel had to be computed for line-of-sight, mapping, texturing, lighting, shading, blooming and God knows what else they put in games these days. Am I really that naive? What framerate are we talking about here?
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Post by Sophia »

Parallax wrote:Do I have delusions about the capabilities of today's (or even yesterday's) computers?
Maybe? ;)

The problem is that most of today's (and yesterday's) computers get their sophisticated graphics capabilities due to heavy amounts of hardware acceleration, but that kind of stuff applies mostly to Direct3D and OpenGL. The amount of hardware acceleration for normal DirectDraw 2D rendering (like DSB and RTC use) is quite limited.

Blending, in particular, is slow, because there's no alpha channel information in a basic 2D blit. Instead, you have to read the color value at the destination pixel, blend it manually with the sprite in memory, and then plot the new pixel. In addition, all of these calculations must be done in main RAM, because reading from VRAM (video RAM) is so horribly slow as to not even be worth bothering. As a result, DSB only draws directly into VRAM when there's no blending whatsoever that needs to be done-- otherwise, all rendering is done onto a memory bitmap, and then the whole thing is blitted into VRAM at the end. This method is pretty much old-fashioned double buffering and was very common when there wasn't much VRAM, but has drawbacks nowadays.

When using OpenGL or Direct3D, the process is much different. Most of the work happens on the video card: your texture is stored in VRAM, and the alpha channel is stored with it. You just simply say "draw this texture here, with alpha," and all of the blending and whatnot is handled by the GPU. There's no passing things from main memory to VRAM (except to initially upload the texture), and after sending the initial command to draw the texture, your CPU can go onto other things. This is the big speed boost that modern computers offer.

It is a boost that DSB cannot take advantage of, unfortunately, because it's not implement with the OpenGL API. Moving to OpenGL is something I would like to do in theory, but in practice there are some significant obstacles. DSB does a lot of weird manipulation of bitmaps in memory that I'm not sure how to duplicate using OpenGL.
User avatar
Adamo
Italodance spammer
Posts: 1534
Joined: Fri Apr 22, 2005 11:59 am
Location: Poland
Contact:

Re: Super High Resolution

Post by Adamo »

DSB just plain doesn't support any resolution greater than 640x480, and it's not just lack of graphics-- that's one limitation, sure, but I'd have to rewrite all of the rendering code, clickzone handlers, and so on, and I'm not exactly excited at the prospect.
What about redesigning the rendering code in DM2 way, so that there were 4 steps - instead of 3 like in DM1/CSB - visible on the screen? Is it possible in DSB?

Here`s all what I found in DM2:
Image
Spoiler
(\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/)
Spoiler
(@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@)
Spoiler
(>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<)
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Super High Resolution

Post by Sophia »

Adamo wrote:What about redesigning the rendering code in DM2 way, so that there were 4 steps - instead of 3 like in DM1/CSB - visible on the screen? Is it possible in DSB?
It's possible. I'm not sure if it's all that desirable, though, nor would it be particularly easy.

The perspective used in DM2 isn't quite the same as the one used in DSB-- or in CSBwin, or RTC after 0.35, actually-- you can tell by the length of the "far side wall." In DM2, and in 3.x versions of the DM engine, objects are actually stretched onto this wall and it's viewed from a slightly different perspective. In DM 2.x, and DSB, this wall is shorter and darker, and doesn't have any objects drawn along it. The different angle makes adding a fourth view distance rather difficult because this wall is the one that would connect to walls drawn 4 squares out, and it fades to black, so it would have to be redrawn as well... or I'd have to switch to the DM 3.x wallset, which nobody seems to like because it's not actually "perspective correct" like the 2.x one. Having already switched main wallsets twice, I am not excited about making more changes, either. :D
User avatar
Gambit37
Should eat more pies
Posts: 13720
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Super High Resolution

Post by Gambit37 »

I'm pretty sure that DM2 (despite what that template shows) still doesn't do anything interesting on the fourth tile. No extra side views for wallitems and no extra far views for floor items. I'll need to re-install it and fire up dosbox to check though.

EDIT: Interesting, looking at the image resources, there is indeed a very dark fourth wall -- would still need to check in game though to see if it's actually displayed.
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Super High Resolution

Post by Sophia »

I checked. It is actually displayed, though it's rather dark and if you're not looking for it you'd be excused for missing it. I'm not sure how much it adds.
User avatar
Gambit37
Should eat more pies
Posts: 13720
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Super High Resolution

Post by Gambit37 »

Are wallitems rendered on it? What about monsters and floor items at that distance?
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Super High Resolution

Post by Sophia »

Yes, wall items, monsters and floor items as well. It seems like the DM2 engine draws everything one more square out than DM1.
User avatar
Gambit37
Should eat more pies
Posts: 13720
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Super High Resolution

Post by Gambit37 »

Interesting, I'd never noticed that! OK, you gonna have to update DSB now! ;)
Post Reply