www.jpct.net

jPCT - a 3d engine for Java => Projects => Topic started by: paulscode on September 21, 2008, 12:50:23 am

Title: Robot Builder
Post by: paulscode on September 21, 2008, 12:50:23 am
-- This slot is reserved for resources, links, and screen shots --

(http://www.paulscode.com/games/RobotBuilder/concept/RobotSketch1.jpg)  (http://www.paulscode.com/games/RobotBuilder/concept/Robot1.jpg)

Robot Builder 2D (http://www.paulscode.com/games/RobotBuilder/21SEP2008/)  (Unfinished)
My original 2D version of Robot Builder.

3D Robot Viewer (http://www.paulscode.com/games/RobotBuilder/22SEP2008/RobotViewer.html)
Applet I created to test my 3D robot.


Robot Odyssey (http://en.wikipedia.org/wiki/Robot_Odyssey)  (Wikipedia)
The inspiration for Robot Builder

The Robot Odyssey Resource (http://members.aol.com/fractal101/odyssey.htm)
AppleWin emulator and Robot Odyssey disk images
Title: Re: Robot Builder
Post by: paulscode on September 21, 2008, 01:08:00 am
Project Overview:

This project is a stepping stone to my ultimate goal - a 3D browser-based RPG which, until I come up with a better name, I am calling "Universe Storage".  The concept for "Robot Builder" is to create IC chips, then wire them up inside a robot to make it do stuff.  It is a little like the concept of an old game I used to play called "Robot Odyssey" (This game was a great way for anyone to learn the basics of logic and electric engineering in a relaxed-pace, fun environment - one of my favorites back in the day.  I recommend googling it).  I have already created a class called "Part", which is managed in a class called "PartManager".  From the "Part" template, I have created the following logic gates: AND, NAND, OR, NOR, XOR, XNOR, and NOT.  I also made TFlipflops and SRFlipflops.  I began creating Robot Builder in 2D, because when I started the project I had almost zero experience programming in Java.  But now after completing the SoundSystem library, I am quite familiar with Java, and would rather put more work into learning to use jPCT in an actual game. 

How this project will fit into Universe Storage is that I want the RPG to be economy-driven.  Characters will have skills, which various activities in the game will increase.  Higher skill numbers will mean better weapons you can use, more quests you can do, and more valuable things you can make. Robots will be useful for assisting players in combat, obtaining items, or completing quests.  It will be possible to construct robots and weapons from parts you make yourself, buy in shops or from other players, or win in quests.  Where the "Robot Builder" concept comes into play, is players will then be able to design chips, and wire them up in their robots and weapons.  They can then either use the weapons and bots themselves, or sell them to other players who aren't smart enough to design their own chips, or who are more interested in other aspects of the game, like leveling other skills, questing, or PK'ing.

This project will be my first attempt to create a 3D robot builder game.
Title: Re: Robot Builder
Post by: paulscode on September 21, 2008, 09:24:07 pm
I thought I would explain how Robot Builder is going to work, in case anyone was curious about it.  The way the controls are supposed to work is that you open a chip editor and drag flip-flops and logic gates from a toolkit into the editor to wire them up together and create an IC chip.  From there, you would be able to click on the robot and wire the IC chip into it.  The robot would behave depending on the circuit.  If you happened to look at the 2D version of Robot Builder, what you are seeing there is a wall-hugger circuit at work.  Graphically, it would look like this:
(http://www.paulscode.com/games/RobotBuilder/concept/WallHuggerCircuit.gif)
Since I never finished the menu system, I programatically hardwired the circuit into the robot just to test the PartManager infrastructure and connecting to inputs and outputs on the robot.
Title: Re: Robot Builder
Post by: EgonOlsen on September 21, 2008, 11:04:51 pm
The concept sounds interesting...i've never player this game, but i've played Robo Sports on Amiga and Windows. It had programmable robots, too. But you didn't have to build up circuits to control them but create your program out of simple commands like move, shoot, duck, choose weapons, turn, watch...that kind of stuff. It was much fun in multiplayer and i always wanted to remake it. I just didn't have the time/talent to create all the animations and models that this would require.
Title: Re: Robot Builder
Post by: raft on September 22, 2008, 12:33:18 am
interesting stuff ;) did you know about robocode (http://robocode.sourceforge.net/) ? similarly you build robots and fight them in tournaments. but instead of chips or other building blocks, one writes java code
Title: Re: Robot Builder
Post by: paulscode on September 23, 2008, 04:11:25 am
Today I created a robot model (rather ugly, but it'll work for now ;D).  I created a test applet to test the robot's inputs and outputs. sound effects, and screen animation:
http://www.paulscode.com/games/RobotBuilder/22SEP2008/RobotViewer.html (http://www.paulscode.com/games/RobotBuilder/22SEP2008/RobotViewer.html)
Title: Re: Robot Builder
Post by: fireside on September 23, 2008, 06:35:09 am
Kind of cool.
Title: Re: Robot Builder
Post by: paulscode on September 23, 2008, 11:06:31 pm
I noticed that the "Applet no sound" bug has reappeared for the above test applet on my two dell laptop test machines.  I suspect it occurred when I rearranged things in SoundSystem to propagate the exceptions back to the constructor.  I'm currently looking into the problem.
Title: Re: Robot Builder
Post by: EgonOlsen on September 23, 2008, 11:33:46 pm
Sound worked for me in that applet.

Off topic but related to sound: We've played a 3.5h long lasting session of Robombs on five machines and the sound system did a great job on all of them...everything went very well... ;D
Title: Re: Robot Builder
Post by: paulscode on September 24, 2008, 12:55:08 am
Ok, I fixed the bug with SoundSystem, and recompiled the above applet:
http://www.paulscode.com/games/RobotBuilder/23SEP2008/RobotViewer.html (http://www.paulscode.com/games/RobotBuilder/23SEP2008/RobotViewer.html)

I also posted the updated JAR's and source code on the "3D Sound using lwjgl binding of Open AL" topic.

We've played a 3.5h long lasting session of Robombs on five machines and the sound system did a great job on all of them...everything went very well... ;D
That is REALLY great to hear  :D.  Yes, I've played some fairly long-lasting Robombs games, too, and didn't have any problems.  Development of the SoundSystem library seemed like it ran into a whole lot of glitches, but (finally) it appears to be stable and reliable.

Getting back to Robot Builder, I am going to start comming up with some type of ascii-based map system which allows altitude to be defined (so levels are not all flat).
Title: Re: Robot Builder
Post by: EgonOlsen on September 24, 2008, 12:59:24 am
ASCII maps will rule the world... ;D
Title: Re: Robot Builder
Post by: fireside on September 24, 2008, 03:26:15 am
Speaking of ascii maps.  Do you guys just use a text editor to make them?  I was thinking about it, and it seems like it would be kind of hard from a design standpoint because you can't put something in the lower right corner until you've filled up the whole thing.  I think I'd rather do something like a grid, but there isn't anything around like that except a spreadsheet. 
Title: Re: Robot Builder
Post by: paulscode on September 24, 2008, 03:50:02 am
Speaking of ascii maps.  Do you guys just use a text editor to make them?  I was thinking about it, and it seems like it would be kind of hard from a design standpoint because you can't put something in the lower right corner until you've filled up the whole thing.  I think I'd rather do something like a grid, but there isn't anything around like that except a spreadsheet. 
What I usually do is create a template file to start with which is filled with a grid of spaces (or whatever the "empty character" happens to be).  Then I turn on "Insert" and start plugging away.  Just don't forget to "save as", or you'll loose you're template  ;D
Title: Re: Robot Builder
Post by: paulscode on September 26, 2008, 01:15:03 am
My initial attempt at generating a 3D map from ASCII has been successful.  However, matching the float values used in the altitude map with the normal grid map is difficult when only using notepad, because more than one character is required for each square in the grid.  I have decided that I am going to create an altitude-map editor.  It won't be anything too fancy, just a more visual way to generate the ASCII altitude map.
Title: Re: Robot Builder
Post by: JavaMan on September 26, 2008, 09:00:23 pm
I don't mean to be stupid or anything, but is there some reason why you are using ASCII maps instead of like a 3D modeler program to make your terrain? I don't really know what ASCII maps are but is a more efficient way of making terrain than using a modeler?
Title: Re: Robot Builder
Post by: Melssj5 on September 26, 2008, 09:36:40 pm
I would prefer to do a simple level editor using a 2d matrix instead of using ascii.
Title: Re: Robot Builder
Post by: paulscode on September 26, 2008, 10:36:27 pm
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. 
Title: Re: Robot Builder
Post by: paulscode on September 29, 2008, 02:14:24 am
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:

(http://www.paulscode.com/games/RobotBuilder/screenshots/HillMap.jpg) (http://www.paulscode.com/games/RobotBuilder/screenshots/ValleyMap.jpg)

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.
Title: Re: Robot Builder
Post by: zammbi on September 29, 2008, 03:09:50 am
Thats cool. Maybe something I should look into the future of generating those kinds of maps.
Title: Re: Robot Builder
Post by: JavaMan on September 29, 2008, 06:38:48 pm
Nice. How many polys are in one terrain?
Title: Re: Robot Builder
Post by: paulscode on September 29, 2008, 11:20:16 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.
Title: Re: Robot Builder
Post by: paulscode on October 01, 2008, 11:45:35 pm
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.
Title: Re: Robot Builder
Post by: paulscode on October 14, 2008, 12:36:57 am
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.
Title: Re: Robot Builder
Post by: paulscode on October 17, 2008, 05:06:37 am
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)
Title: Re: Robot Builder
Post by: paulscode on October 19, 2008, 07:57:46 am
(http://www.paulscode.com/source/calcMinDistanceTest/TerrainInteract.jpg)
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/ (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 (http://www.paulscode.com/source/calcMinDistanceTest/MapClick.java)
Title: Re: Robot Builder
Post by: paulscode on October 27, 2008, 11:39:35 pm
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/ (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.
Title: Re: Robot Builder
Post by: fireside on October 28, 2008, 03:28:46 pm
Pretty interesting. 
Title: Re: Robot Builder
Post by: 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... ;)
Title: Re: Robot Builder
Post by: paulscode on October 29, 2008, 12:29:16 am
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
Title: Re: Robot Builder
Post by: paulscode on November 15, 2008, 10:49:32 pm
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)
Title: Re: Robot Builder
Post by: EgonOlsen on November 15, 2008, 11:55:38 pm
Yes, you may... ;D
Title: Re: Robot Builder
Post by: paulscode on November 29, 2008, 11:45:11 pm
I did some work on the Map Maker today.  I finished the toolbars for camera navigation and texture selection.  This program is starting to look kind of cool.  Here's a link:

http://www.paulscode.com/games/RobotBuilder/MapMaker/29NOV2008/ (http://www.paulscode.com/games/RobotBuilder/MapMaker/29NOV2008/)
Title: Re: Robot Builder
Post by: fireside on November 30, 2008, 02:11:56 am
Very cool! I like the sounds that go with the paint.
Title: Re: Robot Builder
Post by: paulscode on December 01, 2008, 02:41:23 am
(http://www.paulscode.com/games/RobotBuilder/MapMaker/30NOV2008/MapMakerWireframe.jpg)

http://www.paulscode.com/games/RobotBuilder/MapMaker/30NOV2008/ (http://www.paulscode.com/games/RobotBuilder/MapMaker/30NOV2008/)
Today I did some more work on the Map Maker.  Changes include:

1) The code for selecting map cells is complete.  Cells can be selected one at a time or multiple at a time while holding down "Control".  It is also possible to "drag-select" with the mouse.

2) I made it so that if any cells are selected, the paint tool will automatically fill them with whatever texture I pick.  This should save me a lot of time when I eventually start making maps for the game.

3) I made it so right-click always acts like the select tool, so I won't have to keep switching back and forth between tools.

4) I added in a visible wireframe that I can turn on or off from the Options toolbar.  This helps to distinguish one cell from the next.

5) The "Save" button in the options toolbar works nicely.  The "Load" function, however, isn't finished.

6) I added in buttons for "Select by cell", "Select by map", and "Free select".  The later two will be implemented later after I add in the ability to load more than one adjacent maps at a time.
Title: Re: Robot Builder
Post by: zammbi on December 08, 2008, 01:20:49 am
Very nice start.
Is this map editor going to be free to use for everyone?
Because I sure would use it on my game, when I start working on it again.

Title: Re: Robot Builder
Post by: paulscode on December 08, 2008, 02:13:48 am
Yes, when I finish it, I will release the source code along with a test program demonstrating how to load the generated maps in an actual game.  Of course you'd probably have to switch out the textures for a particular game.
Title: Re: Robot Builder
Post by: zammbi on August 08, 2010, 02:48:38 pm
Are you still working on this? I would love to have simple easy map editor that I can just quickly make a map, shape how I want it, load some models like trees, set the lighting, then load it into JPCT.
Just don't want to reinvent the wheel and try get another map editor.
I'm willing to help put some cash towards it if it will help :)
Title: Re: Robot Builder
Post by: paulscode on August 09, 2010, 01:00:04 am
I haven't had a lot of time for programming these days.  No thanks on the cash - I'm not very reliable as programmers go (it's more of a hobby for me than an obsession).  My schedule is crazy enough that I could never guarantee any amount of time to the project anyway (not to mention that I am over due to be non-vol'ed for a deployment).

That being said, this project is definitely still in the queue.  I'd like to get the next release of my SoundSystem out first, and I also want to finish an arcade-reminiscent space game I've been working on (originally for testing special-effects concepts, but it has kind of grown into a game of its own).  At some point I'll get back to finishing Robot Builder (and the map maker).
Title: Re: Robot Builder
Post by: zammbi on August 09, 2010, 05:34:41 am
All good.
Ill look else where then.
Thanks anyway.