Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

12045 Posts in 1593 Topics- by 593 Members - Latest Member: zhang

23. May 2013, 10:05:56 am
Xith3D CommunityProjectsYour Projects (Moderator: 'n ddrylliog)A 3D Maze Game
Pages: [1]
Print
Author Topic: A 3D Maze Game  (Read 3064 times)
Boerboon
Just dropped in

Offline Offline

Posts: 13


View Profile Email
« on: 02. February 2007, 03:07:17 pm »

Currently I am working on a group project to build a 3D maze game.

The object of this is to find the exit with out getting without getting zapped by enemies.

Although the game is very simple (it is a fairly straighforward  project) I hope to carry on developing afterwards.  There are loads of features I would like to add to the basic game.

I am doing my degree in AI so working on the graphics is going be an interesting experince for me. I think I am going to have lots of questions!

If any one has suggestions for the game please do let me know! Smiley

Cheers
Boerboon
Logged
'n ddrylliog
Moderator
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #1 on: 02. February 2007, 04:34:10 pm »

Hi Boerboon, Welcome to Xith3D !

A maze game is a good "small project" (considering the IA part is tricky, which shouldn't be a problem for you  Grin ).

Here are my few pieces of advice :
  • If you have any questions, just ask them there before losing too much time. Even if you should find the solution by yourself a few minutes/hours later, asking can save you a LOT of time (especially since we're pretty reactive here..)
  • For level loading/saving, consider using XStream : http://xstream.codehaus.org/ loading and saving from/to XML in one line of code!
  • For graphics, I guess you'll begin with non-animated (static) models, so Blender+OBJ is IMHO the way to go (you've already seen my tutorial)
  • Consider using a Java-compatible language, ex : Rhino, Jython, JRuby, NetRexx, Nice, Groovy, BeanShell (I haven't too much experience with that aspect of development, I'm currently evaluating (understand: learning) some of these, could be interesting)
  • Use convenience classes : Canvas3DWrapper, ExtRenderLoop, ExtXith3DEnvironment, Transform  (not Transform3D), ShapeFinder, ScheduledOperation
  • If you come upon a piece of API design you think "hey man, why didn't they made it that way ?", TELL IT TO US so we can fix it. Thanks, any ideas welcome.
  • Ask for what you ever dreamt of in a 3D game API.. including tutorials (it seems to attract users, see XIN experience  Wink )
  • Why, post news about your progress, screenshots, link to project site, and so on..
  • About the game play, why not (when you're done with the "uni project" and you develop it further) provide scripting support for the user so that he can develop his own enemies easily ? "Scripting" languages cited above could be useful

'twas wise from you to ask suggestions, good luck to you !!

Note to other devs : advice above can serve to everyone
Logged
Boerboon
Just dropped in

Offline Offline

Posts: 13


View Profile Email
« Reply #2 on: 02. February 2007, 08:28:53 pm »

Hello Amos,

Thanks for the welcome and all the suggestions! They are really useful, I will certainly looking saving/loading with xstream. Smiley

I do plan to continue developing the game after the uni project is over. I would like to (if the rest of my group agree), turn the game into a tutorial for Xith3D.

I was wondering if some one could point me to tutorials about nodes, branchgroups and such like.. I have basic understanding of them but could do with some more information.

Also any pointers on building a 3D maze from a 2D array of int where 1 is a wall and 0 is open...? Grin


Would it be ok to have a Xith3D logo in the game? Say when the game starts. I think it only fair that we recognize Xith3D and work that was put into it.


Thanks

Boerboon

Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4403


May the 4th, be with you...


View Profile
« Reply #3 on: 02. February 2007, 09:48:50 pm »

  • Consider using a Java-compatible language, ex : Rhino, Jython, JRuby, NetRexx, Nice, Groovy, BeanShell (I haven't too much experience with that aspect of development, I'm currently evaluating (understand: learning) some of these, could be interesting)

I have seen BeanShell working really good. I don't know the other ones, but at least BeanShell is a good idea to start with.
But alternatively you could simply add classes implementing an interface or extending an abstract class to the classpath after compile time of your main game. This way you have full Java speed and can make use of nice IDEs like Eclipse for developing.

I was wondering if some one could point me to tutorials about nodes, branchgroups and such like.. I have basic understanding of them but could do with some more information.

http://www.xith.org/forum/index.php?topic=115.msg803#msg803

Also any pointers on building a 3D maze from a 2D array of int where 1 is a wall and 0 is open...? Grin

You could build up your level by adding an org.xith3d.geometry.Rectangle instance at any place where your array has a 1.

Would it be ok to have a Xith3D logo in the game? Say when the game starts. I think it only fair that we recognize Xith3D and work that was put into it.

That would be great. You could simply extend the org.xith3d.utility.canvas.DisplayOptions. At already displays a Xith3D logo, which is loaded from the media.jar.

Marvin
Logged
Boerboon
Just dropped in

Offline Offline

Posts: 13


View Profile Email
« Reply #4 on: 02. February 2007, 10:49:57 pm »

I have seen BeanShell working really good. I don't know the other ones, but at least BeanShell is a good idea to start with.
But alternatively you could simply add classes implementing an interface or extending an abstract class to the classpath after compile time of your main game. This way you have full Java speed and can make use of nice IDEs like Eclipse for developing.

My time for this project is limited and I don't think I will have time to learn BeanShell Sad although it does look very interesting!  I will definitely look into after the project! Grin
 

Quote
You could build up your level by adding an org.xith3d.geometry.Rectangle instance at any place where your array has a 1.

Thanks for the suggestion, I am playing with org.xith3d.geometry.Rectangle now. Smiley

Quote
That would be great. You could simply extend the org.xith3d.utility.canvas.DisplayOptions. At already displays a Xith3D logo, which is loaded from the media.jar.

Would it be possible to send me some example code to display it? Smiley

Thank you so much for your help.

Boerboon
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4403


May the 4th, be with you...


View Profile
« Reply #5 on: 02. February 2007, 11:42:30 pm »

My time for this project is limited and I don't think I will have time to learn BeanShell Sad although it does look very interesting!  I will definitely look into after the project! Grin

The good thing with BeanShell is that it is Java syntax (with really few exceptions). 

Would it be possible to send me some example code to display it? Smiley

This is a quote from the org.xith3d.utility.canvas.DisplayOptions.java:
Code:
final ImageIcon icon = new ImageIcon( this.getClass().getClassLoader()
                                   .getResource( "resources/xith3d/pictures/Xith3D-Logo.png" ) );

final double q = (((double)(icon.getIconWidth())) / ((double)(icon.getIconHeight())));

JComponent logo = new JComponent() {
    @Override
    public void paintComponent(Graphics g)
    {
        super.paintComponent( g );
       
        final int w = getWidth() - 6;
        final int h = (int)(w / q);
       
        g.drawImage( icon.getImage(), 3, getHeight() - 3 - h, w, h, this );
    }
};
logo.setMinimumSize( new Dimension( 0, 0 ) );
logo.setPreferredSize( new Dimension( 150, 150 / (int)q ) );
logo.setMaximumSize( new Dimension( Integer.MAX_VALUE, Integer.MAX_VALUE ) );

Marvin
Logged
'n ddrylliog
Moderator
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #6 on: 03. February 2007, 10:31:03 am »

Hello Amos,
Hi,

Thanks for the welcome and all the suggestions! They are really useful, I will certainly looking saving/loading with xstream. Smiley
You're welcome Smiley

I do plan to continue developing the game after the uni project is over. I would like to (if the rest of my group agree), turn the game into a tutorial for Xith3D.
Great idea!

I was wondering if some one could point me to tutorials about nodes, branchgroups and such like.. I have basic understanding of them but could do with some more information.
I saw Marvin tutorial.. is there something missing in it ?

Also any pointers on building a 3D maze from a 2D array of int where 1 is a wall and 0 is open...? Grin
Well, aside from the basic method Marvin suggested you, you could also have a data structure with an array of "Cell" objects :
Code:
    public class Cell {
        public boolean left, up, right, down;

        public void setAllOn() {
            left = true;
            up = true;
            right = true;
            down = true;
        }
    }
Then you can translate your array of booleans for false = no wall and true = a wall with that sort of code :
Code:
public Cell[][] toCell(boolean[][] level) {
        Cell[][] cells = new Cell[level.length][level[0].length];
        for (int x = 0; x < cells.length; x++) {
            for (int y = 0; y < cells[0].length; y++) {
                cells[x][y] = new Cell();
            }
        }
        for (int x = 0; x < cells.length; x++) {
            for (int y = 0; y < cells[0].length; y++) {
                if (level[x][y] == true) { // "== true" optional, more explicit
                    cells[x][y].setAllOn();
                    try {
                        if (cells[x - 1][y].right) {
                            cells[x - 1][y].right = false;
                            cells[x][y].left = false;
                        }
                    } catch (Exception e) {}
                    try {
                        if (cells[x + 1][y].left) {
                            cells[x + 1][y].left = false;
                            cells[x][y].right = false;
                        }
                    } catch (Exception e) {}
                    try {
                        if (cells[x - 1][y].up) {
                            cells[x - 1][y].up = false;
                            cells[x][y].down = false;
                        }
                    } catch (Exception e) {}
                    try {
                        if (cells[x + 1][y].down) {
                            cells[x + 1][y].down = false;
                            cells[x][y].up = false;
                        }
                    } catch (Exception e) {}
                }
            }
        }
        return cells;
    }
And then you would build your level graphic representation from the Cell[] table, with only textured org.xith3d.geometry.Rectangle(s).. see what I mean ? It's really a great optimization since it removes all faces which are between two blocks (well, If I haven't made any mistake in the code, haven't tested it). And you could also not put face at the bottom of blocks, since you won't ever see your level from under.
Better still would be if you have a "line of wall", to unite quads which are parallel to each other (that would save a lot of power, too).
So you could have really big levels and still having your game to run on minimal hardware configuration.


Would it be ok to have a Xith3D logo in the game? Say when the game starts. I think it only fair that we recognize Xith3D and work that was put into it.
I'm currently working on a small 3D cinematic with a Xith3D logo (in 3D).
I'll try to make it as convenient as possible to include in any game.

Amos

PS : Blender rocks ! Transforming the 2D image into a 3D logo has been really easy !
Logged
Boerboon
Just dropped in

Offline Offline

Posts: 13


View Profile Email
« Reply #7 on: 11. March 2007, 07:43:11 pm »

Hi Guys,

Sorry I haven't been around for awhile, been working on the design of game. This design and documentation of the game is worth 60% of the marks so we are spending loads of time on it. We are now into coding the game and having lots of fun learning Xith3D. Thanks for you replies, they have been most informative!  Grin

Quote
And then you would build your level graphic representation from the Cell[] table, with only textured org.xith3d.geometry.Rectangle(s).. see what I mean ? It's really a great optimization since it removes all faces which are between two blocks (well, If I haven't made any mistake in the code, haven't tested it). And you could also not put face at the bottom of blocks, since you won't ever see your level from under.
Better still would be if you have a "line of wall", to unite quads which are parallel to each other (that would save a lot of power, too).
So you could have really big levels and still having your game to run on minimal hardware configuration.

That is really helpful, at the moment where are building the maze with cubes as walls and a very, very large box to make the floor. I think we might try your approach Amos.

Quote
I'm currently working on a small 3D cinematic with a Xith3D logo (in 3D).
I'll try to make it as convenient as possible to include in any game.

Thanks for that it would be great. Smiley

I hope to put some screen shots of the game later this week.

Thanks again guys for you help.

Boerboon
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic