• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

This topic is now archived and is closed to further replies.

Haplo

Simultaneous Keyboard Input in C++

9 posts in this topic


It really depends on how you're doing your input right now. C++ by itself really doesn't have the keyboard functionality you need to do what you want, you're going to have to use some win32 calls (assuming you're writing this for windows)

Assuming you're doing your input by checking for a keypress, then reading the key by getch() or something similar, what you need to do is check the current state of the keys you're interested in.

try something like this :

if (GetAsyncKeyState(VK_UP) {
// handle UP arrow -- up for player 1
}
if (GetAsyncKeyState(VK_W)) {
// handle W key -- up for player 2
}

Hope that helps.

------------------
- Remnant
- (Steve Schmitt)

0

Share this post


Link to post
Share on other sites
Gromit, for one - most programming teacher (notice I said MOST!) can only do stupid programming copy/pasted from a book. None of them do really difficult stuff.
If they knew how to do really good programming they'd get a programming job and make a lot more money.

Now on to answering the actual question - If you're writing this for DOS (which a fair amount of CS classes are still DOS-based) then you'll have to look at overriding the keyboard ISR, that involves some nasty 80x86 Assembly and other garbage that would take too long to explain here.
If you want a full explanation of keyboard ISRs and a good intro book for DOS game programming look for "Teach Yourself Game Programming in 21 Days" by Andre Lamothe. It'll take you longer than 21 days to read and fully understand probably, but it's well worth it.
However, DOS programming is becoming almost nonexistent in games, so you might as well make the move to Windows as soon as possible.
In windows simultaneous keyboard input is a cinch, and the general code is in a post above me.

However, if you want an explanation of how this code works, or an introduction to windows programming, or an intro to game programming in windows then I'd HIGHLY, and I mean HIGHLY suggest the book "Trick of the Windows Game Programming Books" by Andre Lamothe.
I barely knew what "Win32" meant when I got that book, and now I feel confident that I know DirectX, basic Win32 code (very basic, but enough for a game) and all kinds of cool stuff.

Anyway, that's my thoughts.
P.S. - one last note : If (when) you go to windows, use VC++, it has the least problems with DirectX and all the documentation on MSDN assumes you're using it (to my knowledge...)

------------------
gameguru4@yahoo.com

0

Share this post


Link to post
Share on other sites
How many high school programming teachers are actually cs grads? (One high school in my town has a business teacher doubling as a programming teacher). I, fortunately, had one who knew a lot about programming. Most of what I'm currently going through in Structure/Abstraction in college, I learned in that class. I see a lot of 14 and 15 year olds in high school, posting for help and I wonder if they've actually attempted to talk to their programming teacher (if a good one exists at their high school) who most assuredly knows the basics of a few languages. So, in addition to going on-line or getting a book, 14/15 year-old newbies might also want to try their high school programming professor for some help.

BTW, help files rule!!!

0

Share this post


Link to post
Share on other sites
This reminds me of my teacher. Only he is worse. If you're doing some graphics programming he thinks you're playing a game (the fool).
And another one: The computer besides me made a lot of noise. The teacher shouts to shut of the sound of my computer and stop playing games (sounds familiar?). Everyone was saying that it really wasn't my computer. It took him at least 5 minutes to understand (ARGH!).
0

Share this post


Link to post
Share on other sites
My High school had Unisys Computers. With the track ball attached to the keyboard of course. And this was only five years ago.

I just figured that by now the all the crazy math teachers that got stuck teaching a programming class had all perished by now. Make way for the CS teacher that knows what an interupt is. (and maybe how to use one).

0

Share this post


Link to post
Share on other sites
I can't speek for anywhere else in the world but in the UK when I was taking my A-Levels in computing the basic role of the teacher was to teach you the theory of the subject. We where taught reasonable Pascal and basic 80x8g asm but we were only examed on the easy bits of it. The practicle side of the course revolved around us designing, specing and finaly implementing a project of our own. We where alowed to program in anything (I used Turbo Pascal wor Windows 1.5, the good ol' days) but for this side of things the teacher took a back seat and allowed us to get on with it. His job was to help us do the research that we required rather than to teach us. I must say that I realy enjoyed this class.

I do know that my teacher was a capable programmer and could definatly have got a programming job if he wanted too, but he didn't he enjoyed his job as a teacher and was good at it, mind you he had come from a maths background too.

0

Share this post


Link to post
Share on other sites
I'd be surprised if a high school could keep their programming teachers (if they were capable) much more if those teacehers were cs grads (maybe two years at the most).
0

Share this post


Link to post
Share on other sites
OOOPS, by accident, I posted this post on the isometric view forum. Anyways, I'm a student in high school and I just finnished an independant project of mine for my Computer Science class. I learnt C++ and made Pong, however it's only one player because I don't know how to read in simultaneous keyboard input. The problem I ran into was that if player1 pushed up to move his paddle upwards and then player2 did the same, player2 would lock out player1 and only player2's paddle would move. I asked my teacher and searched the internet to find an example in C or C++ but I came up dry. I would really appreciate it if anyone could point me in the right direction because I really want to make the game as good as I can possibly make it.

[This message has been edited by Haplo (edited December 13, 1999).]

0

Share this post


Link to post
Share on other sites
U know that is so much better than some of the uni lecturers in the Australian uni I attended.

NT hung. Someone suggested turning the computer off and on again.

The lecturer (Senior, mind u) asked, "How?"

0

Share this post


Link to post
Share on other sites