Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High resolution sprites in KeeperFX #431

Open
mefistotelis opened this issue Aug 18, 2015 · 53 comments
Open

High resolution sprites in KeeperFX #431

mefistotelis opened this issue Aug 18, 2015 · 53 comments

Comments

@mefistotelis
Copy link
Member

Originally reported on Google Code with ID 431

I installed Nightly 1481 and noticed that the health flowers above the creatures were
not showing correctly, it's like they are in low resolution compared to the rest of
the graphics. 

When going to the map view, the levels of creatures are unreadable, a level 10 creature
is recognizable from other levels but the rest looks almost the same now.

Changing the resolution in the settings menu doesn't make any difference. 

I've included a screenshot to show what I mean. 


Reported by Krizzie88 on 2014-11-27 12:40:48


- _Attachment: Creature levels not clear.png
![Creature levels not clear.png](https://storage.googleapis.com/google-code-attachments/keeperfx/issue-431/comment-0/Creature levels not clear.png)_
@mefistotelis
Copy link
Member Author

Yes, the size is a bit too small in 640x480; I will look into it.

Reported by mefistotelis on 2014-11-28 18:15:09

  • Status changed: Accepted

@mefistotelis
Copy link
Member Author

Done. Doubled the size.

Reported by mefistotelis on 2014-11-28 21:31:07

  • Status changed: Fixed
  • Labels added: Component-Video

@mefistotelis
Copy link
Member Author

The creature levels on the minimap are readable now, but now the room signs are messed
up now. (See screenshot)

Also the creature levels are still unreadable when you pick up creatures and hold them.
(See screenshot)


Reported by Krizzie88 on 2014-11-30 20:53:14


- _Attachment: [scr00003.bmp](https://storage.googleapis.com/google-code-attachments/keeperfx/issue-431/comment-3/scr00003.bmp)_ - _Attachment: [scr00004.bmp](https://storage.googleapis.com/google-code-attachments/keeperfx/issue-431/comment-3/scr00004.bmp)_

@mefistotelis
Copy link
Member Author

*Bump*

-Levels of creatures held by the hand of evil are still not readable. (See screenshot)

-Health flowers above creatures are still low res (Or not shown properly)

-Room icons on the minimap are still low res (or not shown properly)

Nightly 1513 was used

Reported by Krizzie88 on 2014-12-14 18:47:26


- _Attachment: [scr00005.bmp](https://storage.googleapis.com/google-code-attachments/keeperfx/issue-431/comment-4/scr00005.bmp)_

@mefistotelis
Copy link
Member Author

Only in 640x480 resolutions is this a problem by the way. In higher resolutions the
creature level is readable just fine.

Reported by Loobinex on 2014-12-17 11:44:50

@mefistotelis
Copy link
Member Author

Doesn't really matter what resolution is used.

at 640x480 it's unreadable at 1024x768 it is readable but still looks silly.. Also
the rest of the GUI and text looks more pixelated than usual. 

I've add two screenshots, one at 640x480 and one at 1024x768.

Is there scaling involved? Cause that might explain a lot. I believe the original game
ran at 640x400, so any other resolution would be scaled from that I guess?




Reported by Krizzie88 on 2014-12-17 16:43:17


- _Attachment: [640x480.bmp](https://storage.googleapis.com/google-code-attachments/keeperfx/issue-431/comment-6/640x480.bmp)_ - _Attachment: [1024x768.bmp](https://storage.googleapis.com/google-code-attachments/keeperfx/issue-431/comment-6/1024x768.bmp)_

@mefistotelis
Copy link
Member Author

Yes, this is due to scaling.

Reported by mefistotelis on 2014-12-19 15:52:28

  • Status changed: Started

@mefistotelis
Copy link
Member Author

But it wasn't present in 0.4.5 stock.. I noticed it when I started using the Nightly
Builds. 

Also non of the custom resolution work on my computer somehow. I can use the three
failsafe resolutions fine, but the rest doesn't seem to work.

My screen resolution is 1920x1200 which is 9 times bigger than the stock 640x400, so
that should scale/look fine, only it doesn't work when I select it..  1280x800 isn't
in the list which would be my second choice. 




Reported by Krizzie88 on 2014-12-19 16:33:30

@mefistotelis
Copy link
Member Author

I checked how the things in hand look and I'm not sure if we want to change anything.

The text is smaller than before, but it's readable, and keeping this scale factor makes
its size better in higher resolutions.

Same goes to room icons in map screen.

Reported by mefistotelis on 2014-12-19 17:08:54

  • Status changed: NeedInfo

@mefistotelis
Copy link
Member Author

You've seen the 1024x768 screenshot right?, the whole gui and texts look weird. The
only positive thing over 640x480 is that you can read the creature levels which are
held by the hand.. 


Reported by Krizzie88 on 2014-12-19 17:14:13

@mefistotelis
Copy link
Member Author

The game was made for 640x400 so the gui, text and sprites are based on that. if you
go to say 1024x768 then you will get problems with pixels not being square anymore.


pixel "x" in 640x400 

x

That same pixel "x" that was used in 640x400 would be made out of 4 pixels in 1280x800

xx
xx

No problems there.

In 1024x768 there's a problem. You cant have 1.92 pixel in hight and 1.6 pixel in width.

Good scaling tools will "fix"/hide that by making it a bit blurry but that's clearly
not the case here. 

Reported by Krizzie88 on 2014-12-19 17:24:31

@mefistotelis
Copy link
Member Author

KeeperFX uses simple "nearest neighbour" algorithm for scaling, and keeps aspect ratio
of all sprites unchanged. I'm not planning any changes to these rules.

Reported by mefistotelis on 2014-12-19 19:05:42

@mefistotelis
Copy link
Member Author

I wonder how the aspect ratio can be the same if you can't divide the pixels in to even
numbers. 

The 1024x768 screenshot shows how bad the scaling is if you compare it to 640x480.


And again, this wasn't a problem in the 0.4.5 release so what has changed that it looks
crap now? 

Reported by Krizzie88 on 2014-12-19 19:38:55

@mefistotelis
Copy link
Member Author

Please try nearest neighbour scaling in any graphics program, you will see how it works.
For code details, see LbSpriteDrawScaled() in bflib_vidraw.c within KeeperFX sources.

Interface scaling was introduced recently, it was not there in 0.4.5.

Reported by mefistotelis on 2014-12-19 20:40:17

@mefistotelis
Copy link
Member Author

For the original issue - I made a change today which decreases health flower scaling
by half. This should make the number on it visible even on max zoom out.

Reported by mefistotelis on 2014-12-19 22:21:56

@mefistotelis
Copy link
Member Author

I have no coding experience what so ever, I only report what I see on the screen. 

To be honest I don't think the "scaling" as it is now is working as it should, the
gui is clearly not made to be scaled yet. 

0.4.5 worked fine and looked fine, the only downside was that the gui would become
smaller when raising the resolution. But why raise the resolution if it doesn't matter.
The graphics don't get any better since the sprites are not in high resolution. You
only see more on the screen which looks smaller.. 

BTW, health flowers shouldn't change with zooming.

Reported by Krizzie88 on 2014-12-19 23:09:28

@mefistotelis
Copy link
Member Author

Yes, scaling health flowers is KeeperFX change.
All things drawn in KeeperFX are now scaled from original size, some to the screen
res only, others to zoom level.

For reasons of the path I've chosen, see this issue:
https://code.google.com/p/keeperfx/issues/detail?id=349

Reported by mefistotelis on 2014-12-20 09:38:03

@mefistotelis
Copy link
Member Author

I've installed nightly 1530 and creature levels held by the hand are now readable in
640x480!


Running the game at 1024x768 still gives an aliased gui and text, also the green/red
square lines to show on which tile you are going to dig/place stuff is missing. 

Reported by Krizzie88 on 2014-12-20 10:11:53

@mefistotelis
Copy link
Member Author

I'm not a big fan of the nearest neighbour scaling algoritm myself - I'd prefer bicubic,
but if no change to the scaling is planned, would you accept high resolution sprites
for the panel and health flowers?

If so, what would your specs be?

See attached image to see difference.

Reported by Loobinex on 2014-12-22 01:43:24


- _Attachment: highres.png
![highres.png](https://storage.googleapis.com/google-code-attachments/keeperfx/issue-431/comment-19/highres.png)_

@mefistotelis
Copy link
Member Author

Yes, the main reason behind the changes is to allow the use of high res sprites.

The new sprites should by multiplication in size of old ones, available in KeeperFX
GFX package.

Reported by mefistotelis on 2014-12-22 05:54:30

@mefistotelis
Copy link
Member Author

Did you just rescale the sprites or did you actually make them high res?

Reported by Krizzie88 on 2014-12-22 16:26:37

@mefistotelis
Copy link
Member Author

If you can't tell the difference then I did a great job. - No, I'm no artist and can't
do spritework. So just some bicubic rescaling and some anti-aliasing.

Reported by Loobinex on 2014-12-22 17:21:47

@mefistotelis
Copy link
Member Author

Oh, now I notice, I was looking at the whole picture..

You just did the Bile demon, Skeleton, Brick and healthflower. :P 

It looks a bit like the D3D version. Only that was more blurry. 

I'm curious to see how a full screenshot in high res looks! 

Reported by Krizzie88 on 2014-12-22 17:33:58

@mefistotelis
Copy link
Member Author

Mefistotelis, would this work for you? Both for quality and easy way of delivering/naming
files.
Also, right size, or too big?

At Kizzy: See screenshot.

Reported by Loobinex on 2014-12-23 01:11:55


- _Attachment: [GFX.zip](https://storage.googleapis.com/google-code-attachments/keeperfx/issue-431/comment-24/GFX.zip)_ - _Attachment: screenshot3.png
![screenshot3.png](https://storage.googleapis.com/google-code-attachments/keeperfx/issue-431/comment-24/screenshot3.png)_

@mefistotelis
Copy link
Member Author

Also, if high res sprites are allowed in KeeperFX, maybe we can implement my new full
panel i told some months ago:
http://keeperklan.com/threads/4752-Suggestion-modified-GUI-panel-example/page3?p=47911&viewfull=1#post47911

(also an option in options menu to toggle between classic/new panel)

Reported by a.ares.marin on 2014-12-23 07:03:35

@mefistotelis
Copy link
Member Author

Loobinex.

Yes, this way is good. I will need similar structure I already have in gfx data, ie.
the creatures you've provided should be in gui2-256/creatr_icon_256 folder.

Note you should probably make the greyed out sprites again by de-saturating and darkening
highlights in coloured ones. The algorithm you're using seem to handle coloured sprites
differently.

Reported by mefistotelis on 2014-12-23 13:33:54

@mefistotelis
Copy link
Member Author

Sorry for explaining you what you've already done for the folders, I haven't looked
at them closely enough. The folder structure and sizes you've proposed are ok.

Reported by mefistotelis on 2014-12-23 13:37:38

@mefistotelis
Copy link
Member Author

No problem. The last batch was done by hand,... but there are a bit too many sprites
for my liking, so I've automated it and it is running now. I need some way of delivering
the files - and my upload is 8kbs, so a FTP server would be nice.

I've added you to skype so you can let me know how you want it delivered.

I've looked over the original greyed out ones compared it to the resized ones, and
compared it to the non-greyed out ones, I see no problem,...

Reported by Loobinex on 2014-12-24 00:16:43

@mefistotelis
Copy link
Member Author

The difference isn't that big and is visible mostly in eyes shape; we can ignore it.
Maybe later I'll try to make a script which would process coloured images into greyed
out ones automatically.

Reported by mefistotelis on 2014-12-24 11:56:32

@mefistotelis
Copy link
Member Author

The manual ones I did with xBRZ, but I could not find a command line tool for that.
I could for xBR so I did them all with that, so the final result is a bit different
from what I showed you.

Reported by Loobinex on 2014-12-24 12:27:12

@mefistotelis
Copy link
Member Author

btw, the original DAT/TAB format supports only images up to 255x255; if we'll introduce
larger ones, I'll have to introduce a new file format for them.

Reported by mefistotelis on 2014-12-25 16:48:11

@mefistotelis
Copy link
Member Author

The largest images are the swipes, now 1180x788.

Reported by Loobinex on 2014-12-25 18:13:22

@mefistotelis
Copy link
Member Author

If you'll look at TXT files used to generate DAT/TABs from the swipes, you'll notice
that images are cut into parts of size (originally) 128x128.

Also, I don't think swipes are important; I'd focus on the GUI files first.
And then fonts.


Reported by listom on 2014-12-30 23:26:28

@mefistotelis
Copy link
Member Author

I see your commend on the closed issue# 11, do you still want the resized sprites?

Reported by Loobinex on 2015-03-26 17:45:56

@mefistotelis
Copy link
Member Author

Yes.

It may take a while before they can be used in game, but I need to have a set of resized
sprites to continue working on them.

Reported by mefistotelis on 2015-03-26 18:34:06

@mefistotelis
Copy link
Member Author

Yes, I have it ready. If you have an ftp environment I can upload it.

Reported by Loobinex on 2015-03-26 18:59:40

@mefistotelis
Copy link
Member Author

Please use Mega or similar file sharing service.

Reported by mefistotelis on 2015-04-03 07:51:17

@mefistotelis
Copy link
Member Author

Here is everything except the sprites:
https://mega.co.nz/#!JFQSlABT!2EWwEQ7q9Dba27Fxg70JtegUEwg1HwgnXRQtUjlwf9g

I'll try to upload those sprites another time (I have to use FTP to slowly upload it
to a server with proper internet, teamview to the server, and upload to mega from there).

Reported by Loobinex on 2015-04-05 22:59:28

@mefistotelis
Copy link
Member Author

Here are the sprites. That should be all. Please let me know if something is not right
or more can be done.

https://mega.co.nz/#!5NQgAYoS!i_NFrXiZqOuqsCpmYcwFmhqknpRpwQEkw64YnuJONpM

Reported by Loobinex on 2015-04-09 17:00:48

  • Status changed: Accepted
  • Labels added: Type-Enhancement
  • Labels removed: Type-Defect

@mefistotelis
Copy link
Member Author

Thank you, that should be enough.

Now we have to modify sprites file format, so that the new sprites can be used.
I will try to enable it just before next release, so that we won't have problems with
nightly builds not accepting the old files from full version.

Also, I've noticed some functions using the current sprite format are still not rewritten
- I will have to take care of them first.

Reported by mefistotelis on 2015-04-09 17:14:28

@mefistotelis
Copy link
Member Author

I think high res sprites by itself would by itself almost warrent a new release.
But if it is possible I do think a proper testing period is useful in high resolution.

Reported by Loobinex on 2015-04-09 18:08:33

@mefistotelis
Copy link
Member Author

wow, can't wait to see upgraded graphics.

Is it possible to make at least dungeon heart really 3D? I know the engine doesn't
seems to be rendering anything more complex than box...

Reported by HeMeng86 on 2015-04-10 15:29:47

@mefistotelis
Copy link
Member Author

I am curious about how do you upgrade the dat/tab file? Have you made some tool? Is
it possible to make the dat/tab extensible for future(for example when some one built
3D models and rendered 32 angle of creatures)?

Reported by HeMeng86 on 2015-04-10 15:35:39

@mefistotelis
Copy link
Member Author

Would you really want a game with all sprites and just a single 3d model? How would
that not look out of place? At the very least you need a very high poly model to look
equal in quality to sprite graphics.

And I'd say you'd get the worst of both worlds,... sprite graphics are a lot cheaper
to make really pretty if you just have the one viewpoint, but need to be recreated
for each additional viewpoint. A 3D model is expensive to make once, but allows you
to view it at any distance or angle. In general the 3D model will look worse, which
you'd have to compensate with textures and lighting and AA and other effects to make
it look real good.
When you have both you're still limited to the few view angles of the sprites, and
you'd either get the ugliness of the 3D model or the high up front expense of making
the sprite look pretty.

----------------

If you'd want to see how the game would look with the improved graphics, take a look
at the 'screenshot' posted on Dec 22, 2014

Reported by Loobinex on 2015-04-10 22:11:56

@mefistotelis
Copy link
Member Author

I was just curious about the possiblity for the game engine to render objects more complexed
than boxes like dungeon heart, or how expensive it is to make it possible. 

Using 3D model will give us most possibility for improving graphics in future, but
probably it will be as expensive as making Dungeon Keeper 3... 

Reported by HeMeng86 on 2015-04-11 15:46:01

@mefistotelis
Copy link
Member Author

I don't think such changes in graphics is a good idea. I want KeeperFX to use the same
graphics style as original game.

But I think it would be good to make the software rendering "detachable" - somehow
unify the interface, so that someone could start making better graphics as a separate
effort.

To answer your original question - yes, it is possible. The same rendering engine was
used in Populous 3 - in that game you can find animated 3D objects of various shapes.
It is possible to make a wrapper on the triangle rendering level and allow the engine
to render any model.

Reported by mefistotelis on 2015-04-11 19:12:57

@mefistotelis
Copy link
Member Author

Any idea when the high res textures can be used in game? 

Reported by Krizzie88 on 2015-04-18 07:22:12

@mefistotelis
Copy link
Member Author

No, we don't have any ETA.

Sprite file format will be changed to allow higher res sprites just before a release,
possibly the next one. Then it will be possible to prepare the new sprites.

So it is likely the version which has it working will be two releases after 0.4.6.

Reported by mefistotelis on 2015-04-18 16:01:54

@mefistotelis
Copy link
Member Author

Can we support alpha channel in sprites? I think that will be very cool.

Reported by HeMeng86 on 2015-04-19 15:15:44

@mefistotelis
Copy link
Member Author

Currently there is alpha channel is sprite file format, it's just 1-bit (either a pixel
is transparent or not).

Introducing a more complex alpha channel would require changing the sprite file format.

I don't think 8-bit channel is needed, but something more than simple 0/1 might be
a good idea.

Reported by mefistotelis on 2015-04-19 21:59:03

@mefistotelis
Copy link
Member Author

This is a reminder for me or other programmer who will work on the rewriting.

List of functions which needs to be rewritten (with all references to them) before
it is possible to use new sprites:
add_gold_to_hoarde
change_effect_element_into_another
create_creature
create_dead_creature
create_effect_element
create_object
create_shot
create_trap
creature_add_lair_to_room
creature_change_from_chicken
creature_change_to_chicken
display_drawlist
display_fast_drawlist
draw_fastview_mapwho
draw_iso_only_fastview_mapwho
draw_jonty_mapwho
dump_held_things_on_map
food_moves
get_lifespan_of_animation
object_update_call_to_arms
object_update_object_scale
pinstfe_hand_grab
place_thing_in_power_hand
process_object_being_picked_up
process_spells_affected_by_effect_elements
remove_gold_from_hoarde
set_call_to_arms_as_birthing
set_call_to_arms_as_dying
set_call_to_arms_as_rebirthing
set_creature_graphic
set_creature_instance
set_engine_view
set_power_hand_graphic
set_sprite_view_3d
set_sprite_view_isometric
set_thing_draw
update_creature
update_dead_creature
update_effect_element

Reported by mefistotelis on 2015-05-03 12:11:21

@mefistotelis
Copy link
Member Author

It's a pity I never finished that.

  • There is a lot of higher-quality PNG images in "gfx_sources" pack; some are improved by artists, other are just original PNGs rescaled with HQx4 pixel art scaling filter (if any artist would like to contribute, the gfx sources is the place to look at)
  • The tools which convert PNG to DAT have definitions of the V2 sprites, and can create these formats even without recompilation
  • Within KeeperFX itself, higher resolution sprites and textures support is also partially implemented, under SPRITE_FORMAT_V2 define ( add "-DSPRITE_FORMAT_V2" to CFLAGS in order to build a binary which requires new sprites)

So preparations were done on all stages, only references to some of the above mentioned functions were not rewritten, and this is what still blocks the switch.
(if non-rewritten function receives reference to sprite V2 instead of old one, it will most likely skip drawing the sprite, but it might also draw garbage or even crash)

@Loobinex
Copy link
Member

Hopefully somebody will finish it sometime. And if not, I consider this project your baby and you'll be always welcome here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants