You can get the project files at GitHub https://github.com/UnrealSoftware/cs2d-map-viewer
The source code is licensed under MIT so feel free to do with it whatever you want. Assets are excluded from this license!
The map viewer runs in browser but can also be compiled to native binaries for win/linux/mac (I only tested win). It has no UI yet and scrolling via mouse is still bugged (if you release outside the canvas the release isn't registered). You can also scroll with WASD and arrow keys and use shift/alt to modify speed. It also runs in mobile browsers but touch scrolling isn't implemented yet.
Try it here. It just loads de_dust2 by default
https://www.unrealsoftware.de/cs2d_map_viewer/
As you may note some things are not implemented yet. e.g. tile animations, tile blending or the entire light engine in general. See details about the state. Native resolution is currently fixed to 1920x1080. I'm using letter boxing to make it fill the screen as much as possible.
So far I'm quite happy with the size. The WASM build (engine, rendering, etc) is less than 700kb and could probably even be reduced a bit more. Some JS glue code is also required, that adds like 40kb on top. Macroquad can load assets directly from the webserver. I optimized this by simply putting everything into a single zip file which is downloaded and extracted to a virtual file system. I'm not very happy with the performance. Even with this basic rendering and without light engine it already drops in FPS on lower end devices, especially on mobile. There is still some room for optimizations though.
It also supports loading custom maps from the file archive. it's still a bit annoying though:
Find a custom map in the file archive
click download to go to the download page
copy the link on the download button, it should look something like 1
https://www.unrealsoftware.de/get.php?get=FOO&p=2&cid=BAR
open 1
https://www.unrealsoftware.de/cs2d_map_viewer/?file=FOO&cid=BAR
It then should load the first map file it finds in that zip and also use all the assets in that zip properly. Be aware that this is still very prone to errors. e.g., if the tileset is not included in the zip (or is one of the default tilesets), it won't work. The screen will stay black and the browser console will be spammed with errors. Also I did not include all default assets in the zip yet. So some sprites which are typcially included in CS2D might be missing on custom maps.
Why am I putting time into this?
I explain it in the GitHub readme:
Quote
- Previewing CS2D maps on the web is nice. Plan is to embed this into the CS2D file archive at www.unrealsoftware.de
- Providing an open source example for loading and rendering CS2D maps
- Evaluating a new tech stack and testing what works in browser and how well it performs
- Providing an open source example for loading and rendering CS2D maps
- Evaluating a new tech stack and testing what works in browser and how well it performs
edited 1×, last 20.05.26 08:02:26 pm
CS2D Map Viewer
1 
Offline