{"id":16399367,"url":"https://github.com/joshthederf/incredibots-2-html5-open-source","last_synced_at":"2025-09-03T03:40:35.404Z","repository":{"id":74630357,"uuid":"328428990","full_name":"JoshTheDerf/Incredibots-2-HTML5-Open-Source","owner":"JoshTheDerf","description":"HTML5 Port of Incredibots 2 CE","archived":false,"fork":false,"pushed_at":"2021-09-11T02:17:31.000Z","size":125876,"stargazers_count":22,"open_issues_count":1,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-08-22T15:21:28.920Z","etag":null,"topics":["box2d","flash","html5","html5-game","physics-game","sandbox-game"],"latest_commit_sha":null,"homepage":"https://joshthederf.github.io/Incredibots-2-HTML5-Open-Source/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JoshTheDerf.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-10T16:36:29.000Z","updated_at":"2025-06-06T10:45:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"fb784338-8563-4259-b4b3-1b37398a0236","html_url":"https://github.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JoshTheDerf/Incredibots-2-HTML5-Open-Source","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoshTheDerf%2FIncredibots-2-HTML5-Open-Source","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoshTheDerf%2FIncredibots-2-HTML5-Open-Source/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoshTheDerf%2FIncredibots-2-HTML5-Open-Source/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoshTheDerf%2FIncredibots-2-HTML5-Open-Source/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JoshTheDerf","download_url":"https://codeload.github.com/JoshTheDerf/Incredibots-2-HTML5-Open-Source/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoshTheDerf%2FIncredibots-2-HTML5-Open-Source/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273386663,"owners_count":25096247,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-03T02:00:09.631Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["box2d","flash","html5","html5-game","physics-game","sandbox-game"],"created_at":"2024-10-11T05:24:00.496Z","updated_at":"2025-09-03T03:40:35.376Z","avatar_url":"https://github.com/JoshTheDerf.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Incredibots 2 HTML5 Open Source\n\nEarly-stage project attempting to port the flash game [IncrediBots 2 CE](http://incredibots.com/if/game.php) to TypeScript and PIXI.js.\n\n## IncrediBots Open Source README from the original developers of the Flash version\n\n*Development environment instructions in what follows do not apply to the HTML5 version.*\n\n## PLAYING THE GAME\n\nThank you for downloading IncrediBots!  Get ready to build, control, and share your\nvery own robot creations in a physics-based playground!\n\nTo run IncrediBots or IncrediBots2, simply open the file incredibots.html or\nincredibots2.html in a web browser with flash player installed.\n\nEnjoy!\n\n## BUILDING FROM SOURCE\n\nThe source code for the IB1 and IB2 game clients are located in the src/Incredibots\nand src/Incredibots2 subdirectories.  Open up the actionscript IDE of your choice\n(I used Flex builder 3), and create a new project using the appropriate directory.\nThe main runnable application file should be set to Main.as, and I used the param\n-default-frame-rate 30 as a compiler argument.  Also make sure to link to the\nflGUI.swc library in the libs folder.  The source code contains a few [Embed]\nstatements, that I believe may only work with Flex builder, but other IDEs likely\nhave similar methods of linking to assets.\n\nOnce everything is set up and the project compiles properly, the IDE should create\na bin-debug folder (or something similar), containing the SWF and an HTML file that\nembeds the SWF.  Now you'll be able to make changes to the code and see them\nreflected in the built SWF!\n\n## CLIENT SIDE CODE\n\nI'll give a basic overview of the key classes in the client side code, in hopes of\nmaking it clear how exactly everything works.  The main application class is Main.as,\nwhich takes care of adding event listeners to the stage, and determining which\n'Controller' class is active.  You can think of a controller as loosely representing\none type of 'screen.'  There's one for the main menu, and then one for the main game\nscreen, with subclasses for all the different types of main game screens (i.e 1\nsubclass per tutorial, 1 for sandbox mode, 1 for create challenge mode, etc.).  The\n(unfortunately somewhat monolithic) class that handles most of the main robot editing\nfunctionality is ControllerGame, which has methods for responding to all the buttons\nand menu options that are available while editing a robot, as well as methods for\nhandling creating, deleting, selecting, moving, and editing robot parts.  The allParts\nArray in ControllerGame represents the robot currently being worked on, as an Array\nof Parts.  It also handles starting and stopping the Box2D simulation\n\nThe Parts package contains class definitions for each type of 'Part available when\nbuilding a robot.  i.e. Circle, Rectangle, Fixed Joint, Rotating Joint, Thrusters, etc.\nEach instance of these classes contains all the data about that particular part, for\nexample, a RevoluteJoint has member variables for joint strength, speed, whether or\nnot the motor is enabled, control keys, which 2 shape parts it's attached to, etc.\nIn the code, a 'Robot' or a 'Challenge' can be thought of as just an array of parts\nwith a bit of metadata attached (i.e. sandbox settings, challenge restrictions).\n\nThe Actions package simply contains a list of actions that can be performed by the\nuser when in edit mode.  These actions are used solely by the 'Undo' and 'Redo'\nfeatures, and each action knows what needs to be done to undo or redo it.\n\nThe Input class handles all keyboard and mouse interactions with non-GUI elements,\nand dispatches calls to the appropriate methods (usually in ControllerGame) to\nrespond to a given mouse click or key press.\n\nThe Draw class deals with the drawing of robots to the screen.  There are 2 cases\nit needs to deal with: edit mode, and simulation mode.  When in edit mode, it draws\nall the shapes to the screen based on the current Array of Parts.  When in sim mode,\nit draws the shapes based on the positioning of the Box2D representation of those\nparts, but it needs to make them look the same in both cases.  In theory, this class\nis pretty modular, and should be able to be swapped out with an alternate class used\nfor drawing to the screen fairly easily, in the event that you'd like to write your\nown methods for dealing with robot graphics.\n\nThe Gui package has a bunch of classes that build the various GUI panels and windows\nthroughout the game.  The most important of these is probably the SaveLoadWindow\nclass, which handles displaying a list of robots available for load from the server.\nIt also handles high scores, saving and loading robots, replays, and challenges, and\nsearching for robots and such.  It's currently disabled, since the servers are going\ndown, but if another server ever goes up, this class will have to be modified.  Other\nclasses in this package include GuiWindow, which is the base class for all the little\npopup dialogs throughout the game, and components such as GuiButton, GuiTextArea, etc.\n\nFinally, the Database class handles all interactions with the server.  It has operations\nfor saving and loading robots and replays, as well as for getting lists of each of\nthese, and for logging in, creating a new user, uploading/downloading scores, and a few\nmore.  Each operation has a corresponding callback function, which processes the result\nreturned by the server and returns the data back to the appropriate class for display.\nOf note are the functions PutXIntoByteArray and ExtractXFromByteArray, where X is one\nof 'Robot', 'Replay', or 'Challenge'.  These functions are used to read and write in-game\ndata to or from a flash ByteArray.  The robot, replay, or challenge is then sent to the\nserver as the POST data part of a URLRequest.  These functions are also used by the\n'Import' and 'Export' features, as an easy way of converting between in-game objects and\ntext.  If you want to add features that need to be saved along with a robot, replay, or\nchallenge, you'll most likely need to put them in to one of these functions explicitly.\n\n## SERVER SIDE CODE\n\nThe server code is everything contained within the htdocs subfolder.  It's written\nentirely in PHP.  I'll talk about the database server code first.\n\nThe database code is in the ./src/htdocs/incredibots[1 or 2]/database/ directory.\nIncrediBots was build using Amazon S3 and SimpleDB as backends.  You can read more\nabout these at [http://aws.amazon.com](http://aws.amazon.com) .  Most of the DB server code is written\nspecifically with this in mind, and unfortunately I never got around to refactoring\nit such that the database layer is abstracted within a common package.  Thus it may\nbe a lot of work to switch to something like MySQL, although it would work just as\nwell as SimpleDB and S3 if properly maintained.\n\nNote that IncrediBots also makes use of MySQL through the PHPBB forums database.\nBecause we had a single login for both the game and the forums, all user accounts\nare managed through the forums' phpbb_users table.  This is why the PHPBB forums\ncode is included in the package, I had to make a few modifications to the forums\ncode to get the single login working, as well as a few other features, such as the\nability to embed robots within forum posts.  That said, basic login and creating new\naccounts should work just fine with any version of phpbb running, and it shouldn't be\ntoo difficult to change the login functionality to work with whatever database/system\nyou want.\n\nThe current database code should work fine out of the box with any Amazon AWS account.\nThe only things that should need modifying are the credentials in the file\ncommon_variables.php.  Apart from that, each ggscores_*.php file corresponds to one\nof the 20 or so DB operations the client can call.  All calls are initially directed\nto ggscores.php, which includes the proper file corresponding to the 'op' parameter.\nEach operation then talks to the Amazon database (or phpbb_users table in MySQL) and\nechos out a response for the client.  The binary data for all robots, replays, and\nchallenges is sent to the server via HTTP POST data, and are saved in S3 as BLOBs,\nwith a small amount of metadata for each stored in SimpleDB.\n\nNOTE: One thing it may be a good idea to add is an MD5 checksum validation when\nsending the binary data from the client to the server, to guard against packet\ncorruption.  I know this has happened in the past a few times, and when it does, the\naffected robot/replay/challenge becomes corrupt, and is lost forever...  (Dun dun dun!)\n\nThe rest of the server code contains mostly components of the IncrediBots website.\nThe index.php page contains code to embed the SWF and display it properly.  In order\nto host a SWF, you would just upload the SWF file that results from building the\nclient, named incredibots.swf (or incredibots2.swf) to the same directory as index.php.\nThe users.php page is also here, which displays all robots, replays, and challenges\nuploaded by a given user in a (somewhat) nicely formatted webpage.\n\n## ABOUT\n\nIncrediBots was originally designed by Ryan Clark, programmed by Oliver Trujillo,\nwith art from Matt Parry.  A big amount of credit should also go to Erin Catto and\nthe Box2D physics engine, as well as the Flash port of it upon which our game is\nbuilt.\n[http://www.box2d.org/](http://www.box2d.org/)\n[http://box2dflash.sourceforge.net/](http://box2dflash.sourceforge.net/)\n\n\u003e IncrediBots is probably the game I've had the most fun working on.  It's been a\n\u003e blast checking out all the crazy creations made by the IncrediBots community, and I\n\u003e wish you all the best in keeping IncrediBots going.  Cheers and happy bot building!\n\u003e - Oliver\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshthederf%2Fincredibots-2-html5-open-source","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoshthederf%2Fincredibots-2-html5-open-source","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshthederf%2Fincredibots-2-html5-open-source/lists"}