|
ForumsSega Master System / Mark III / Game GearSG-1000 / SC-3000 / SF-7000 / OMV |
Home - Forums - Games - Scans - Maps - Cheats - Credits Music - Videos - Development - Hacks - Translations - Homebrew |
Goto page 1, 2, 3 Next |
Author | Message |
---|---|
|
General Scroll Library (GSLib)
Posted: Tue Sep 12, 2017 4:58 am Last edited by psidum on Sun Dec 03, 2017 10:22 am; edited 12 times in total |
GSLib Updated to v1.0
- Fixed bugs. - Removed Dependancy on Generated LUTs. - Significantly reduced RAM requirements (now 263 bytes). - C implementation now available as well as C example project. - Updates to UGT parsing tool for metatiles and scrolltables (still a little raw, requires java 8.0 or higher). GSLib is a library was written to provide large map scroll functionality for games / demos. Features include... - 16x16 pixel metatiles. - 8 way scrolling. - lookups to identify metatile at given x,y coodinate. - lookups to identify nametable entry at given x,y coodinate. - ability to update sections of currently displayed screen for interactivity (rings, coins, etc). You can find the project here: https://bitbucket.org/Psidum/gslib/overview Attached is interactive example of GSLib to play with source included. Can you find the dungeon entrance??? Many thanks to the usual suspects, special thanks to Sverx and Calindro for support with C implementation. Psidum. |
|
|
Posted: Tue Sep 12, 2017 8:10 am |
wow! nice idea! I'll take a look at it when I have some hours to play with! | |
|
Posted: Tue Sep 12, 2017 8:44 am |
why not? Also, is the library supporting smooth scroll? |
|
|
Posted: Tue Sep 12, 2017 9:30 am Last edited by psidum on Tue Sep 12, 2017 10:50 pm; edited 1 time in total |
Reasons I found Tiled app not a good fit...
- it is not possible to attach attributes to a tile use reference (array of tiles references forming map). * not possible to mark nametable entry as priority set (in front) * not able to add metadata using the unused 3 most significant bits in nametable entry. - need to use additional layers to add meta information and its quite hard to do this in a generic fashion. - need external tools for ordering tiles / metatiles for jumpt tables etc. It supports scrolling of 1-8 pixels per axis. It sometimes looks jerky on emulators due to differences in monitor refresh rate but looks fine on real hardware and tv. |
|
|
Posted: Tue Sep 12, 2017 10:01 am Last edited by sverx on Tue May 29, 2018 11:23 am; edited 1 time in total |
as for the priority, you could have two layers and place tiles on either one or the other, merging them later with a separate tool or possibly at run time (which is what I did in my Anguna abandoned port...)
BTW the Mojon Twins should have some tools, hopefully they might share them with us... |
|
|
Posted: Tue Sep 12, 2017 10:09 am |
LOL i had to limit the speed to 8 pixels per frame too, the repaint of a 8 pixels row or column in a frame is near from limit if you want to do something more... but it could be useful a mappy->csv->bin converter which i use for my own tilemap lib | |
|
Posted: Tue Sep 12, 2017 1:40 pm |
check out fmp2gba, it can create .c sources from mappy files. |
|
|
Posted: Tue Sep 12, 2017 10:39 pm |
Good idea! One less technical detail to worry about. ;) | |
|
Posted: Wed Sep 13, 2017 7:44 am |
Psidum, will you upload the library to github or other platforms? it would be useful for sharing the code.
BTW, a c fronted to be used from SDCC should be quite straightforward, shouldn't it? |
|
|
Posted: Wed Sep 13, 2017 9:05 am Last edited by psidum on Sun Oct 01, 2017 11:26 am; edited 1 time in total |
Made Git project public https://bitbucket.org/Psidum/gslib
In example folder you can find an example z80 project displaying how the engine works. - In main.asm, look for InitializeSMS to see how calls are made. - In the resources folder you can see the two tables needed in ScrollData.inc. A bit of documentation on formats, will expand on this. I will document more over the coming days including a rundown of all calls and document formats. I consider this a bit of a community project so if you have questions or suggestions let me know. I am particularly interested in perspective from people writing games. psidum. |
|
|
Posted: Wed Sep 13, 2017 3:39 pm |
I was wondering... what if we need the location of the Metatiles to be absolutely free instead? |
|
|
Posted: Thu Sep 14, 2017 12:43 am |
Postion was locked for speed. I imagined the metatiles and scrolltables would be decompressed to RAM so in this case you could decompress metatiles at say $C000.
Looking back the engine is faster than I expected. The peek performance cost for pure scrolling in 8 directions is 30 scanlines in active display and 17 in vblank. It is less for single axis only. If this limitation proves to be a problem I could switch to flexible position for about 4-5 extra scanlines in active display. |
|
|
Posted: Thu Sep 14, 2017 7:58 am |
not that I need it at the moment, it's just that I was wondering what if one had the metatiles somewhere in (banked) ROM. I see your point :) | |
|
Posted: Thu Sep 14, 2017 9:10 pm |
Ummm... appart of this, could be interesting a c interface, if could be compatible with smsdevkit, by example.
Next thing could be a flixel like engine with scene object managing (simplified) which could be a boost for sms homebrew. |
|
|
Posted: Fri Sep 15, 2017 4:04 am |
I updated with some more documentation. I have copies it below. I plan to make another pass in around 2 weeks taking in any suggestion from forums.
I agree with your points sverx about flexible metatile table positioning and will switch this in next version. The plan is to create a c interface once the project has settled. |
|
|
Posted: Fri Sep 15, 2017 4:09 am Last edited by psidum on Sat Sep 30, 2017 2:31 am; edited 1 time in total |
edit: documents can be found in project. | |
|
Posted: Fri Sep 15, 2017 8:24 am |
Thanks for putting this work out in the open! I don't have anything to add or suggest at the moment - but just wanted to say that I get a lot of sms-programming education from studying how you approach this problem of scrolling. | |
|
Posted: Sat Sep 30, 2017 2:36 am |
Project Updated.
- Removed 2k boundary requirement for metatile table. Can now be positioned anywhere. - Changed name of project. - Added documentation of file formats. Apologies to anyone who has been playing with it, you will need to update git repository address. Next on list of things is to re purpose some internal graphics tools for basic parsing then implementing a c interface. Psidum |
|
|
Posted: Sat Sep 30, 2017 2:06 pm |
Thanks for the great work psidum!! | |
|
Posted: Sun Oct 01, 2017 3:01 pm |
once we get a C interface we should see if it's easy to integrate with devkitSMS - hopefully it should be :) | |
|
Posted: Sat Oct 14, 2017 3:24 am |
Hey,
I put together a tool for parsing images / tiled documents to data for the scroll engine. Not going to lie, the tiled doc paring stuff works but it is not great. I spoke about the issues associated with tiled documents previously in this thread, the tool expects the xml doc to be in a specific format, you can find documentation about this with the tool. There is a base document to help get started, alternatively you can turn an image in to a tiled document with the tool which will have everything in place. On the other hand, the image to scroll data is very straight forward and easy to use. The tool can also parse nametables, tiles, palettes etc. The tool requires the latest version of java installed. For macintosh users you will need to manually install the latest version (osx is bundled with an older version). If nothing happens when you start up the app this is probably the issue. Like the z80 engine this is a work in progress. If run in to issues, have questions or can think of a better way to integrate the tiled doc stuff please post here or contact me on the sms power irc channel. Psidum. |
|
|
Posted: Sun Dec 03, 2017 1:13 am |
major updates. see first post!
http://www.smspower.org/forums/16800-GeneralScrollLibraryGSLib#top |
|
|
Posted: Sun Dec 03, 2017 11:12 am |
Great! I'll surely use that in my next game, it's so handy! :) | |
|
Posted: Sun Dec 03, 2017 11:26 am |
holy shit!
A game in the lines of Golden Axe Warrior have been always one of my dream projects, so seeing this demo is quite exciting! :-D |
|
|
Posted: Sun Dec 03, 2017 11:41 am |
Great job!
That library will certainly enable some extra-high-quality releases from the community. ;) |
|
|
Posted: Sun Dec 03, 2017 4:53 pm |
BTW, I'm not able to execute UGT, as it says it cannot find or load psidum.ugt.Main class. I looked at the manifest inside the jar and it looked ok, but.... | |
|
Posted: Sun Dec 03, 2017 8:39 pm |
Awesome work - and a very convincing demo to show it off! :) | |
|
Posted: Sun Dec 03, 2017 11:18 pm |
Hey Kusfo. What operating system and java version do you have installed. It uses JavaFX and requires java 8.0 as a minimum. I could find no way to provide a meaningful error if the java version installed was incompatible (i don't know what message it provides). Also are you using version the most recent version (one included in zip on first post and bitbucket). |
|
|
Posted: Mon Dec 04, 2017 8:23 am |
Hi Psidum!
I've Windows 10, with version: "openjdk version "1.8.0_152-release" I'm able to use other jar's as Emulicious or Kidded. I'm able to list the classes using "jar tvf UGT.jar", but not able to execute it with neither: -"java -jar UGT.jar" -"java -cp UGT.jar psidum.ugt.Main" BTW, I'm able to execute Emulicious using these commands. PD: I just tried it now on my Workplace Mac, and it's working like a charm... :-/ |
|
|
Posted: Mon Dec 04, 2017 9:24 am |
Doing some google work it looks like the issue is openjdk related. Reading up you can build openjfx or alternatively use the Oracle version.
https://wiki.openjdk.java.net/display/OpenJFX/Building+OpenJFX Sorry about that, did not consider this. |
|
|
Posted: Mon Dec 04, 2017 10:07 am |
thanks psidum! I'll try at home! | |
|
Posted: Mon Dec 04, 2017 1:38 pm |
About the demo. How is It done when the pillars hide the player? Are they sprites? Are tiles which turn into sprites when slap? | |
|
Posted: Mon Dec 04, 2017 2:19 pm |
@eruiz: are you telling us that you missed that background tiles can have priority over sprites? ;)
check this, scroll down the page until you see the 'priority' section and the "tree in front of Sonic" image... |
|
|
Posted: Mon Dec 04, 2017 6:40 pm |
Ok. I have review the demo and understand. Is simple tile priority. Though about a non planar background for those tiles.
I am working in a custom masking engine over sprites for a new project. Not sure about the performance but Will try. Is for this that reason i though "wrongly". ...but a great engine is here. It seems fast, faster than mine. Have to try It seriously. Like these inline ASM into c functions. Could be A good start for me to learn z80 assembly. Well done! |
|
|
Posted: Tue Dec 05, 2017 11:51 am |
BTW, Psidum, do you plan to also open source the UGT tool? I'm curious about the implementation of certain parts! | |
|
Posted: Tue Dec 05, 2017 7:46 pm |
Awesome! I got stuck with scrolling with smslib, so this is a welcome relief. I'll make sure to test it out. 8) | |
|
Posted: Wed Dec 06, 2017 4:34 pm |
of course you can scroll the background and update the tilemap yourself using SMSlib functions - but this library gives you more power, features and ease, and I guess it's just what you need for your project :) | |
|
Posted: Thu Dec 07, 2017 7:53 am |
At the end, I simply installed Oracle's JDK, and everything is fine now. |
|
|
Posted: Thu Dec 07, 2017 1:29 pm |
just stumbled on this
on SDCC, char is unsigned by default:
so you should probably fix that to:
|
|
|
Posted: Fri Dec 08, 2017 1:17 am |
No plans to open source UGT. Its tied to a few projects some of which have not been released.
Thanks for the heads up sverx, will fix it in next iteration. |
|
|
Posted: Wed Dec 20, 2017 1:52 pm |
I tried UGT, I think I understand pretty much everything but I was wondering how I can set which (meta)tiles have priority over sprites.
Or is it done some other way I'm missing? |
|
|
Posted: Wed Dec 20, 2017 1:55 pm |
It's in the manual, there's one layer in TILED used for that, puttin a "p" on that layer makes the tile with high priority. |
|
|
Posted: Wed Dec 20, 2017 3:42 pm |
The manual!!! I completely missed there was a manual!!!
OK, I have found out now. Sorry :( |
|
|
Posted: Wed Jan 10, 2018 2:00 pm |
Ummmmmm.... Testing for new project, could be great to have a console aplicación to integrate in building of the entire project.
If i have doubts i Will ask. Regards |
|
|
Posted: Thu Jan 11, 2018 1:25 am |
Yes I agree command line interface would be good.
Its about time i do another update, I have already done some bug fixes for the UGT. Let me know your thoughts on testing, I am after use feedback on how to push this project forward. Psidum. |
|
|
Posted: Sun Jan 14, 2018 9:31 pm |
I'm getting these two random tiles at the bottom left corner. Not sure what's wrong, but i'm sure i'm exporting it right. I turned off hiding the first column. This is the code
#include "bank2.h" #include "libs\SMSlib.h" #include "libs\GSLib.c" #define BG_TILES 0 int i; int scrollXOffset = 0; int scrollYOffset = 0; unsigned char scrolltable[titlescrolltable_bin_size]; SMS_EMBED_SEGA_ROM_HEADER(9999,1); void main(void){ SMS_VRAMmemset(0x4000, 0x00, 0x4000); SMS_VRAMmemset(0xC000, 0x00, 0x0020); SMS_loadTiles(&titletiles_bin, BG_TILES, titletiles_bin_size); SMS_loadBGPalette(&bgdaypalette_bin); for(;;){ // copy scrolltable to RAM // NOTE: this allows us to modify the map for hightened player interaction // in this case cutting down lots of trees, activating bridges, etc. for (i = 0; i < titlescrolltable_bin_size; i++) scrolltable[i] = *(titlescrolltable_bin + i); // initalise General Scroll Library GSL_initializeMap(&scrolltable, &titlemetatiles_bin); GSL_positionWindow(0,0); GSL_refreshVDP(); SMS_displayOn(); for(;;){ GSL_scroll(scrollXOffset,scrollYOffset); // << GSL_scroll with offsets to scroll map. SMS_waitForVBlank(); GSL_VBlank(); // <<< Call GSL_VBlank to process any pending scroll / metatile updates. } } SMS_displayOff(); } |
|
|
Posted: Sun Jan 14, 2018 10:13 pm |
why are you using GSlib for an image which isn't bigger than the screen? | |
|
Posted: Sun Jan 14, 2018 10:24 pm |
That's what i was thinking of just doing the title and game over with the map functions in SMSlib, and GSlib for the game world. But i didn't want to use both SMSlib and GSlib functions. Figured it would reduce code. 8P |
|
|
Posted: Mon Jan 15, 2018 5:01 am |
I would not suggest using GSlib for static non scrolling screens. Its not designed for it so you are adding a size premium over other options.
Whats happening is the scroll library assumes column 0 is hidden. The column is populated with what it thinks is the 32nd column (one more than the width of the screen) however since your image is 0-31 columns wide it is wrapping. Those odd tiles are referring to a metatile past the end of the scroll table. For horizontal and multidirectional scrolling this is a non issue as you hide column 0. For vertical scrolling this will be a problem. Feel silly for not considering and testing for this. Will get an update shortly that fixes this. |
|
|
Posted: Mon Jan 15, 2018 9:02 am |
for static screens I suggest you simply use STMcompressed maps - if you don't need to scroll around that's just perfect | |
Goto page 1, 2, 3 Next |