GDR Forum Index
Podcast Podcast
Dev Dev Logs
Search Search
RSS RSS
Register Register
Log in Log in
Reply to topic GDR Forum Index -> Game Developer's Refuge -> Development Log - Tank Game (v:1.0e, +sound +min.fixes) Page 1, 2, 3  Next
View previous topic :: View next topic  
Author Message
0xDB
Developer

Joined: 26 Dec 2005
Posts: 1651
Location: Your consciousness.
PostPosted: Mon Apr 27, 2009 6:58 am    Post subject: Development Log - Tank Game (v:1.0e, +sound +min.fixes) Reply with quote

[EDIT]
Version 1.0e download link: TankGame1.0e (source and makefiles(for win/nix(lin) and windows binary included)
(added sound effects, minor fixes)
[/EDIT]


Right, I'm currently going through my final four weeks of school ever (part of the software development apprenticeship that I'm doing) and today we were given the task to create a game based on the following requirements:


  • must be two to four player game
  • must keep scores in a file
  • must have a GUI
  • must have built-in instructions
  • may use any programming language available
  • must be object oriented (yeah I know, this is kind of overkill for simple games like this)
  • must not be larger than 5MB (zipped)
  • must have commented source code and must be runnable
  • must be finished before May 20th. 2009


These requirements are pretty lose. The teacher said, everybody who passes in a very simple and working game (number guessing game for example) automatically gets a B.
He also said, to get an A, we would have to put some more effort into it.

Long story short: This is a good excuse for me to get off my lazy butt and get those creative juices and my rusty game dev skills going again.

I'll make a simple little Tank Game with the following features:

  • two players simultaneously
  • single screen 2D top-down hardcoded map
  • each player controls one tank
  • each player controls the tracks and the cannon separately (tanks can only go forward in this game, can rotate cannon, can rotate body, can shoot)
  • each player will receive penalties for getting hit or shooting (become slower, build up heat, lose armor)
  • each player may have a nickname (for scores file, which will keep scores of all players (total games played, win count))
  • a match lasts a maximum of 5 minutes
  • the player with the most armor left at the end of the match scores a win, if the other player dies during the match, the surviving player scores



So far, I have only thought about the control scheme. Since I'll probably only have time to do keyboard controls, I need something simple that will take into account that most keyboard don't handle a lot of keypresses at the same time very well.

So each player will get six keys, mapped as follows:
k1 = start/stop engine (running engine will make tank go forward all the time at max speed (maybe with some buildup and slowdown for an extra element of tension in the game))
k2,k3 = rotate cannon left/right
k4,k5 = rotate body left right
k6 = fire cannon

k1 and k6 aren't likely to get pressed a lot, so most of the time a maximum of eight keys will be pressed simultaneously.

I'll use C++ and Allegro to implement it. I'll probably start working on it this coming weekend.
_________________
0xDB


Edited by 0xDB on Mon Jan 04, 2010 7:09 am; edited 6 times
View user's profile Send private message Visit poster's website
Gil
Developer

Joined: 14 Nov 2005
Posts: 2341
Location: Belgium
PostPosted: Mon Apr 27, 2009 9:30 am    Post subject: Reply with quote

I used to play a tank game with those controls and it's very unintuitive. It basically forces your both brainhalves to think about two different movement patterns at the same time (turret rotation, tank movement)

When using mouse + keys in an FPS, it works well, because we don't have to translate the mouse movements, the mouse movement translates directly to onscreen movement. We only have to translate the abstract movements of the other hand.

Compare it to console FPS controls which have the same problem. I can't for the life of me play any console FPS. I tried over and over (Hitman was loads of fun, I really wanted the controls to work for me), but it just keeps on feeling like I'm trying to play a foreign instrument.

On the other hand, with a limited development cycle and two players on one computer, you're probably bound to this particular setup. I'll give it some extra thought, but shy of connecting and supporting two mice or working with an auto aim system, I can't figure something out.

I can only give the following advice: allow both relative and absolute turret movement.

With relative movement, if you point the turret to the front of the tank and rotate the tank, the turret keeps pointing to the front of the tank. If we move it 90, it will keep pointing to that direction of the tank.

Absolute movement is when we rotate the turret to the north, it will keep pointing north, whatever direction the tank turns to.


Here's the tank game I used to play:
http://www.jrouwe.nl/tank/

Probably only works under DOS emulation, haven't had any luck running it on XP
_________________
PoV: I had to wear pants today. Fo shame!
View user's profile Send private message Visit poster's website
Sirocco
Moderator

Joined: 19 Aug 2005
Posts: 9412
Location: Not Finland
PostPosted: Mon Apr 27, 2009 9:45 am    Post subject: Reply with quote

Yeah, that's gonna be a klunky control system, but having two people at the same keyboard and having separate tank / turret controls for each player means you have to do something like that. Otherwise I'd suggest experimenting with a lagged auto-aim function, but I suspect that would present too many design problems on its own.

Keep us posted on this.
View user's profile Send private message Visit poster's website
n29
Developer

Joined: 13 Sep 2005
Posts: 879

PostPosted: Mon Apr 27, 2009 3:06 pm    Post subject: Reply with quote

Ah yes, the good old tank game:

http://www.geocities.com/nonnus29/j4k_2005/demo.htm

Tanks are really easy to model in 3d. I've always meant to revisit my tank game and add better AI, and a feature where you press a button and the view switches to the gun sight and you traverse the turret to aim. That would take it well over 4k though.
View user's profile Send private message
Ren
Contributor

Joined: 31 Aug 2005
Posts: 271
Location: London, England
PostPosted: Mon Apr 27, 2009 3:32 pm    Post subject: Reply with quote

You ever played Smash TV? Thats a good control scheme for a top down game where you can move and shoot in different directions, provided your keyboard can handle it. My old windows box used to get confused if 4 or more keys were pressed at once, so I guess it's worth checking your school computers to see if they can handle 8 keys at once. If not, moving to a turn based model, like a worms clone, might be worth a think.
_________________
Avatar: Yu Suzuki (Virtual Fighter, Shenmue)
View user's profile Send private message Send e-mail Visit poster's website
Sirocco
Moderator

Joined: 19 Aug 2005
Posts: 9412
Location: Not Finland
PostPosted: Mon Apr 27, 2009 3:41 pm    Post subject: Reply with quote

Also it's important to note that USB keyboards have a maximum of 6 key rollover due to limitations in the spec, and cheap boards often are limited to 3. PS2/AT keyboards generally perform better, which may become important depending on the key combinations you expect to have pressed at any given moment.
_________________
NoOP / Reyn Time -- The $ is screwing everyone these days. (0xDB)
View user's profile Send private message Visit poster's website
PoV
Moderator

Joined: 21 Aug 2005
Posts: 10782
Location: Canadia
PostPosted: Mon Apr 27, 2009 7:31 pm    Post subject: Reply with quote

Everybody loves wired xbox 360 pads... I'm just sayin'.
_________________
Mike Kasprzak
'eh whatever. I used to make AAA and Indie games | Ludum Dare | Blog | Tweetar
View user's profile Send private message
Hard Rock
Contributor

Joined: 31 Aug 2005
Posts: 238

PostPosted: Mon Apr 27, 2009 7:44 pm    Post subject: Reply with quote

Quote:

Everybody loves wired xbox 360 pads... I'm just sayin'.

Really unrelated but after trying the wireless pads, I can't stand the wired ones. The wireless ones are heavy enough to feel comfortable (probably due to the batteries) whereas the wired ones feel cheap and weak.

If you do use the pads i suppose you could use the directional keys to move the tank and the triggers to aim the turret?
_________________
Hard Rock
[The Stars Dev Company][Twitter]
View user's profile Send private message Visit poster's website
PoV
Moderator

Joined: 21 Aug 2005
Posts: 10782
Location: Canadia
PostPosted: Mon Apr 27, 2009 7:55 pm    Post subject: Reply with quote

Yeah, well it's not fun having to charge batteries to use as a development controller. ;)
_________________
Mike Kasprzak
'eh whatever. I used to make AAA and Indie games | Ludum Dare | Blog | Tweetar
View user's profile Send private message
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Tue Apr 28, 2009 12:51 am    Post subject: Reply with quote

Windows will map a wired xbox360 controller or original xbox controller with adapter (or any usb joypad for that matter) as a regular usb joystick. That gives you two sticks (move + aim), a trigger to shoot, and your choice of buttons for anything else.

Allegro makes using mouse or joystick inputs at least as easy as keyboard, so you should not shy from either one simply because it is a "small" game. Look at the allegro example programs. The source code is easy to understand.

Supporting multiple players on the same machine adds complexity to your considerations, but you should definitely not let programming for the hardware put you off.
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
0xDB
Developer

Joined: 26 Dec 2005
Posts: 1651
Location: Your consciousness.
PostPosted: Tue Apr 28, 2009 5:54 am    Post subject: Reply with quote

Thinking more about the controls, the average number of keys pressed simultaneously should be four (as the players can not rotate their parts left and right at the same time, unless they're evil and hold down keys just to block each other...).

Anyway, I'll have to find a solution for that later. The school computers don't have joysticks or gamepads so that option is only a possible solution for future extensions of the game (of which there seem to be plenty(head explodes with content/gameplay variation ideas)) but for this school project there will only be the minimum features as listed in the opening post, so that it is playable against another human player.

While I was procrastinating on studying for a short written exam(which is coming up tomorrow), I made a concept sketch to visualize the most basic stuff and I'll use it later as an aid for creating the todo list for the game:


--
edit (a few hours later):
Got the tank sprites done and made a small mockup to see how the body and the cannon fit together:

In the game I'll use Allegros rotate_sprite and pivot_sprite functions, so there'll be more than the angle combinations shown in the above image.
_________________
0xDB
View user's profile Send private message Visit poster's website
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Tue Apr 28, 2009 9:49 am    Post subject: Reply with quote

I really like your mock-up. Minimal, yet stylish, and gets the point across very efficiently. Aside from possible control limitations, it looks pretty good. I think they had a game like this in Wii Play?

Maybe the keyboard thing wont be too bad. You can play two player nesticle with both players on the same keyboard. The most you're likely to use at once is two directions per player and maybe the fire keys = 6, which is less than or equal to what you're likely to see used on an emulated NES controller.
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Bean
Admin

Joined: 20 Aug 2005
Posts: 3766

PostPosted: Tue Apr 28, 2009 4:07 pm    Post subject: Reply with quote

I would highly recommend supporting gamepads for this. Dual analog sticks (someone already mentioned SmashTV) would work very well for this.

Also, the 360 gamepad, from what I can tell has sort of became the standard gamepad for PC (perhaps by default). I currently use an xbox1 gamepad, which works just as well.

As game developers I think were kind of obligated to at least support the 360 controller.


-Bean
_________________
Kevin Reems | Nuclear Playground | Solid Driver
View user's profile Send private message Visit poster's website
PoV
Moderator

Joined: 21 Aug 2005
Posts: 10782
Location: Canadia
PostPosted: Tue Apr 28, 2009 4:42 pm    Post subject: Reply with quote

Yeah, the 360 pads are nice. Only complaint is you have to use Microsoft's 360 controller API if you want to get the L/R triggers (and rumble) properly. Through Window's standard gamepad interface, the L/R triggers are reported as a single analogue axis. Sticks and buttons work great (even stick clicks as buttons).
_________________
Mike Kasprzak
'eh whatever. I used to make AAA and Indie games | Ludum Dare | Blog | Tweetar
View user's profile Send private message
Bean
Admin

Joined: 20 Aug 2005
Posts: 3766

PostPosted: Tue Apr 28, 2009 8:50 pm    Post subject: Reply with quote

I don't think PC Gamers will cry if there's no rumble. The trigger issue sucks but can be dealt with.

-Bean
_________________
Kevin Reems | Nuclear Playground | Solid Driver
View user's profile Send private message Visit poster's website
Sirocco
Moderator

Joined: 19 Aug 2005
Posts: 9412
Location: Not Finland
PostPosted: Tue Apr 28, 2009 11:24 pm    Post subject: Reply with quote

The vast majority of people won't be playing with 360 pads, and those that do have an emulated gamepad already know about the limitations from dealing with other games. I've been using a Gamecube pad and PSX arcade stick for many years via adapters, and there are always little quirks that aren't fully supported. Usually rumble and analog triggers.

Wii Play had a cool little tank game that could be played co-op. Ideally, you would move with the nunchuck and aim the turret via the IR pointer. You could also control the game entirely from a Wiimote without a nunchuck, but that was klunky and evil.
_________________
NoOP / Reyn Time -- The $ is screwing everyone these days. (0xDB)
View user's profile Send private message Visit poster's website
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Wed Apr 29, 2009 12:44 am    Post subject: Reply with quote

Yeah, Denis said he wont be able to use game controllers in class, so he's left with keyboard and mouse. And since it's 2 player, and there's only one mouse, keyboard it is.
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
0xDB
Developer

Joined: 26 Dec 2005
Posts: 1651
Location: Your consciousness.
PostPosted: Wed Apr 29, 2009 11:43 am    Post subject: Reply with quote

Today I spent a few hours pixelling the status display:


In-game the tank and gun in the status display will always be rotated like the tank in the game. The little green dot will be an aiming help, always pointing towards the enemy.

The two bars will be showing heat level and armor level.
The controls below that are for engine control (I decided that I will allow the engine key to toggle between 'forward' 'stop' 'backward' 'stop' repeat) and a status light that will glow green when the gun is ready to fire (it will have a reload delay and will not be ready to fire, if the tanks heat level is too high).

Still haven't written any code. Will make all the graphics first so that I can later just code code code without having to take a break for art tasks.
_________________
0xDB
View user's profile Send private message Visit poster's website
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Thu Apr 30, 2009 12:36 am    Post subject: Reply with quote

Just make sure you're watching your time. IMHO, it's easier to skimp on graphic than on code, especially in a programming class ;)
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
0xDB
Developer

Joined: 26 Dec 2005
Posts: 1651
Location: Your consciousness.
PostPosted: Fri May 01, 2009 2:20 am    Post subject: Reply with quote

Today is an official holiday here. I got up early and invested morning til noon into creating the remaining graphics and I made a full in-game mockup with them to keep me motivated and to have a clearly defined and visible target to home in on.

in-game mockup:

_________________
0xDB
View user's profile Send private message Visit poster's website
0xDB
Developer

Joined: 26 Dec 2005
Posts: 1651
Location: Your consciousness.
PostPosted: Sun May 03, 2009 12:35 am    Post subject: Reply with quote

Started writing code yesterday. I'm currently working on the building blocks that will together form the GameState.

The GameState will be responsible for input/collision detection/logic updates and output(display), whereas all the classes that I've written so far, are just for organizing/holding data.

Against my original intention to have a hardcoded map, I've decided to read the map from a simple textfile(see screenshot at end of post), so that I don't have to recompile everytime I change it. I also plan to allow selecting different maps from the main menu.

And, even though there is no game yet, I've already completed the boring task of writing the manual. :)

--- readme.txt ---
Code:

--------
TankGame
--------
(C) 2009 by Dennis Busch, Dennis-Busch@gmx.net, http://www.dennisbusch.de

Content
-------
    0.) Disclaimer
    1.) What is it?
    2.) Why does it exist?
    3.) How to play, Controls
    4.) Making Of
    5.) Copyright & Spreading
    6.) References

    
0.) Disclaimer
--------------
    #include <std_disclaimer.h>
    "I do not accept responsibility for any effects, adverse or otherwise, that
     this code may have on you, your computer, your sanity, your  dog, and
     anything else that you can think of. Use it at your own risk."
     ---
     All code was written and compiled without evil intention.
     Use the executable at your own risk.

    
1.) What is it?
---------------
    TankGame is a simple game for two players, written in C++, using the
    wonderful "Allegro"[R1] library as a framework.
    
    The goal of the game for each player is to eliminate the respective other
    player by destroying their tank within a timelimit or to do as much damage
    as possible.
    
    Inspiration: The game was inspired by an Atari 2600 game,
    called "Combat"[R2].
    
    
2.) Why does it exist?
----------------------
    It was written for a school assignment based on the following requirements:
    - game for two to four players
    - not single player against the machine
    - may be written in any language
    - must have a help option with instructions
    - scores must be saved into a file
    - must use OOP
    - use of PHP is allowed
    - must have a GUI
    - if it uses a database, it must be created at runtime or be included
    
    - must fit into a zip file of a maximum of 5MB
    - a runnable executable must be included
    - fully commented sourcecode must be included


3.) How to play
---------------
    From the main menu use up and down arrow keys and enter-key to go to
    "Choose Players" to select the players.
    
    In the "Choose Players" menu, use up and down arrow keys to navigate through
    the registered player names and use left and right arrow keys to assign the
    green and the red tanks to two different players.
    
    Navigate to "register new player" and hit enter to register a new player.
    Use the escape key to go back to the main menu.
    
    Use left and right arrow keys in main menu to select the battle arena.
    
    Navigate to "Start Game" and hit enter-key to start the match.
    
    In the game, the control keys are the following.
    green tank:
    Q,W    - rotate gun counterclockwise, clockwise
    A,S - rotate tank counterclockwise, clockwise
    E - toggle engine between <forward, stop, reverse, stop>
    D - fire gun (only possible if it is loaded)
    
    red tank:
    numpad7, numpad8 - rotate gun counterclockwise, clockwise
    numpad4, numpad5 - rotate tank counterclockwise, clockwise
    numpad9 - toggle engine between <forward, stop, reverse, stop>
    numpad6 - fire gun (only possible if it is loaded)
    
    alternate keys for red tank for keyboards that don't have a number pad
    are U,I,J,K,O,L
    
    Each players goal is to destroy the other tank or to do as much damage as
    possible within the timelimit to win.
    
    Shooting builds up heat. Getting hit builds up heat as well.
    If a players tank is too hot, it can not shoot until it cools down a bit.
    
    The more damage a tank has taken, the slower it will be able to move.
    
    The winning player scores one point.
    The winning player scores two additional points if he wins without
    taking any damage.
    
    Have Fun!
    
    You can always check how well each individual player did, by viewing the
    "Scoreboard" from the main menu.
    
    
4.) Making Of
-------------
    the Development Log (Making Of) for this game can be read online
    at the "Game Developers Refuge"[R3]
    
    
5.) Copyright & Spreading
-------------------------
    all code is (C) 2009 by Dennis Busch,
    reuse without explicit written permission from author for any purpose other
    than compiling it into a runnable executable is strictly prohibited

    all graphics are (C) 2009 by Dennis Busch,
    reuse without explicit written permission from author for either commercial
    or non-commercial use is strictly prohibited

You may spread as many copies of this archive as you wish, provided that you
keep the archive intact and in its original form and that you do not remove or
change this copyright notice and that you do not claim to have intellectual
ownership rights to any of its content.


6.) References
--------------
    [R1] Allegro - http://alleg.sourceforge.net/
         Allegro is released as giftware by the Allegro developer community.
    
    [R2] Combat - http://en.wikipedia.org/wiki/Combat_(video_game)
         Combat is (C) 1977 by Atari, Inc.
    
    [R3] DevLog of TankGame at the Game Developers Refuge
         http://gamedevelopersrefuge.org/GDR/viewtopic.php?t=907
         the GDR is an online community where independent game developers from
         all over the world share their experience


Development Environment Screenshot:
http://freenet-homepage.de/dennisbusch/shared/codediary2009_05_03_1016.png
(edited, pic to link)
_________________
0xDB


Edited by 0xDB on Sun May 03, 2009 10:39 am; edited 1 time
View user's profile Send private message Visit poster's website
Ninkazu
Contributor

Joined: 21 Sep 2005
Posts: 482
Location: Austin, TX
PostPosted: Sun May 03, 2009 10:04 am    Post subject: Reply with quote

Why no, that picture isn't huge at all O_o
_________________
Get woke. Stay woke. ~@deray
View user's profile Send private message Send e-mail Visit poster's website
mikedoty
Developer

Joined: 18 Mar 2006
Posts: 1788

PostPosted: Sun May 03, 2009 10:26 am    Post subject: Reply with quote

Dennis how many characters long will I need to make this message before it wraps to the second line for you? Just how many monitors do you have? Or one really really big widescreen monitor?
_________________
The end of the game, yes, is pretty much getting the weapon and killing off the population.
mashup games . com | Finally! - A Lode Runner Story
View user's profile Send private message Visit poster's website AIM Address
0xDB
Developer

Joined: 26 Dec 2005
Posts: 1651
Location: Your consciousness.
PostPosted: Sun May 03, 2009 10:40 am    Post subject: Reply with quote

I'm sorry, I got the message. Pic is now linkified.
It's just two monitors, one big wide main screen and another small one for docs, IRC, references.
_________________
0xDB
View user's profile Send private message Visit poster's website
0xDB
Developer

Joined: 26 Dec 2005
Posts: 1651
Location: Your consciousness.
PostPosted: Sun May 03, 2009 12:38 pm    Post subject: Reply with quote

Ok, it's been a productive weekend, even though I did not get as much done as I had hoped for. All the boring bookkeeping classes are implemented and ready to use, which will significantly speed up the process of assembling the various building blocks to make the actual game.

So far, the GameState just initializes Allegro, writes an error log, loads the resources, runs a short display test(which I will use tomorrow at school to see, if the computers there can even run it, as they don't have DirectX installed but Allegro should automatically fall back to using GDI then... I'll see) and then frees resources and de-initializes everything again.

updated development environment screen (resized this time):

_________________
0xDB
View user's profile Send private message Visit poster's website
Reply to topic GDR Forum Index -> Game Developer's Refuge -> Development Log - Tank Game (v:1.0e, +sound +min.fixes) Page 1, 2, 3  Next
Game Developer's Refuge
is proudly hosted by,

HostGator

All trademarks and copyrights on this page are owned by their respective owners. All comments owned by their respective posters.
phpBB code © 2001, 2005 phpBB Group. Other message board code © Kevin Reems.