I finally got SDCC (a C compiler) up and working for me with the CSE, and wanted to try and make something with it. I got some characters displaying on screen, and figured why not try to make a roguelike.

Here's a screenshot of the current program. Don't mind the character flickering, that's just jsTIfied's screenshotter being weird.


My plan is for the level generation to generate a room by picking a template from a set of pre-created templates, and then fill that with various objects, dig out doorways, etc. One could explore a floor until they take the stairs down to the next floor. The stairs would have a percent chance to appear in each room (increasing over time) if they had not appeared yet on that floor, or else they would be forced to generate if the player explores enough of the floor that the calc doesn't have enough memory for more rooms.

Room templates are stored 2 bits per tile, and RLE compressed (the RLE compression doesnt save that much space though so I'm considering removing it since it probably adds more space in code than it saves.)
Rooms store a pointer to a room template and the 4 rooms surrounding it (if they exist). Right now doorways are pre-set in the templates but later they should be dynamic.

I haven't thought about what sort of stats / items / creatures should be in the game yet. Going to be your stereotypical medieval fantasy world though.
Each floor will probably have different FG/BG colors for the world, and different wall types.
I want to have objects in the world you can interact with, like fountains that restore your stats, teleporter pads (maybe), that sort of thing.
I'm planning on sticking with the text graphics for as long as I can (maybe forever?) but I might switch to a custom font routine later if I'm really in need of speed, or create a custom font hook if I just want to add some specific characters in.

A few random technical details:
► It's a DCSE program right now
► It uses the OS text routines. (writing to textShadow / pixShadow is turned off though)
► The current room is stored decompressed, switching room requires re-decompressing the data. It's considerably faster than actually displaying it though usually.
► I wasn't entirely truthful about using the OS text routines. It has a custom routine for the space character that calls DCSE'S ColorRectangle with the background color to speed things up.
► The 4 types of tiles are ' ', '-', '|', and '+'. the '=' is generated dynamically based on if a tile is completely surrounded with filled tiles or not.
► It's called CHESS.8xp, because I was originally going to make Chess, but realized that I don't feel like learning how to make a Chess AI, and Chess has a ton of rules anyway that would be annoying to program in. I should probably rename it at some point.
Very nice work!

With the advent of the CE, it your work on the SDCC could be very useful.

The speed looks great too.

How big is the resultant program? It's good that you are using OS text routines, that could save a lot of space.
Current size is 1485 bytes on calc with compiler set to optimize for speed, 1478 with it set to optimize for size (wow such a difference!).
I think around 180 bytes of that is the level data, and some of it are ASM routines I'm not actually using yet (vputc comes to mind). I could probably save some more space if I wrote my C to be more effecient too. After all, there are limits to how much the compiler can optimize your code.
Sounds cool. Could custom sprites be implemented?
If I have "Health:100" displaying, it makes the hardware LCD go into panic mode.

Does B_CALL(_VPutS) set anything LCD wise that I need to change before I start displaying text in the homescreen area with _PutMap again?
Alternatively, is there maybe something I need to do before I call _VPutS
Very impressive work Unknownloner! This is pretty sweet. Smile

Quote:
Does B_CALL(_VPutS) set anything LCD wise that I need to change before I start displaying text in the homescreen area with _PutMap again?
Alternatively, is there maybe something I need to do before I call _VPutS

Think it may be because _vputs doesn't work right in the status bar area. I am unsure of how to fix that at the moment though. Sad
EDIT: Actually, this only happens if the first vput is near the top. After that it is fine? Confused Weird.
Fantastic! Could you put a tutorial or something for how you did it.
If you mean how I have my build system set up to use SDCC, sure thing, I'll do that soon. It might be a little linux specific but should translate to windows pretty easily.
I second wanting a tutorial for C on the calc that would be wonderful!
Posted a guide which should hopefully help. (I'm mentioning this here on the offchance that someone is paying attention to this thread but not recent posts).

http://www.cemetech.net/forum/viewtopic.php?p=232335

It doesn't cover everything I'm doing, but it should get some C code compiling and running.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement