Robot Builder

Started by paulscode, September 21, 2008, 12:50:23 AM

Previous topic - Next topic

Melssj5

I would prefer to do a simple level editor using a 2d matrix instead of using ascii.
Nada por ahora

paulscode

My plan is to have maps in the game be contained in 2D arrays of grid objects.  However, rather than creating a special file format to store and load maps from, the information for each grid object will be read in from three seperate files: a ground map (for grass, dirt, roads, etc), an altitude map, and a solid-object map (for rocks, trees, walls, etc).  These files will be simple ascii files containing a grid of data.  That way I can still make quick changes to maps in notepad, without having to involve the map maker (for example, if I just want to move a rock or something).  For Robot Builder, these are the only three maps I need, however when I move on to Universe Storage I could potentially add in additional maps to use in conjunction with the others, such as a portal map (to connect locations), a fog map, and an element map (for water, mud, fire, etc).  I am sure my ideas will evolve as I get further into development of the map maker and discover what I need. 

paulscode

I am making good progress on the map builder program.  It is able to read and write terain and altitude maps.  Here are a couple of screenshots:



These maps were generated programatically, saved, and then loaded from the generated ASCII files.  Now what I need to do create some type of GUI for manually editing maps.

zammbi

Thats cool. Maybe something I should look into the future of generating those kinds of maps.

JavaMan

Nice. How many polys are in one terrain?

paulscode

Quote from: JavaMan on September 29, 2008, 06:38:48 PM
Nice. How many polys are in one terrain?
In the above screenshots, I used a 32X32 grid, which is 2048 pollys (two triangles per grid square).  I can easily change the dimentions of a map if I decide I want more or fewer polys.  You may also notice that the terrain looks somewhat faceted in these screenshots.  That is because the normals are calculated on a per-square basis, and therefore they do not take into account the adjacent squares.  I believe the appearance can be made smoother by recalculating all the normals after the entire map has been loaded.  I could probably also compress the mesh considerably, since each vertice inside the terrain is coppied 4 times.  All this "beautification stuff" will be done in the actual game whenever a map is loaded.  For the MapMaker program, the faceted look is not really a problem, since I am not going for anything super-professional looking at this point, just functional.

paulscode

I have finished the map maker program.  It uses a hybrid keyboard/programatic interface in conjunction with notepad.  Probably only I can understand how to use it, but it does serve its purpose  ;D.  I plan to eventually come back and expand the map maker for Universe Storage, but for now it will work just fine for RobotBuilder, since there is only going to be one room in the game.  Now I am going to start work on the map loader code which will be used in the game.  In addition to loading the map (which I have already coded, of course), it will need to recalculate all the normals, generate a single mesh and compress it (remove duplicate vertices), and assign it to an Object3D.

paulscode

I have finished the map loader, and have been working on camera movement.  Before jPCT I had virtually no experience with 3D, and trigonometry was never my strong point in school, so the learning curve has been rather steep.  I'm currently trying to work out an intuitive way to rotate and zoom around the map.  My thought is to first create two dummy objects.  One is a focal point, and the other is a satellite.  The satellite is a child to the focal point.  I match the cameras position and orientation to the satellite.  This will allow me to orbit the camera around just by rotating the focal point, and I can zoom in and out by moving the satellite closer to or further from the focal point.

paulscode

I've decided to go back and do a little more work on the map builder program.  I need to practice creating menu systems and interacting with the world via the mouse, and it seems to me that the map builder is the perfect place to do that.  I might even end up with something useful that other people can use (ATM, I'd be too embarassed to release the source code ;D)

paulscode


I created a simple applet for generating the terrain Object3D from scratch rather than cloning a grid model loaded from a .3ds file.  The entire terrain is a single Object3D.  You can interact with the terrain via the mouse.  When you click on the terrain, whatever cell you click gets colored red, and messages print out for the 3D point that you clicked on, what it translates to in 2D map coordinates, and the map cell number.

Here is a link to the applet:
http://www.paulscode.com/source/calcMinDistanceTest/

And here is the source code for this applet.  I tried to put in enough comments, but if you have questions about anything, let me know:
http://www.paulscode.com/source/calcMinDistanceTest/MapClick.java

paulscode

Progress on the Map Maker has been a little slow because I am working on a couple of other projects as well, but I have managed to do some work on it.  I created an applet to demonstrate what the program can do so far:

http://www.paulscode.com/games/RobotBuilder/MapMaker/27OCT2008/

This is basically the same as the applet in my last post, except that now the terrain is not just a flat square, demonstrating that the Interact2D stuff will work with any shape of terrain.  Additionally, actual terrain textures are used instead of solid colors, and I added in a click sound effect.  SoundSystem is definitely overkill for this applet, but hey - I wrote a sound library so I figure I might as well use it once in a while ;D

You will probably notice that you can't create a smooth curved road with just two textures.  This will be solved the same way it is done for a 2D game map - by drawing edge and corner texture images.

fireside

click here->Fireside 7 Games<-

EgonOlsen

Works fine. I would like to draw on that surface instead of clicking each and every time that i want to place a brown spot... ;)

paulscode

Quote from: EgonOlsen on October 28, 2008, 11:39:46 PM
Works fine. I would like to draw on that surface instead of clicking each and every time that i want to place a brown spot... ;)

I was thinking the same thing ;D

paulscode

I've been thinking about ways to reduce the size of everything, since Robot Builder is going to be a web applet.  I'd kind of like to experiment with deleting classes from jpct.jar that I am not using, as well as experimenting with obfuscation.  Of course I will need approval from Egon first (pleeeease may I? :D)