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

div-based renderer #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

div-based renderer #30

wants to merge 1 commit into from

Conversation

uzudil
Copy link
Contributor

@uzudil uzudil commented Apr 1, 2014

I made a div-based renderer that can display bitmaps + light color via an overlay. The main benefit I see in this is that it would also work on tablets that don't support webgl. I will make a webgl-based renderer also in another fork. Thanks for considering!

@ondras
Copy link
Owner

ondras commented Apr 2, 2014

Hi @uzudil,

I do not exactly see the point of having a DOM-based display backend. What is its purpose? <canvas> shall be faster and there are - AFAIK - no features that a div-based renderer can offer and <canvas> can not.

@uzudil
Copy link
Contributor Author

uzudil commented Apr 2, 2014

Hi,
I believe the current canvas renderer cannot apply the light color to graphical tiles. That is what I was trying to solve with the div-renderer. (Or maybe I'm wrong and it is possible somehow?)

@troygilbert
Copy link
Contributor

If you check out the open issues there's one where I submit some code for handling per-tile colors. It's not the fastest option, but it's the most general. It's not been merged in yet, but perhaps you can use it in your own code and dodge having to write a div-based renderer.

@uzudil
Copy link
Contributor Author

uzudil commented Apr 2, 2014

Thanks I will check that out. In my experience the 2d canvas pixel operations were very slow, esp. on mobile devices. The DOM approach while maybe not ideal from a code-cleanliness perspective work reasonably well in most browsers.

@ondras
Copy link
Owner

ondras commented Apr 2, 2014

@uzudil If the colorization/tinting is the issue, you should definitely check out @troygilbert 's code in #22. The pull request itself is not merged and forgetting about it is my fault. Not all issues relevant to that feature are resolved, though (the per-pixel vs. globalCompositeOperation, for instance).

Independently on how the colorization feature turns out in pullrequest #22, I strongly recommend modifying the existing Tile renderer, instead of introducing another one.

As far as the performance is concerned, I would be interested in some benchmarks showing how many DIVs outperform a single . That would be surprising (but not impossible in these strange times of varying JS/HTML perf across devices) for me.

@anissen anissen mentioned this pull request Apr 8, 2014
@jcubic
Copy link

jcubic commented Apr 8, 2014

I think that it would be nice to have more then one renderer and user will be able to pick one when he create a game. I personally will want to have html/text based renderer that will fit application that use jQuery Terminal. Also html based renderer will support copy (which will be like text based screenshot).

@ondras
Copy link
Owner

ondras commented Apr 8, 2014

@jcubic can you please fix the link to the jQuery Terminal? I truly see no actual benefit in rendering text via HTML means.

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

Successfully merging this pull request may close these issues.

4 participants