Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
After a long hiatus and many changes, Trio and Niko is being worked on again! This, my OCD project that's been going on for heaven knows how long, finally has progress. Lately I've been working with building my foundations with C, and decided to learn SDL. So, after having been reading SDL tutorials/writing actual code for the past few days, here is what I have to share:



Windows Binary (I suggest you try it -- the recording above is low-quality, and makes my shooting star look ugly :< )
http://www.mediafire.com/?32k2w2ll8ansfhz

I was trying to finish the star-sparkling effect and the option selection thing before I posted this, but I was too eager; the only star animations I *did* get done was the shooting star Razz
New update, title screen finished (and a lot more things I can't show yet, such as preliminary load/save screen, simple actual gameplay testing, etc.):



EDIT: the recording is very low quality, I assure you it's very smooth in real life Smile
Well, it's been holding progress for some time, so... what do you think of my ASCII table, holding values from 32 (space) to 128 (DEL) exclusive?

Ashbad wrote:
Well, it's been holding progress for some time, so... what do you think of my ASCII table, holding values from 32 (space) to 128 (DEL) exclusive?



I can get this with google faster than I can figure out how you organized this.
Not quite sure the implication of "get this with google", there Razz

With that being said, it took like 2 minutes to actually code in the text drawing system, and it looks swell IMHO:

Haha, I love the test strings that you used. Very Happy I find that font slightly hard to read though; I might like a few tweaks at some point, if you're open to suggestions. If not, it's also quite good as-is.
KermMartian wrote:
Haha, I love the test strings that you used. Very Happy I find that font slightly hard to read though; I might like a few tweaks at some point, if you're open to suggestions. If not, it's also quite good as-is.


Indeed, some things I'm thinking of changing is letter space from 6 pixels to 5 pixels (it looks okay, a bit squished, but for the most part a bit more legible), make the lowercase 't' look more like it's lowercase, etc. What ideas do you have?

EDIT: this is what it looks like with text one pixel closer together and the 't' fixed:




EDIT2: this is likely to be the finalization for the character spacing; I changed a few more misc. characters, but nothing really that major. What is good is that spacing is handled differently for each type of character (punctuation marks have less room than lowercase, which have less room than uppercase and a few weird characters I'm unlikely to use much.) Comments and suggestions? If not, I'm moving on into drawing the text into a text box in a sophisticated manner.

Wanna see my prototype load save and placeholder options screen? Smile Well, here ya here ya gogogo:



Now that you can see the text more in action, any more suggestions/comments?

On a side note, I should have some basic options coded into the options screen tomorrow, and probably file save recognition. I'm thinking 3 different files for different slots -- though I'll try out multiple things and see what works (by "file save recognition" done by tomorrow, it would likely just be finding the files and check if they exist, and maybe show a player name stored in the first 16 bytes of the file)
LIES. Scheme is _way_ better.

That said, I still find the font very, very difficult to read. It's not impossible, but it could definitely be better, though if you are going for the pixelated look, then you've definitely hit it Smile
It's both pixelated and scripty, two things that don't usually combine to provide great readability. I suspect that if he made it just pixelated or just scripty, though, it wouldn't give the feel that he's trying to go for.
Ashbad, that's looking pretty neat (the game). Regarding the font, you shouldn't really mix handwritten letters and computer letters, it affects readability.

I'm curious about the technologies you're using for this game. Is it SDL with OpenGL? Or is it SDL with the SDL video? What about for drawing text, how are you handling it? Thanks.
KermMartian wrote:
It's both pixelated and scripty, two things that don't usually combine to provide great readability. I suspect that if he made it just pixelated or just scripty, though, it wouldn't give the feel that he's trying to go for.


Indeed, I'm going for pixelated and scripty (if that's the way to describe it). Here's some background: the actual screen buffer size is 768*512 (don't yell at my plz for not making it 640*480 kthx), and the intermediate screen (which I actually draw on) is 192*128. Every time I update the main screen, it basically just scales up the smaller screen by a scale of 4. So, since the true screen size I'm working with is small (I'm really going for a retro gameboy/calculator feel) I have to have a small font size. In reality, the characters are 5*6 pixels large -- not much larger than the small TIOS ones on an 8x calculator, and smaller than the normal characters on the TIOS for an 8x calculator.

It *is* a weird setup, but the only real concern that is valid is that the scaling up is very time intensive, but tests I ran seem to show that my very, very simple method really has little (and in many tests, seemingly no) effect on the overall speed.

ephan wrote:
I'm curious about the technologies you're using for this game. Is it SDL with OpenGL? Or is it SDL with the SDL video? What about for drawing text, how are you handling it? Thanks.


It's just SDL with SDL standard video mode, which is really all I need.

For drawing the text, I'm actually not using a TTF -- it's less useful for my purpose and a lot more work. I simply have a PNG that looks like this (with a few recent changes, I cut the 1 pxl wide buffer between characters and changed a few):




And for the rudimentary drawstring function, I made this:


Code:
// draw a null terminated string in my cool glyphs
void drawstring(char*string, int x, int y) {
    SDL_Surface*glyphs = load_image("resources\\images\\font_table.png");
    int temp_x = x;
    for(int j = 0; j < strlen(string); j++) {
        if(*(string+j)==32) {  x+=5;
        } else if(*(string+j)=='\n') { y+=7;
            x = temp_x; } else {
            drawsprite(x, y, 5, 6, glyphs, (*(string+j))%16*5, ((*(string+j))-32)/16*6);
            x+=(6-(*(string+j)>='a'&&*(string+j)<='z'));
        }
    }
    cleanbuf(glyphs);
}
I see, I've heard of that technique (having an image with characters and a function) to draw them. Thanks, and good luck with coding!

I usually use TTF, it's cool because I can use pre-existing fonts with .ttf files.
ephan wrote:
I see, I've heard of that technique (having an image with characters and a function) to draw them. Thanks, and good luck with coding!

I usually use TTF, it's cool because I can use pre-existing fonts with .ttf files.


Cheers.

TTFs are good for many purposes indeed, but this is one of the few times it's more of a hassle, so I decided to to make life difficult for me and use them.
Also, in your code, it seems to create an SDL_Surface... How did you add it to the video surface? Thanks.
ephan wrote:
Also, in your code, it seems to create an SDL_Surface... How did you add it to the video surface? Thanks.


Sounds like someone needs their own "SDL Help" topic Wink I'd prefer not to sidetrack my own game thread too much, but in your own help topic, I'd be glad to lend you a boatload of helpful SDL-wrapping functions I made, and explain how to apply surfaces to the video screen and such.
Ashbad wrote:
ephan wrote:
Also, in your code, it seems to create an SDL_Surface... How did you add it to the video surface? Thanks.


Sounds like someone needs their own "SDL Help" topic Wink I'd prefer not to sidetrack my own game thread too much, but in your own help topic, I'd be glad to lend you a boatload of helpful SDL-wrapping functions I made.


You have your point, I was simply curious of how SDL works. Either way, will this game be cross platform? Or are you using Windows-only libraries?
Well, SDL itself is cross platform, and I'm not using any windows-only libraries (in fact, I'm only using stdlib.h and stdio.h for any non-SDL libraries). It could be ported to other platforms with relative ease, and maybe at some point I'll make a Linux build -- but it's not quite far enough into the development process to even worry about that.

As for what would have to be changed to build a linux binary, the paths would have to be changed from using '\\' to denote path levels to '/', and maybe a few other things here and there, and likely a rebuilt makefile. Not that much work Smile
Quote:
As for what would have to be changed to build a linux binary, the paths would have to be changed from using '\\' to denote path levels to '/',


Reading that on your code was what first made me think if you were releasing it to Unix systems. Cool, then, since cross-platform is always appreciated.
Indeed. It'll be easy to make a Linux build, since I run Fedora in VB already, and today I'll be loading it to my D: partition, and likely will migrate my source over there later on.
  
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 4
» All times are GMT - 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