Browse files

Added a makefile

  • Loading branch information...
1 parent 4ed2abb commit 7add547f53e5cc9ffbc3d1459e213348e7b21d94 @nicolas-bonnel committed Apr 28, 2011
Showing with 513 additions and 305 deletions.
  1. +32 −0 Makefile
  2. BIN compiler.jar
  3. +41 −77 html/index.html
  4. +22 −2 html/warpg.css
  5. +3 −2 js/character.js
  6. +4 −5 js/effect.js
  7. +11 −3 js/item.js
  8. +35 −37 js/particle.js
  9. +43 −3 js/quests.js
  10. +179 −162 js/renderer.js
  11. +2 −2 js/skills.js
  12. +15 −4 js/world.js
  13. +2 −2 json/animations.json
  14. +2 −2 json/areas.json
  15. +3 −2 json/creatures.json
  16. +72 −0 json/items.json
  17. +1 −1 json/models.json
  18. +17 −1 json/particles.json
  19. +15 −0 json/projectiles.json
  20. +14 −0 json/skills.json
@@ -0,0 +1,32 @@
+# Set the source directory
+srcdir = js/
+all: warpg-dev.js warpg.js
+# Create the list of modules
+modules = ${srcdir}area.js\
+ ${srcdir}character.js\
+ ${srcdir}collision.js\
+ ${srcdir}effect.js\
+ ${srcdir}ia.js\
+ ${srcdir}item.js\
+ ${srcdir}loader.js\
+ ${srcdir}mesh.js\
+ ${srcdir}object3d.js\
+ ${srcdir}particle.js\
+ ${srcdir}projectile.js\
+ ${srcdir}quat.js\
+ ${srcdir}quests.js\
+ ${srcdir}renderer.js\
+ ${srcdir}skills.js\
+ ${srcdir}utils.js\
+ ${srcdir}world.js
+# Concatenate all of the modules into warpg.js
+warpg-dev.js: ${modules}
+ cat > $@ $^
+# Minimize with google's closure compiler
+warpg.js: warpg-dev.js
+ java -jar compiler.jar --js=$< > $@
Binary file not shown.
@@ -5,22 +5,7 @@
<script type="text/javascript" src="glMatrix-0.9.5.min.js"></script>
<script type="text/javascript" src="jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="jquery-ui-1.8.10.custom.min.js"></script>
- <script type="text/javascript" src="quat.js"></script>
- <script type="text/javascript" src="utils.js"></script>
- <script type="text/javascript" src="ia.js"></script>
- <script type="text/javascript" src="mesh.js"></script>
- <script type="text/javascript" src="renderer.js"></script>
- <script type="text/javascript" src="loader.js"></script>
- <script type="text/javascript" src="area.js"></script>
- <script type="text/javascript" src="skills.js"></script>
- <script type="text/javascript" src="world.js"></script>
- <script type="text/javascript" src="character.js"></script>
- <script type="text/javascript" src="effect.js"></script>
- <script type="text/javascript" src="collision.js"></script>
- <script type="text/javascript" src="item.js"></script>
- <script type="text/javascript" src="projectile.js"></script>
- <script type="text/javascript" src="particle.js"></script>
- <script type="text/javascript" src="object3d.js"></script>
+ <script type="text/javascript" src="warpg-dev.js.js"></script>
<META HTTP-EQUIV="Keywords" CONTENT="WebGL, javascript, html5, canvas, rpg, 3D, model, GPL, free, hack, slash">
@@ -318,6 +303,12 @@
<input type="button" value="close" onclick="closeTab('questsTab');">
+<div id="vendorTab" style="overflow-Y:auto;visibility:hidden;">
+Drag your items here to sell them.
+<table id="vendorTable" style="overflow:hidden"></table>
+<input type="button" value="close" onclick="closeTab('vendorTab');">
<div id="inventoryTab" style="visibility:hidden;">
<input type="button" value="close" onclick="closeTab('inventoryTab');">
<div id="gear">
@@ -329,7 +320,7 @@
-<img src="data/text/esqueleto.png"></img>
+<img src="data/text/fleur_lines.png"></img>
<div id="rightgear">
@@ -339,7 +330,7 @@
-<div id="inventoryTitle">Inventory</div><div id="trash" style="width:32;height:32;background-image:url(data/icons/trash.png)"></div>
+<div id="inventoryTitle">Inventory</div><div id="gold">0 gold</div><div id="trash" style="width:32;height:32;background-image:url(data/icons/trash.png)"></div>
<table id="inventoryTable">
@@ -382,10 +373,11 @@
<div id="rightTab">
-<h2>WebGL RPG / Hack & Slash</h2>
-This demo has only been tested with chrome 10. It may work with older versions of chrome, and some features do not work with firefox 4.0 (skill drag & drop). You will probably need to download a beta of a recent browser to see this demo: <a href="">getting a WebGL Implementation.</a> If you need information about this demo, you can contact me : nicolas dot bonnel at gmail dot com. The code is licenced under GNU GPL 3. Feel free to reuse the code, credits would be appreciated.<br>
+<h2>WebGL RPG / Hack & Slash</h2>
+This demo has only been tested with chrome 10 and firefox 4.0. It may work with older versions of chrome, and some features do not work with firefox 4.0 (skill drag & drop). You will probably need to download a beta of a recent browser to see this demo: <a href="">getting a WebGL Implementation.</a> If you need information about this demo, you can contact me : nicolas dot bonnel at gmail dot com. The code is licenced under GNU GPL 3. Feel free to reuse the code, credits would be appreciated.<br>
+To use various skills, open the aptitude tab ('L' shortcut), click either on 'cast' or 'melee', and drag & drop skills on the shortcut bar. At the start you will only have 2 skills available : melee attack (melee) and magic projectile (cast). When you use a skill, you level up aptitudes this skill is linked to. When you gain levels in aptitudes, you will have new skills available ! See the complete skill list <a href="">here.</a>
For the moment, controls are hardcoded. No WASD because I use a french keyboard layout :).
@@ -402,61 +394,33 @@ <h3>Controls</h3>
<li>Show/hide aptitude panel : L</li>
<li>Show/hide inventory panel : I</li>
<li>Show/hide settings panel : O</li>
+<li>Show/hide quest panel : K</li>
-<h3>News / Changelog</h3>
-<ul><li>04/03/2011 : Added new items: different armor parts, new weapons (wooden and iron style). Items now have a quality (normal, magical, rare, epic) and powers (+damage or +stat). Added chests that drops higher quality loot (A to open). Added a trash in the inventory menu. Modified some stats for monsters. Added new models : training stuff and new trees.</li>
-<li>03/22/2011 : Added a new monster : spider (thanks to Wciow and John.d.h). New model for the hero : a goth woman (thanks to TiZiana). The quality of animations is quite poor: this is my first attempt at animating a 3D model :P. You can now switch weapon with the ones you dropped. Reduced the map size: the previous maps were a little too big, causing overflows in vertices buffers. Improved transparency: trees should have a better look.</li>
-<li>03/12/2011 : Monsters can now drop items. Added new items (katana, staff, mace, HP, SP and MP potions). While weapons are not usable, potions stack and are usable (they give 10 units back). Started to work on the inventory. Started to use jquery : skills and items should now be draggable with all recent browsers. The description of skills and items is now shown when the mouse is over the icon.</li>
-<li>03/05/2011 : Removed the map file, now the map is randomly generated with square & diamond algorithm and is a little bit larger. Switched matrix library to glUtils (link is in the credit page) which is a lot faster. Added an area concept : the map is composed of various areas linked together by paths. Added a starting point, with a shrine, when you die you will revive there. Monsters level is now given by the level of an area, which increase with the distance in the graph of the starting point. Added cemetery objects, this still need some improvements to make nice graveyards. Added skeleton enemies. The drawback of these updates : loading time has increase (between 5 and 10 sec). I'll add a loading screen soon. I think next update will focus on inventory implementation and cross browser compatible drag & drop (I plan using JQuery, for the moment drag & drop works only with chrome).</li>
-<li>02/27/2011 : Added new skills : thunder, thunder strike, nova, flame nova. Started moving other definitions (animations, items, creatures, models characteristics, areas) in external config files.</li>
-<li>02/24/2011 : Added new skills : lightning, blizzard, inferno, burning attack. The shortcut tab now has a background image. Improved the skill selection interface: skill cost and damages are now shown.</li>
-<li>02/20/2011 : Added new skills : flare, magic missile, precise attack, power attack. Added a skill selection interface: you can drag & drop skills to the shortcut bar and use them by clicking on their icon. Skills now have a level requirement: to use the skill, the sum of the aptitudes this skill relies on must be equal or greater to the required level.</li>
-<li>02/15/2011 : Added a magic skill : fireball. Skills, projectiles and particules definition have been exported to json files.</li>
-<li>02/06/2011 : Added various objects, the map may be overloaded for lower hardware, but with a small view radius it should be ok. Now you can level up dexterity (by avoiding attacks) and sword mastery. Melee aptitude is for hit rate, dexterity for dodging and sword is for damages. Monsters' level increases with the distance to the center of the map.</li>
-<li>02/03/2011 : Made some refactoring. Now you can strafe. Added some particule effects : little flames when attacking with weapon, blood and numbers when hit. Characters now have a faction and monsters can hit you. When hit you enter in recovery mode and current action is canceled. Now you can die and revive to (0,0) with 1 hp after 10 sec. Started to implement aptitudes and xp system : you can level up constitution, stamina and melee (no effect for the last). Magic and spells are coming soon :).</li>
-<li>01/31/2011 : Added a particule system.</li>
-<li>01/27/2011 : Added two panels for settings and aptitudes. Drawing radius is now customizable.</li>
-<li>01/26/2011 : Removed the Interface class : now the interface is drawn with HTML + CSS. Added Status bar : health, stamina and mana. When monsters die, they slowly disapear under the ground. Reduced view radius to improve performances on lower hardware, I'll soon add the possibility to customize it.</li>
-<li>01/25/2011 : Improved collision detection (tangent computation). Removed the goblin, added antlion and minotaur. Models are now textured. Monsters have an health disk bellow them and can now die. Improved drawing (objects in the view radius but in the back are not drawn anymore).</li>
-<li>01/22/2011 : Added collision detection. This still needs some improvements : collision tangent computation (so that the object can still move forward along the tangent) and multiple bounding boxes for complex object.</li>
-<li>01/21/2011 : Added more models (chest, house, shrine, trees). Added goblins, they are static and play an idle animation.</li>
-<li>01/20/2011 : Added sky, fog and a grid system for optimization, there is now 1000 trees on the map and the demo should run on lower hardware.</li>
-<a href="aptitudes.html">Aptitudes and leveling system</a><br>
-<a href="skills.html">Planned skills</a><br>
-<a href="credits.html">Credits</a><br>
-2 very usefull links:<br>
-<a href="">My webGL knowledge come from here, some parts of code too :)</a><br>
-All the models come from, great site !<br>
-<a href=""><img src="data/oga.png"></img></a>
-<li>Add NPCs</li>
-<li>Add Quest system</li>
-<li>Add more content (items, particle effect, skills, monsters, models, ...)</li>
-<li>Balancing (skills, items, monsters, ...)</li>
-<li>Add skills to monsters</li>
-<li>Groups of monsters, bosses</li>
-<li>Improve IA</li>
-<li>Improve the website (credit page, skills, aptitudes, main page)</li>
-<li>Clean the code, comment it, ...</li>
-<h3>Known bugs / lacking feature</h3>
-<li>Static normals with animated models</li>
-<h3>Console :</h3>
-<div id="console"></div>
+<a href="">Credits</a><br>
+<a href="">Wiki</a><br>
+<a href="">My webGL knowledge come from here, some parts of code too :)</a><br>
+All the models come from, great site !<br>
+<a href=""><img src="data/oga.png"></img></a>
+<h3>Console :</h3>
+<div id="console"></div>
+<!-- Piwik -->
+<script type="text/javascript">
+var pkBaseURL = (("https:" == document.location.protocol) ? "" : "");
+document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
+</script><script type="text/javascript">
+try {
+var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 4);
+} catch( err ) {}
+</script><noscript><p><img src="" style="border:0" alt="" /></p></noscript>
+<!-- End Piwik Tracking Code -->
@@ -99,14 +99,26 @@ padding: 3px;
position: absolute;
top: 100px;
-left: 100px;
+left: 10px;
background-color: rgba(0,0,0,0.5);
border-radius: 10px;
padding: 3px;
+position: absolute;
+background-color: rgba(0,0,0,0.5);
+border-radius: 10px;
+padding: 3px;
#inventoryTable td div{
@@ -139,7 +151,7 @@ top:4px;
position: absolute;
top: 3px;
-left: 220px;
+left: 205px;
#rightgear div{
@@ -207,6 +219,14 @@ font-size:24px;
+position: absolute;
position: absolute;
left: 550px;
@@ -107,7 +107,7 @@ function Character(jsonFile,x,y,level){
if (jsonFile.particle)
- world.particles.push(new ParticleEmiter(this,jsonFile.particle));
+ world.particles.push(new ParticleEmitter(this,jsonFile.particle)); = jsonFile;
this.level = level;
this.levelXP = 10;
@@ -215,14 +215,15 @@ Character.prototype.damage = function(dmgs){
this.currentHp -= damages;
this.currentAction.isInterruptible = true;
this.currentHp = 0;
if(this != world.player)
this.collision = null;
this.circleHealth = null;
- world.particles.push(new ParticleEmiter(this,'blood'));
+ world.particles.push(new ParticleEmitter(this,'blood'));
@@ -30,7 +30,6 @@ function MeleeHit(parent,skill,finishEffects){
- //var damageType = parent[weapon.damageType].level;
for (var i=0;i<skill.damages.length;i++){
var dam = new Object();
@@ -64,10 +63,10 @@ MeleeHit.prototype.process=function(elapsed){
for (var j=0;j<this.finishEffects.length;j++)
- world.particles.push(new ParticleEmiter(objsHit[i],this.finishEffects[j]));
+ world.particles.push(new ParticleEmitter(objsHit[i],this.finishEffects[j]));
- world.particles.push(new ParticleEmiter(objsHit[i],'miss'));
+ world.particles.push(new ParticleEmitter(objsHit[i],'miss'));
@@ -192,7 +191,7 @@ RandomHit.prototype.process=function(elapsed){
var ind = Math.floor(rand()*objs.length);
for (var j=0;j<this.finishEffects.length;j++)
- world.particles.push(new ParticleEmiter(objs[ind],this.finishEffects[j].particle));
+ world.particles.push(new ParticleEmitter(objs[ind],this.finishEffects[j].particle));
@@ -215,7 +214,7 @@ function createNumber(obj,num){
spell.x = obj.x+Math.cos(theta)*(numNum/2.0-i-0.5)*0.4;
spell.y = obj.y+Math.sin(theta)*(numNum/2.0-i-0.5)*0.4;
spell.z = obj.z;
- part = new ParticleEmiter(spell,'num'+(numb%10));
+ part = new ParticleEmitter(spell,'num'+(numb%10));
numb = Math.floor(numb / 10);
@@ -23,6 +23,12 @@ numPower['magic'] = "1+Math.floor(rand()*2)";
numPower['rare'] = "3+Math.floor(rand()*2)";
numPower['epic'] = "5+Math.floor(rand()*2)";
+var priceModif = {};
+priceModif['normal'] = 1;
+priceModif['magic'] = 2;
+priceModif['rare'] = 4;
+priceModif['epic'] = 8;
function Item(jsonItem,quality,itemLevel){
@@ -39,10 +45,11 @@ function Item(jsonItem,quality,itemLevel){
item.range = jsonItem.range;
- item.goldCost = jsonItem.goldCost;
+ item.goldCost = jsonItem.goldCost*priceModif[quality];
item.description = jsonItem.description;
item.icon = jsonItem.icon;
- }
+ }else
+ item.goldCost = 0;
item.stackable = jsonItem.stackable; = Date().getTime());
@@ -124,6 +131,8 @@ function itemDescription(item){
else if (item.powers[x].effect.type == 'bonus')
descrip += item.powers[x].effect.aptitude+'<br>';
+ if (item.goldCost>0)
+ descrip += '<font color="#EEEEAA">Price: '+item.goldCost+' gold.</font>';
descrip += '</div>';
return descrip;
@@ -143,7 +152,6 @@ function loot(level,qual){
quality = 'normal';
var it = new Item(items[itemNames[Math.floor(rand()*itemNames.length)]],quality,level);
- //it.orient = Math.random()*360;
it.pickable = new ParticleEmiter(it,'itemdrop');
return it;
Oops, something went wrong.

0 comments on commit 7add547

Please sign in to comment.