• 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.
Sign in to follow this  
Followers 0
CarlosMartinez

Basic Java Concepts

6 posts in this topic

hello, im new in this website, so im not sure im posting in the right forum, i feel like im a beginner in game development so this should be the right place.

anyways, recently, i've been wanting to learn java, lets say i know most algorithm basics, i just need to learn the visual stuff, the input stuff, and the networking stuff.

i concluded that making a game would be a nice way of learning all that, and i've always wanted to make a games so it would be a win win win for me, so if anyone could give me some advices it would be just great.


yes i know that asking for advices might get hard to you because there is too much field to cover, so i came up with some specific questions about it so its easier for you to help me :), here they are:

1- how does the networking stuff works, like if i want to make an online game, that works by turns, lets say like chess, but also played in real time, how would the networking process be?

2- can java work properly with mysql? if yes, is there any basic tutorial or special info i need to know about it? if no, what kind of databases would i have to use?

3- lets say i want my "chess" game to be 2D, because i like 2D better, but i want it to have a 3D effect, lets say like this game: http://armorgames.com/play/2205/light-bot , please notice the way the tiles work in the game, like as if the field had 2-3 or even 4 floors, how would it work?
(im not sure if i can post links, if its against the rules and a mod is reading this please delete number 3, thank you).

4- in case you are wondering, "what about the input stuff", thats what brought me to this website, i found a great java tutorial special for inputs here: http://www.gamedev.net/page/reference/index.html/_/reference/programming/languages/java/java-games-keyboard-and-mouse-r2439, so i will be studying all the code deeply and maybe ask some specific questions when they appear.

just to be clear, im not making a chess game, its just an example that fits all what i want now, and save me all unnecessary explanations.

thank you for reading. and answering :D

and sorry if my english is wrong, my native language is spanish so im trying my best here :). let me know if there is something wrong with this post :)
0

Share this post


Link to post
Share on other sites
[quote name='Xeinnex' timestamp='1309662220' post='4830514']
1- how does the networking stuff works, like if i want to make an online game, that works by turns, lets say like chess, but also played in real time, how would the networking process be?[/quote]
Java gives you access to sockets either via the [url="http://download.oracle.com/javase/1.4.2/docs/api/java/net/package-summary.html"]java.net[/url] or [url="http://download.oracle.com/javase/1.4.2/docs/api/java/nio/channels/package-summary.html"]java.nio[/url] packages. If you know about sockets in general, you can work with those with extremely little effort.
There is also Java's remote method invocation (RMI) framework, but that was not designed with games in mind and I would not seriously consider using that for making a game before I made a very serious analysis of my needs and requirements versus what RMI can offer.
In any case, network code is not something I would suggest for a beginner, especially not starting from sockets and building up. Either start with a single player game or search for a networking library which successfully hides the worst from the user.

[quote name='Xeinnex']
2- can java work properly with mysql? if yes, is there any basic tutorial or special info i need to know about it? if no, what kind of databases would i have to use?[/quote]
While I have not worked with mySQL I would be highly surprised if it did not provide a [url="http://download.oracle.com/javase/tutorial/jdbc/"]JDBC[/url] driver to work with.

[quote name='Xeinnex']3- lets say i want my "chess" game to be 2D, because i like 2D better, but i want it to have a 3D effect, lets say like this game: http://armorgames.com/play/2205/light-bot , please notice the way the tiles work in the game, like as if the field had 2-3 or even 4 floors, how would it work?
(im not sure if i can post links, if its against the rules and a mod is reading this please delete number 3, thank you).[/quote]
I believe you want to make isometric game if I understand you correctly. Anyway, in the simplest case as shown in the flash game you linked, you can simply draw each tile by drawing the bottom-most <whatever> on the tile and progressing up. Tiles must just be rendered in the right sequence (back to front) so they overdraw each other correctly.
2

Share this post


Link to post
Share on other sites
There is JDBC for it, I've used it. Networking is super easy as described above.

I wrote some games in Java [url="http://trifecta.cultmonkey.com"]here[/url] (with source) that shows both input handling and overriding Component classes to do painting. Look at the spinner box for a clean Component example or at "PieBells" for a more complete example.

There's multiple Java programmers here, feel free to ask when you run into trouble spots.
1

Share this post


Link to post
Share on other sites
thank you for your responses, i think im going to follow BitMaster's advice and stay away from the networking until i get a more solid knowledge of everything else, anyways i have more questions, im not sure if i should ask in the same thread, or start a new one but here i go:

firstable im going to re-make my last 3rd question, the idea is to have a grid, but the part that confuses me, is that i dont want it to be like a square grid, lets let this quick image talk by itself: http://rookery9.aviary.com.s3.amazonaws.com/8815500/8815715_27d0.jpg so, how would you make that kind of grid like the one at the right?


new questions:

1>> how do you make .exe with java? and how do the folders work, like the bin, data, etc.

2>> is there a special way to make your application go fullscreen? or is it just some java method?

3>> how exactly would a sprite based animation work in java? i've read people uses this kind of spritesheets: http://i25.tinypic.com/vnz136.png and im not sure if its necessary, but i noticed they were all png files.

3.2>> if those "spritesheets" are the way to animate characters in java, how would you use them?
0

Share this post


Link to post
Share on other sites
To make an exe, you find a jar bundler. You can produce jar files that are bundled softwares that run like programs if you have Java installed, and you can find software that packs these into exe files.

Caveats: Java software requires a JRE (runtime environment) to be installed. If your bundler doesn't bundle the JRE, you'll have to hand-craft an exe launcher or ask that the user install Java.

I went the complete bundling route with our application because requiring that Java be installed separately was causing way, way too much trouble.

So I wrote a launcher in C with the Windows API. On OS X, I used a launcher that Apple provides.

Regarding your grid, I did this [url="http://burtonvision.com/images/newtiles.png"]here[/url]. It is a basic math problem (Algebra, actually). You have a set of tiles, and each tile has a coordinate, and you iterate through the list, and you have a piece of code that maps a tile's coordinate to a screen position. For each tile, you can either paint a sprite that looks the shape you want as I did in the previous link, or use the java.awt.Graphics API to draw the actual shape or lines as I did in this more primitive shot [url="http://burtonvision.com/images/fight1.png"]here[/url].

But that function is the key point; you have a function that's given a Point representing the game board coordinate and it returns a Point representing where to draw it on screen. For the effect you want, you'll want to look at the modulus operator. Some code like "y % 1 == 0 ? true : false" would yield a true or a false value based on whether the row number is odd or even. Alternatively, you could actually have the tiles slant diagonally as you go rightward.

You'll find that programming features a [i]lot[/i] of "story problems" such as this where you must craft a math function or algorithm to meet some kind of specification, so, if you're good at those in school, you'll be fine.

An inverse function would be able to map a screen coordinate (for example from a mouse click) to the game grid.

Refer to the Spinner Box code in the link I gave in my previous post to see an example of overriding a JComponent to redo the paint operation. (This is explained in many manual pages, the code I posted is just there because it's a working example.)

Fullscreen? Yes. Just Google it, you're looking for "full screen exclusive" mode.

Sprite sheets; literally the Graphics API has a paint method that lets you choose both the [i]source[/i] shape and the [i]destination[/i]. So if you have a 4x4 sheet of pictures, you can actually specify which subset of the pixels you want to use for drawing and where to put them. There is one method for this (paint).

The "Pie Bells" example uses a primitive sprite sheet (more of a strip really).

I might be able to send you the code for that board game I linked earlier, with redactions, but that'd eat some of my time so only ask if you plan to read it.
1

Share this post


Link to post
Share on other sites
normaly u won't need to pack your jar into a exe, because if a java runtime(JRE) is installed on a PC u can just start the JAR as any other app.

In the case where u don't know if your user have a valid JRE installed, or corretly configurated, u have to options.
The preferred one should be to use Java Webstart, it allows a user to "install" your application by clicking a link on a website. This approche makes sure that the user has a JRE installed and handle alot of other things too.

In the case that u want to do it a little more oldschool or just want to be able to send someone without internet your app. Wrapping your java app in a Exe Launcher is the best way.
For this case are a lot of free and comercial software out there. I use [url="http://launch4j.sourceforge.net/"]Launch4J[/url] cause its free and has a lot of configuration options.
2

Share this post


Link to post
Share on other sites
actually i'd love to see that grid source, even when its not exactly the same, im pretty sure its the same idea.

after reading here and there about my questions, i think the best way would be to start working on small game projects testing all the different stuff im going to need for my big game, the reason being that i dont want to make a big mistake that will cost me lots and lots of time after a while, i need to get dirty with java before i can think of something big, anyways, that source code would be really helpful, i want to start doing a map generator, so the gridding methods are top priority for me right now :), thank you all for your answers, ive been here for 2 days and i can tell already that this is a wonderful community, lets hope i could be the one helping others soon :)
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0