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 - Paddle Puck Page 1, 2  Next
View previous topic :: View next topic  
Author Message
0xDB
Developer

Joined: 26 Dec 2005
Posts: 1652
Location: Your consciousness.
PostPosted: Thu Sep 29, 2011 3:45 am    Post subject: Development Log - Paddle Puck Reply with quote

Looking through vacant jobs, I've come to the following conclusion: in order to get a job I'll have to become an expert in Java and SQL so...

...personal goals for October:
  • learn Java (beyond the bare basics)
  • make simple networked two player (Pong-A-Like) game in Java
So far, there is no SQL in that list, so after that, the next goal will be to extend the game (to Paddle Puck Tournament) to support registered players, holding tournaments and having server-side rankings of players (plenty of opportunities to use database stuff) and allowing players to challenge each other for friendly matches.

Here is the design document (heavily inspired by the classic Amiga game "Shufflepuck Café"):

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

Joined: 12 Nov 2010
Posts: 99

PostPosted: Thu Sep 29, 2011 9:44 am    Post subject: Reply with quote

Lol, and by the time you learn all that the market will have moved on and all they will want is HTML5 and Silverlight coders...

Just speaking from personal bitter experience...

(Though tbh SQL is probaby more of a safe bet than Java)
View user's profile Send private message Visit poster's website
Sirocco
Moderator

Joined: 19 Aug 2005
Posts: 9413
Location: Not Finland
PostPosted: Thu Sep 29, 2011 5:05 pm    Post subject: Reply with quote

Quote:

Silverlight


I get a strong feeling Silverlight is on its way out. The world seems to want to get away from Flash (or so everyone keeps telling me), so a Flash wannabe probably isn't going to last any longer.
View user's profile Send private message Visit poster's website
mikedoty
Developer

Joined: 18 Mar 2006
Posts: 1788

PostPosted: Thu Sep 29, 2011 6:01 pm    Post subject: Reply with quote

This seems like a good idea for a project... simple enough to get done in a new-ish language, but compelling enough to remain interesting. SQL can be fun, too. Sometimes. :)
_________________
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
PoV
Moderator

Joined: 21 Aug 2005
Posts: 10792
Location: Canadia
PostPosted: Fri Sep 30, 2011 6:33 am    Post subject: Reply with quote

Sirocco wrote:
I get a strong feeling Silverlight is on its way out. The world seems to want to get away from Flash (or so everyone keeps telling me), so a Flash wannabe probably isn't going to last any longer.

Yeah really. Any company that knows what they're doing is using HTML+Javascript, Flash, or PHP. Those 3 are the backbones of the internet. Java is Legacy. Silverlight is "what?".

As for the jobs though, I have no clue anymore. It's not uncommon to see companies paying big bucks to use legacy junk though.
_________________
Mike Kasprzak
'eh whatever. I used to make AAA and Indie games | Ludum Dare | Blog | Tweetar
View user's profile Send private message
yodhe
Member

Joined: 12 Nov 2010
Posts: 99

PostPosted: Fri Sep 30, 2011 1:42 pm    Post subject: Reply with quote

It was just a cynical observation with a throw-away first-to-mind example.
View user's profile Send private message Visit poster's website
Hard Rock
Contributor

Joined: 31 Aug 2005
Posts: 238

PostPosted: Fri Sep 30, 2011 11:05 pm    Post subject: Reply with quote

I remember shuffle puck cafe, I used to play it all the time back in the day. Sounds like a fun project.
_________________
Hard Rock
[The Stars Dev Company][Twitter]
View user's profile Send private message Visit poster's website
n29
Developer

Joined: 13 Sep 2005
Posts: 879

PostPosted: Sat Oct 01, 2011 5:03 am    Post subject: Reply with quote

RE Java vs php job prevalence: in my area (Kansas City metro) Career Builder returns 98 'java' listings and 12 'php' listings (python 7, ruby 5). Generally, companies aren't writing they're critical systems in dynamic languages (php, python, ruby) and imo never will. Sure there will always be 'throw away' apps that interface with legacy and/or back end systems. At work we've got a system of about 500 sql tables, a gui client and 5 web applications all talking to the same EJB middle tier. If it wasn't statically typed, it would all be more of a ball mud than it is.

One of the new guys we hired as a java web developer made the comment "I want to get more into the back end and sql than front end javascript css html". "Why?" I said. "Because I see Dave (sr dba) getting a lot more respect than Jesse (frontend guru)" That's typical for most companies I've worked at.

So, I support going for java/sql as resume/cv fodder, as that's the path I've taken myself, and so far it's paid off well.
_________________
My Blog
View user's profile Send private message
Sirocco
Moderator

Joined: 19 Aug 2005
Posts: 9413
Location: Not Finland
PostPosted: Sat Oct 01, 2011 8:47 am    Post subject: Reply with quote

If there's one thing I've learned (but not bothered to take advantage of) in the last decade it's that things move slowly in the medium-small business world, and there's plenty of good money to be made in maintaining legacy applications. COBOL and Fortran especially still bring in big bucks in metro areas.
View user's profile Send private message Visit poster's website
Gil
Developer

Joined: 14 Nov 2005
Posts: 2341
Location: Belgium
PostPosted: Sun Oct 02, 2011 12:04 pm    Post subject: Reply with quote

I don't know how it works in other countries, but job postings for web stuff here are as follows:

40% Java postings
45% .net postings
4% PHP postings
1% other
_________________
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: 9413
Location: Not Finland
PostPosted: Sun Oct 02, 2011 12:53 pm    Post subject: Reply with quote

Seems about right for web work in SE United States. There's also a ton of work for general-purpose database stuff.
View user's profile Send private message Visit poster's website
0xDB
Developer

Joined: 26 Dec 2005
Posts: 1652
Location: Your consciousness.
PostPosted: Mon Oct 03, 2011 5:47 am    Post subject: Reply with quote

So many comments... I might respond to them in more detail later.

for now, here's my progress so far:
  • installed latest version of NetBeans and JDK
  • created three projects: "Paddle Puck Server", "Paddle Puck Client" and "Paddle Puck Lib" (will get shared classes (e.g. Logging and Communication Handler(Paddle Puck Message Protocol)))
  • implemented the Server as far as that it displays a Log, Server Status and waits for and accepts two incoming socket connections (doesn't do anything with them yet)
  • implemented the Client as far as that it displays a Log, Client Status, connect/disconnect buttons and a host Textbox and which can connect and disconnect to/from the running server (doesn't do anything after connection yet)
  • implemented simple Logging class in the shared Lib which writes messages with a timestamp to the standard output (and optionally also to an arbitrary List GUI item)

There is no gamestate/game logic implemented yet.

I found that I don't really need to "learn" Java like starting from nothing, as I already know C,C++ and C# and some Java basics too. The syntax is very similar and since I also already know OO concepts, all I need to look up are syntax details for those (and of course read up on available framework classes/methods).

Next I'll have to think about the Paddle Puck Message Protocol which will define the type, sequence and format of the messages sent back and forth between client and server in order to...
...a) make sure the client and server use the same paddle puck message protocol version (before attempting any further communication)
...b) allow each side to tell the respective other side to close the connection (before closing ones' own side)
...c) allow the client to send user input (desired paddle movement) to the server
...d) make the server check the user input for validity and updating the gamestate accordingly
...e) allow the server to send gamestate updates to the clients
...f) allow the server to tell the client whether it's player ONE or TWO (this will be important for correctly displaying the gamestate as each client should see the table from a different end)
...g) do whatever I haven't thought about yet

The first version of both client and server will be kept very simple, so I can work out how everything basically fits together. After that, I should consider cleaning up the GUI parts (making use of the WYSIWYG editor in NetBeans (currently I instantiate, initialize and add all GUI elements manually, which seems a little ugly)).
_________________
0xDB
View user's profile Send private message Visit poster's website
0xDB
Developer

Joined: 26 Dec 2005
Posts: 1652
Location: Your consciousness.
PostPosted: Fri Oct 07, 2011 6:35 am    Post subject: Reply with quote

lots of progress under the hood (nothing "visible" to show yet except skeleton GUIs with a couple of textfields, buttons and log lists)
  • refactored the Client/Server into entirely self-contained classes (were previously entangled into program startup/shutdown and GUI event handlers (yuck!))
  • implemented IncomingMessageProcessing threads for both Client and Server(one per connected Client on that side) which asynchronously handle messages received from the respective other side (so far there are only two messages(Heartbeat and CloseConnection))
  • each side can now detect and close an un-gracefully closed connection
  • each side can ask the other side to gracefully close the connection before closing ones own side (and the other side handles it)
  • implemented a connection setup protocol (which is just a predefined sequence of values being sent/received after accepting a client connection to determine whether it's valid) which checks if the connected socket is actually to/from a PaddlePuckServer/Client and not from something else trying to connect on that port
  • threw away the old and ugly GUI applications and created two new ones, this time using the visual designer built into NetBeans


With all of that out of the way, I have the basic networking functionality in place. All I need to add now is the actual game. ^^

rough TODO next
  • GameState and GameState updates
  • client-side view(influenced by player number) of the GameState and pulling paddle input from the client
  • sending client input to server
  • processing client input on server(verify and adjust GameState)
  • push GameState updates to clients
  • write documentation
  • other stuff which comes up in the process of development

edit/append:
obligatory developer pr0n
_________________
0xDB
View user's profile Send private message Visit poster's website
0xDB
Developer

Joined: 26 Dec 2005
Posts: 1652
Location: Your consciousness.
PostPosted: Tue Oct 11, 2011 1:19 pm    Post subject: Reply with quote

Lost a whole day yesterday to f%@$ing around with JOGL (java bindings to opengl) until I decided against using it due to numerous problems:
First of all, it would have added several MiB in dependencies to the project (which I really did not want to because of the otherwise small size of it), second it would have introduced platform dependent files (.dll, .so and whatnot needed to access OpenGL, which I did not want to because obviously when I write a Java application I expect it to run on any platform implementing a standard Java VM) and third and probably most important because deploying it with JOGL in a truly cross-platform way would have required me to learn JNLP(or webstart) and setting up all possible JOGL native libs somewhere for on-demand download by my application (sooner or later I will have to look into such stuff but right now I want to keep things as simple as distributing a single zip file with a couple of .jar files in it). Also, JOGL seems to be in a state of transition right now and up to date documentation on how to do stuff seemed impossible to find.

Anyway, so today I looked for an alternative to using OpenGL (even thought about writing my own fixed camera pseudo 3D renderer for a moment) and I found JPCT which includes a powerful software 3D renderer and it's very small and independent of JOGL (as long as one decides to use only software rendering which I do because I really don't need hardware acceleration for this simple project and the very few polygons that my scene will hold).

I wanted to get something visible on screen fast to pull my motivation up again so I decided to write the client side view next (even though the gamestate never changes atm, so it just shows it in its default state right after construction):

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

Joined: 26 Dec 2005
Posts: 1652
Location: Your consciousness.
PostPosted: Wed Oct 12, 2011 10:05 am    Post subject: Reply with quote



Implemented client<->server communication for paddle movement and client-side paddle control today.
While the client is unconnected it simply moves the first players paddle around in the local game state (this is seen in the beginning of the above video).

Simplified, paddle movement works like this:
Client accumulates relative mouse movement all the time and periodically sends that accumulated "Paddle Displacement" to the server.
(or periodically just updates the local gamestate in case the client is not connected)

Server tells the game state on its own side "hey! listen! client a/b wants to displace their paddle by this much".

Server periodically updates the game state on its own side which then checks and uses that previously set "Desired Paddle Displacement" data to do the actual paddle movement and then sends positional updates back to clients so they can update their own game state accordingly.

Easy. I'm surprised I didn't have more trouble getting this implemented and properly synchronized but Java makes it really easy to synchronize threads' access(es) to your data.

What's left TODO:
actual game logic (collision detection, puck movement, scoring, other gamestate handling (thinking of a match-time countdown / pre-match Get Ready phase) )
A server side view of the gamestate would probably be nice as well and server side controls to reset the gamestate.
Documentation.
Testing on a real network (instead of running everything locally).

Next I will focus on game logic to get it playable as soon as possible.
_________________
0xDB
View user's profile Send private message Visit poster's website
0xDB
Developer

Joined: 26 Dec 2005
Posts: 1652
Location: Your consciousness.
PostPosted: Sat Oct 15, 2011 1:52 pm    Post subject: Reply with quote

Does anyone else put ascii art into their comments to illustrate stuff?

Code:
/**
   * tests whether the puck and a paddle would collide if they were currently at the given target positions
   *
   *
   *    6-----------5------------4
   *    |                        |
   *    7                        3
   *    |                        |
   *    0-----------1------------2
   *   
   * @param targetPaddleXZ target position for the paddle
   * @param targetPuckXZ target position for the puck
   * @return -1 no collision, 0 to 7 if there is a collision (describing the vertex or edge of the paddle where the puck would collide with it)
   */
  public int puckPaddleCollision(Point2D targetPaddleXZ, Point2D targetPuckXZ)

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

Joined: 19 Aug 2005
Posts: 9413
Location: Not Finland
PostPosted: Sat Oct 15, 2011 2:16 pm    Post subject: Reply with quote

I use ASCII for menu mockups and diagrams, but they stay in separate files, rather than in the code itself.
View user's profile Send private message Visit poster's website
I_are_n00b
Member

Joined: 12 Oct 2005
Posts: 88
Location: Houston, Texas
PostPosted: Sun Oct 16, 2011 4:28 pm    Post subject: Reply with quote

...wow... ascii art in comments, that's a great idea.... menu layouts (menus in general) are the bane of my game dev experience.
_________________
http://www.optionalquest.com
View user's profile Send private message Visit poster's website AIM Address
sonrisu
Moderator

Joined: 31 Aug 2005
Posts: 4979
Location: Silicon Valley!
PostPosted: Sun Oct 16, 2011 4:33 pm    Post subject: Reply with quote

Quote:
Does anyone else put ascii art into their comments to illustrate stuff?

When something is difficult to express in words alone, then yes--every time.
_________________
loomsoft :]
View user's profile Send private message Visit poster's website
0xDB
Developer

Joined: 26 Dec 2005
Posts: 1652
Location: Your consciousness.
PostPosted: Mon Oct 17, 2011 1:54 pm    Post subject: Reply with quote

Collision detection and handling is basically finished now (may just need some tweaking to feel good (it kind of does already though)).

Before I started writing any code for the collision/deflection/puck acceleration stuff I spent two to three hours, drawing sketches on paper, trying to come up with clever ways of projecting/adjusting the pucks final target-position in each cycle with a couple of complicated formulas and crap until I thought of a much simpler solution: limited precision timesteps!

The oversimplified basic idea behind that (for "generic" application as in not specific to this one game) is this:
1) determine the fastest moving object o in the scene (this will be the reference object)
2) determine the distance that object is going to move d
3) determine the number of timesteps for the limited precision timestep based collision detection ts = ceiling(d / desired precision)
The desired precision should be the travel distance of the slowest moving object moving faster than not at all for the generic case (in Paddle Puck I've chosen to use a precision of 0.5 cm).
4) iterate from 0 to ts { calculate each objects temporary target position by moving it a ts-fraction of its' total speed / test for object collisions in temporary positions and handle each accordingly }

For this to work though a restriction in step 4 is that no object should ever change the speed of another object to be faster than the current top speed as the result of a collision.

Here's me playtesting the collision stuff against the simplest artificial stupidity (which is just two lines of code, determining the target pucks x coordinate (without taking border collisions into account) and then uttering a desire to move the paddle there).


The more I implement and the less there is to do, the more I seem to procrastinate. I played around with this new collision feature a lot while I was writing it because it was so much fun to finally see the puck moving and as it was starting to work like it would when the game is finished.
_________________
0xDB
View user's profile Send private message Visit poster's website
n29
Developer

Joined: 13 Sep 2005
Posts: 879

PostPosted: Mon Oct 17, 2011 6:02 pm    Post subject: Reply with quote

Looks good! Also cool to see you're using a double editor window in Netbeans, that's what I as well. Looks like your screen is a bit larger than mine though.
_________________
My Blog
View user's profile Send private message
0xDB
Developer

Joined: 26 Dec 2005
Posts: 1652
Location: Your consciousness.
PostPosted: Fri Oct 21, 2011 7:09 am    Post subject: Reply with quote

My native resolution is 1920 x 1200. Double editor window is really nice, I'm using it in Visual Studio as well. It's especially nice for this project because I keep all the client code on one side and the server code on the other and when implementing new messages, I can view the send/receive/handle code side by side.

Haven't worked on this a whole lot over the past few days but I've got scoring/puck reset/alternating "serve" logic in now (players take turns in getting the puck served slowly to their side from the center).

I still need to do the match countdown and the pre-match phase stuff and write documentation before I'll make the first release(or beta or whatever). It's already playable though and all the interesting stuff is implemented now (which is somehow dragging my motivation down a bit).


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

Joined: 26 Dec 2005
Posts: 1652
Location: Your consciousness.
PostPosted: Sun Oct 23, 2011 11:19 am    Post subject: Reply with quote

First public release (kind of semi-public as I haven't put a link to that page anywhere on my main page yet) of Paddle Puck (only posted on g+ so far)!

It's probably best to call it a beta as so far I haven't had a chance to test this over a real network and only ever played locally against myself. :P

Please try and play and let me know what you think.

http://www.dennisbusch.de/paddlepuck.php
_________________
0xDB
View user's profile Send private message Visit poster's website
n29
Developer

Joined: 13 Sep 2005
Posts: 879

PostPosted: Sun Oct 23, 2011 5:32 pm    Post subject: Reply with quote

Be prepared to be disappointed with tcp performance over the internet. There are a couple of 'stream over UDP' libraries for Java out there. Generally you want stuff like chat and join/leave over tcp, then near real time data over udp for speed.

Thread at javagaming.org that talks about the challenges:

http://www.java-gaming.org/topics/udp-vs-tcp-ip/608/view.html

Kryonet:

http://code.google.com/p/kryonet/
_________________
My Blog
View user's profile Send private message
Gil
Developer

Joined: 14 Nov 2005
Posts: 2341
Location: Belgium
PostPosted: Sun Oct 23, 2011 6:21 pm    Post subject: Reply with quote

TCP and lockstep will be more than fine enough for something like this.
_________________
PoV: I had to wear pants today. Fo shame!
View user's profile Send private message Visit poster's website
Reply to topic GDR Forum Index -> Game Developer's Refuge -> Development Log - Paddle Puck Page 1, 2  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.