You are not logged in.

#1 2009-03-29 06:08:40

vkumar
Member
Registered: 2008-10-06
Posts: 166

ncurses game

There aren't enough of them smile

I wrote a simple space-invaders clone, and it's quite fun!

Here is the project;
http://code.google.com/p/vadorz/

Source, instructions on compiling, and other updates are on the project site.

Please enjoy

edit:
Thanks to Ghost1227, there are "vadorz" and "vadorz-svn" pkgbuilds in the AUR.
check it out!

Last edited by vkumar (2009-04-02 05:33:39)


div curl F = 0

Offline

#2 2009-03-29 09:00:26

X/ax
Member
From: Oost vlaanderen, Belgium
Registered: 2008-01-13
Posts: 275
Website

Re: ncurses game

Nice. What you might be wanting to add is having people press keys continuously changes the position too. Currenty it's just smacking the arrow keys too much.
Appart from that, nice initiative, I'm waiting for version 2 here big_smile


My coding blog (or an attempt at it)
Archer start page (or an attempt at it)

Offline

#3 2009-03-29 17:01:33

vkumar
Member
Registered: 2008-10-06
Posts: 166

Re: ncurses game

Yes, there are timing issues sad.
I think ncurses stores the keystrokes into a FIFO buffer, which becomes problematic when there is a lot of input.

I fixed a bug in sprite_draw and in the main loop, so everything should feel smoother in r0.2.

Goal for r1.0 is to get everything 100% responsive.
Goal for r2.0 is to get it to look nice =/.

Spring break just got started, so I'll be working on this for some time.

edit:
Fixed timer, improved gameplay - it feels great now!

Last edited by vkumar (2009-03-30 04:20:30)


div curl F = 0

Offline

#4 2009-03-29 17:17:54

INCSlayer
Member
From: Sweden
Registered: 2007-09-06
Posts: 296
Website

Re: ncurses game

woot i won

i want more levels big_smile


dovie andi se tovya sagain

Offline

#5 2009-03-29 17:39:43

vkumar
Member
Registered: 2008-10-06
Posts: 166

Re: ncurses game

edit:
levels are here! no need to mess around with internals.

Last edited by vkumar (2009-03-30 06:20:53)


div curl F = 0

Offline

#6 2009-03-29 17:42:20

evr
Arch Linux f@h Team Member
Registered: 2009-01-23
Posts: 554

Re: ncurses game

very nice, i like it smile

love the ncurses games.

Offline

#7 2009-03-29 18:27:12

vkumar
Member
Registered: 2008-10-06
Posts: 166

Re: ncurses game

smile
If anyone has suggestions for the game, please chip in!

edit:
The timer has been heavily modified.
There's a selective input queue that allows people who hold down keys to function.
Also, everything is smoother.

Last edited by vkumar (2009-03-30 06:19:48)


div curl F = 0

Offline

#8 2009-03-30 04:25:04

vkumar
Member
Registered: 2008-10-06
Posts: 166

Re: ncurses game

Level support has been added (if you win it all under default speeds, without using MegaKill, I'll put your name in the source big_smile)!

edit:
Fixed a bug in populate(). UFOs are populated sanely, now. Also, default art has changed - so has game speed.
Most of the logic has been revised: some parts are faster, some take longer, but all work better.

Fixed a regression in the timer, now running smoother than ever.

Last edited by vkumar (2009-04-02 05:34:17)


div curl F = 0

Offline

#9 2009-03-31 00:49:18

dsr
Member
Registered: 2008-05-31
Posts: 187

Re: ncurses game

If you're going to support wasd, it would be nice if you add the hjkl keys too. They're practically the default on ncurses games. *waits eagerly*

Offline

#10 2009-03-31 01:59:24

vkumar
Member
Registered: 2008-10-06
Posts: 166

Re: ncurses game

Done (rev 24).

I've added downloads, so you can get working binaries even if the SVN version is broken smile.
Runs on *nix as well as Windows (with pdcurses).


div curl F = 0

Offline

#11 2009-03-31 02:29:26

dsr
Member
Registered: 2008-05-31
Posts: 187

Re: ncurses game

Thanks for the quick response. H works fine now, but you have J going up, K going right, and L going down. J is supposed to go down, K up, and L to the right. I look forward to revision 25. big_smile

Offline

#12 2009-03-31 03:41:07

vkumar
Member
Registered: 2008-10-06
Posts: 166

Re: ncurses game

fixed the hjkl, but that'll only come in with rev 27.

I'm merging my friends code (support for colors and other cool stuff!) at the moment, and many things are broken.

edit #2:
We have some very exciting stuff working (yes, it *is* 2:30 in the morning).
A completely revamped timer (again!) which performs much better, support for art of any size (20 char wide fighter ship is possible!), great color support, new art, pause functionality, score functionality, and improved gameplay. I will finish the merge and commit tomorrow - stay tuned smile

Last edited by vkumar (2009-03-31 06:24:23)


div curl F = 0

Offline

#13 2009-03-31 21:56:07

vkumar
Member
Registered: 2008-10-06
Posts: 166

Re: ncurses game

All done! We have a truly fantastic release out.
http://vadorz.googlecode.com/files/vadorz

If you passed this game off as slow, un-responsive, or un-attractive before - I think you'll be surprised.
There are several new additions that make the game much more fun, including a plot, more lives for your ship, and better graphics.

@dsr: hjkl is fixed as well smile

edit:
please post any changes you'd like to see.

Last edited by vkumar (2009-04-02 05:35:23)


div curl F = 0

Offline

#14 2009-04-01 01:17:43

smartboyathome
Member
From: $HOME
Registered: 2007-12-23
Posts: 334
Website

Re: ncurses game

One suggestion, can you make it so that when the arrow keys are held down, the ship keeps moving? It only works for me when I press the arrow key repeatedly. Also, speed up how fast the ship moves, on level 5 I can't get out of the way of the bullets because of how slow it is.

Offline

#15 2009-04-01 03:07:08

Ghost1227
Forum Fellow
From: Omaha, NE, USA
Registered: 2008-04-21
Posts: 1,422
Website

Re: ncurses game

Here you go... vadorz has hit the AUR!
vadorz

Lemme know when you make updates and I'll update the PKGBUILD... I'd suggest adding a version number, compressing the download, and adding a high scores list tongue


.:[My Blog] || [My GitHub]:.

Offline

#16 2009-04-01 03:51:16

vkumar
Member
Registered: 2008-10-06
Posts: 166

Re: ncurses game

smartboyathome:
I think you may be using an older version. The latest version (http://code.google.com/p/vadorz/downloads/list, rev 33) should fix this problem.
If the problem persists, then you may have to tweak a setting for your computer (http://code.google.com/p/vadorz/wiki/Installing);

//#define FPS 20
#define FPS 40

This will make vadorz access the ch_stack 2000 times a second, as opposed to 1000 (assuming the default PPF of 50). You will notice the game become more responsive, but it will require more CPU and memory.

Ghost1227:
I'm stunned!

I'll always have the latest release at this URL:
"http://vadorz.googlecode.com/files/vado … on}.tar.gz"

So currently:
vadorz33.tar.gz

It will contain "vadorz.c" and "vadorz" (pre-compiled).

As far as high scores go, I will put the top 10 scores right after the license header in the source smile.

thank you all so much!

Last edited by vkumar (2009-04-01 03:52:02)


div curl F = 0

Offline

#17 2009-04-02 02:47:33

elmer_42
Member
From: /na/usa/ca
Registered: 2008-10-11
Posts: 427

Re: ncurses game

While I would sincerely love to play this, I seem to be getting an error on the AUR version I got about five minutes ago.

vadorz: error while loading shared libraries: libncursesw.so.5: wrong ELF class: ELFCLASS64

[ lamy + pilot ] [ arch64 | wmii ] [ ati + amd ]

Offline

#18 2009-04-02 03:01:48

evr
Arch Linux f@h Team Member
Registered: 2009-01-23
Posts: 554

Re: ncurses game

i'm getting the same error as well.  Is the binary you're compiling only for the 32 bit version, because it works fine if i compile it by myself (on x86_64).  Maybe you should just have the pkgbuild compile it from source instead of installing a binary, especially because it only takes a couple seconds.

Offline

#19 2009-04-02 03:16:17

Ghost1227
Forum Fellow
From: Omaha, NE, USA
Registered: 2008-04-21
Posts: 1,422
Website

Re: ncurses game

The pkgbuild has been updated to compile from source, and I've added a second pkgbuild for vadorz-svn for those who want it.


.:[My Blog] || [My GitHub]:.

Offline

#20 2009-04-02 05:31:54

vkumar
Member
Registered: 2008-10-06
Posts: 166

Re: ncurses game

sorry for the negligence.. I completely forgot about putting an x86_64 build up.
and thank's for the vadorz-svn pkgbuild, hope it'll encourage people to tweak wink

I'm focusing on getting rid of the lag when you hold keys down.
getting rid of ch_stack helps somewhat, but it's not a great fix...


div curl F = 0

Offline

#21 2009-04-02 06:03:42

elmer_42
Member
From: /na/usa/ca
Registered: 2008-10-11
Posts: 427

Re: ncurses game

Yeah, the new PKGBUILD did the trick. Neat game, it's pretty fun to play.


[ lamy + pilot ] [ arch64 | wmii ] [ ati + amd ]

Offline

#22 2009-04-02 16:42:21

X/ax
Member
From: Oost vlaanderen, Belgium
Registered: 2008-01-13
Posts: 275
Website

Re: ncurses game

Final score: 3600
I also notice a small redesign. Love the game already, quite addictive.
Responsiveness is still an issue though, also, shooting / moving together would really be a plus.

PS: I say we get ourselves a competition!! Get as high score as possible big_smile

#edit
I made 6600 just now... Really hard at that point.

Last edited by X/ax (2009-04-02 16:44:43)


My coding blog (or an attempt at it)
Archer start page (or an attempt at it)

Offline

#23 2009-04-02 19:11:29

vkumar
Member
Registered: 2008-10-06
Posts: 166

Re: ncurses game

in r40, I went ahead and removed ch_stack - and the response issues are still there. I don't know what's causing it, it would be great if someone could help me understand.. I'm beginning to think it's a limitation with ncurses.

Here's the "timer" code;

for (x=0; x < KEYBOARD_POLLS_PER_FRAME; ++x) { // abbreviated "PPF"
    in = getch();
    usleep((SECOND/FPS) / KEYBOARD_POLLS_PER_FRAME); // SECONDS = 1000000 u-secs, FPS = Frames per second 

    if (in == ERR) continue; // curses does not have any key strokes in its "key stack", i.e: you haven't pressed a key in a while
    // if key_left, do this, if key_right, do that ... blah blah

And a description of getch();

The nodelay option causes getch to be a non-blocking call. If no input is ready, getch returns ERR.  If disabled (bf is FALSE), getch waits until a key is pressed.

Last edited by vkumar (2009-04-02 19:13:17)


div curl F = 0

Offline

#24 2009-04-02 20:58:43

dsr
Member
Registered: 2008-05-31
Posts: 187

Re: ncurses game

The hjkl keys still don't work correctly.

The code

if (in == KEY_LEFT || in == 'a' || in == 'h') {
    aup.pos.x -= (aup.pos.x == 0) ? 0 : 1;
} else if (in == KEY_UP || in == 'w' || in == 'j') {
    aup.pos.y -= (aup.pos.y == 0) ? 0 : 1;
} else if (in == KEY_RIGHT || in == 'd' || in == 'k') {
    aup.pos.x += (aup.pos.x == cols-AUP_ART_SIZE) ? 0 : 1;
} else if (in == KEY_DOWN || in == 's' || in == 'l') {
    aup.pos.y += (aup.pos.y == rows-1) ? 0 : 1;

should be changed so that k goes with w, l goes with d, and j goes with s. Thanks!

Last edited by dsr (2009-04-02 20:58:57)

Offline

Board footer

Powered by FluxBB