• 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.


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


[java] Java 'machine'/'lego' game

3 posts in this topic

Greetings I''m currently learning java, at a fairly fast pace, and for a programming project for uni i''ve decided to make a kinda ''physics'' game/simulation thing. I''m not too worried about accuracy, etc, but I want to make it functional. Originally i was thinking about something along the lines of a 2D lego technic simulation. Since then i''ve decided this''ll probably be too hard. Right now i''m thinking of something maybe more along the lines of ''the incredible machine'' (from about 6 yrs ago). Anyway right now my 2 biggest problems are: 1) collision detection -> MAJOR problem. All i know now is how to detect if something collides with a bounding box of an object. However right now, all i want to do, is have a ball that bounces around the screen in a physicly correct manner, i.e it hits things at angles and bounces off at the correct angle etc. But is there any efficient way of doing this? Is there any fast java function that returns whether or not a point lies inside an object that isn''t necessarily a rectangle who''s sides are parallel to the applet window. 2) Redrawing stuff...say I have 3 balls bouncing around, but about 15 things the balls can bounce off. Only the 3 balls change position every tick. Is there anyway that I can speed my program up, not redrawing every single object on the screen. I''ve heard of cliping boxes but i havn''t read up enough on them to know if they''d be suitable for moving sprites. I know one thing I could possibly do is just make a background image with the objects predrawn, but i''d like to let the user place their own objects on the screen. 3)User interface -> I don''t have too much idea how how i''m going to go about it at this point. I was thinking of some drag''n''drop thing where the user picks up balls/ramps etc from a side bar, and drags them onto the playfield and drops them. Since this is more of a ''simulation'' once all the objects are positioned and the user presses "GO" then no more interaction is necessary. Anyways, I was just wondering what I''d need to do this, i''m just confused over AWT and SWING. Anyway thanks to anyone who can answer some of these badly worded questions, and i''ll probably come back here pretty soon and ask more stupid questoins.

Share this post

Link to post
Share on other sites
Let's see if I can help you out a bit...
* pseudo-ish code for the code frags..

1.) For the first problem I suggest using the Polygon class (in the java.awt package). Here you can specify a shape like this :

2.) For the second problem I suggest you using double buffering
and prepare another image for the background - (not fast but your animations will look smooth and that's the point)

// where xpoints and ypoints are array of ints

Polygon p = new Polygon(xpoints[],ypoints[],numPoints)

// then to see if a point is inside your polygon

if(p.contains(x,y)) {
// do something...


//or if you want to see if a rectangle collided/inside

if(p.intersects(x,y,width,height) {
// do something..


// when the user is finised placing the objects

// set up the back image that way you don't have draw

// each object just one big one ...

public Image setUPBackgroundImage() {
Image back = createImage(width,height);
Graphics g2 = back.getGraphics();

for(int i = 0; i < numObjects; i++) {
return back;
// then call the above function when they've finished like

// so backImg = setUPBackgroundImage() ;
// then in your paint method or update

public void paint(Graphics g) {
Image buffer = createImage(width,height);
Graphics offScreen = buffer.getGraphics();

for(int i = 0; i < numBalls; i++) {

3.) For your third question, it really matters what your making an applet or an application. If you're making an applet you should use AWT, because swing is not supported (well) on the browers. For applications use SWING, because it's a lightweight interface that's easy to use... For documentation on SWING and AWT go here.

So I hope I helped you a little () with your problems.
Remember their are more ways to do the stuff the I've shown, so if you don't like it,I'm sure someone will correct me on this forum.

silly programmer vb is for kids.

Edited by - loserkid on August 19, 2000 3:45:24 PM

Edited by - loserkid on August 19, 2000 3:48:26 PM

Share this post

Link to post
Share on other sites
That polygon class helps heaps. Thanks for the help looser kid. I"ve got a lot to learn about java, but i find learning this way is quite fun

I kind of like the idea of an applicatoin more than an applet. Also, how soon before we can expect compilers for java applicatoins...

I odn''t really know what i''m saying.. all i know is that it was quite depressing watching my applet in netscape (i''ve done absolutely no optimisation though). Then i ran my applet in IE5 with the JIT enabled...and it was sweet.

Share this post

Link to post
Share on other sites
In answer to question 2, as well as using buffering, overload the public void repaint().

Share this post

Link to post
Share on other sites