[Planning] Game Project - Hollow - JavaScript/HTML5 (Not a request for help)

GooS

Azrael
Reaction score
154
Hollow

Feel free to read it all but what I really want is for
the questions at the bottom to be answered :).

Genre: Sort of a RPG, may be played online (though that requires optimizing of code),
some Score-Attack sprinkles and a dash of Roguelike.

Engine: Completely made by me in JavaScript utilizing moz and webkit AnimationFrame
fetches and the HTML5 canvas. Some hardcoded stuff, the only thing not made by me
is the Array.remove prototype extension. Requires optimization but so far the
things that have been done work well.

Graphics: 16bit spritebased graphics in a 400x300 resolution blown up to 800x600.

Some general features that have already been implemented and will soon be tested
by a group of alpha testers are;

- Movement/Pathing/Collision
- Attack/Projectile/Hit-Detection
- Map Generation - Thinking of moving to pre-defined maps to have control over progression speeds.
- Character Creation/Character Stats
- Inventory/Equip System
- Particle Emitter
- Skill System

Why isn't it already tested? Enemies, yes there are currently no enemies in the game,
I've just not gotten around to it yet. I've just now created a basic enemy unit based on
a very downscaled character prototype.
The AI is extremely basic, when within range
it will start to track you, attacking at the unit types designated attack-speed, it will stop
if it falls to far away from the target.

More about the game!

The game will be more towards the RPG than the other "subgenres", you will start by creating
a character, you choose one governing attribute between: Dexterity, Strength and Intelligence,
these attributes will restrict what skills and equipment you may acquire during the game.
You can probably figure out what governing attribute governs what!

When you enter the game you will be placed in the lobby, a town, or something similar. Here
you may join or create groups of up to 10 people, you may alone, or in these groups, enter
dungeons which are generated randomly (these are easy/normal and primarily for lower levels),
or enter premade dungeons, these will be harder and for the higher level characters.

Character levels in the game will probably range between 1 and 30/40, not yet decided where
the balance of skills are and how often one should re-equip during progression.

Progression in the game is also made through new equipment, and there will be quite a lot
of it for a 'low-fi' game. Currently there's about 300 items implemented, each character can
wield roughly half of it. But many more are planned or are yet to be implemented.

When you gain a level you gain 2 attribute points to spend as you wish and 3 that are assigned
based on governing attribute. You also gain one skillpoint which you may spend on a skill
of your liking, some skills cancel others out as do some skill-lines, such as when picking
Necromancy you may not pick Abjuration, or when picking Might you cannot pick Stealth.

Skills are in lines of 7 each, 1 primeskill with 6 subskills, such as Ranged being a prime
with subskills such as Bow Mastery, Marksmanship and Strafe. You are required to have the
prime skill before you may pick any subskill. Skills may give you attribute bonuses, specific
bonuses or new abilities or magics to use actively.

Character

(decided to add some complexity, because I like it!)

Your character has 6 primary attributes, these consist of:

Strength - Increases damage using most melee and ranged weapons, also improves your physical resistance.
Stamina - Increases your energy and health.
Dexterity - Increases your attack speed and energy regeneration.
Agility - Decreases the energycost and improves your dodge and precision.
Intelligence - Improves your spell damage and increases your mana.
Knowledge - Improves your mana regeneration and mental resistance.

Specialty attributes are a bit different, you put points in them every other level and the
effect is factored by the primary attributes that govern them:

Might - Improves your attack power using melee weapons. Governed by Strength, Stamina and Agility
Stoicism - Improves your physical and mental resistance. Governed by Strength and Stamina
Cunning - Improves your precision and spell power. Governed by Intelligence and Dexterity
Perception - Improves your dodge and precision. Governed by Knowledge, Dexterity and Experience
Willpower - Improves your mental resistance, aswell as your attack and spell power slightly. Governed by Stamina and Experience
Wisdom - Increases your mana and improves your mana regeneration. Governed by Intelligence, Knowledge and Experience

E.g. (Numbers are arbitrary)
With X point in might, Y in strength, agility and stamina one would gain Z attack power
With 2X point in might, Y in strength, agility and stamina one would gain 2Z attack power
With X point in might, 2Y in strength, agility and stamina one would gain 2Z attack power
(Hope you get it!)

Questions, if you answer these I'd be most grateful:
(More questions to come)

General:

- Should a game of lower graphical fidelity be less complex when it comes to
character attributes and skills? I've found that this is often the case!

- Are you willing to keep up-to-date with browser technologies in order to
play a game that is not high-end developed? Maybe not the best place to ask.

Game-Related:

- How long, in a game environment roughly as what you see in the screencaps, would
you want to stay for one sit-down? Good to know as I want a shorter, casual, sit-down
to still give a sense of accomplishment.

- How long, same as above, do you want to play before you reach max level? Max level is
not the cap of progression, it does however slow down further progression as there is less
to achieve.

- What are your thoughts about 16bit graphics, are you only willing to play the latest
games on the market? do you find charm in a more "retro" game style?

- What, from what you can see in the screencaps, do you think of the interface I'm currently
employing in the game?

- What, from what you can see in the screencaps, do you think of the graphic style I'm currently
employing in the game?

These screencaps are far from exilirating, however, I don't want to show of that much, just give you something
of what the game looks like! I'll post more images if you request it!

img1.pngimg2.pngimg3.png


If anything is poorly explained or you want to know more, or something in these lines, just tell me!
 

neo34rd

New Member
Reaction score
3
This looks pretty interesting =D, however I think you should change how the dialogue is displayed. I only noticed that I could close dialogue when he said "close this dialogue by clicking close". Maybe you can follow the Pokemon style of dialogue, when the pc interacts with an npc the pc has its control disabled and the dialogue box appears with options to select (you may even allow npcs to continue their actions like in Skyrim =D) and in the case of non vital dialogue you can make it appear as you have currently.

But other than that everything looks pretty neat ;D

PS: For the Levels of a character, I find that as long as there is no Grind in the game and that there are plenty of rewards/things to do I wont care if I reach max level or not. However I am not much of a power gamer but of an action gamer.
 

GooS

Azrael
Reaction score
154
Thanks for your reply, yes the dialogue would do with some better visibility, I will add that when I optimize the current prototype's code, thank you! As for following characters that is a possibility, however, such NPC will probably be scarce in this type of game!

I will keep that in mind during further developement!

Now I'm of to optimize the interface, every frame I can save is a blessing!

(Currently the game runs between 40-60 on my POS laptop, but has some weird spikes and drops)
 

Wizzyglvl3

New Member
Reaction score
0
I might want to play that game for mabye 30 minutes mabye an hour at a time. I do enjoy more retro type games, because often older, not massively funded games have great story lines, and good interactiveness ( skills, equiptment, etc.). One thing you might want to think about, is making the main character look a little differently. Mabye make him as a sideways view or something, becuase from the top view it looks like a mushroom to me. I don't enjoy this graphic style as much as i enjoy smooth solid colors, instead of all of the colors, but this still looks pretty nice. Looks like a great game, ill be happy to play it when it comes out
 

GetTriggerUnit-

DogEntrepreneur
Reaction score
129
(Currently the game runs between 40-60 on my POS laptop, but has some weird spikes and drops)

This is due to the garbage collection, I'm pretty sure. I don't remember where but I read an article showing that there was always some sort of performance drop/spikes when the garbage collector passes.

I found the source, http://blog.chromium.org/2011/11/game-changer-for-interactive.html
You can test what they say here: http://v8.googlecode.com/svn/branches/bleeding_edge/benchmarks/spinning-balls/index.html

I don't think Javascript has a sort of native way to call the GC. You would need to, in some way, exit the scope voluntarily so the GC passes.
Perhaps the delete keyword.
 

GooS

Azrael
Reaction score
154
Ahh, thx GetTriggerUnit, I did not know that it was because of the GC, however, I think that the delete keyword simply marks items for deletion upon the next GC cycle.
Exiting, well, hmm, the objects that are needed exist on the game object, there is no main game loop, there is only requestAnimationFrame which uses a callback, so it
'exits the scope' at every frame. I don't see how this would help though as I think the GC runs at set/arbitrary/memory-limited intervals.

I can only hope that firefox implements some new changes to their GC aswell, because the game runs and looks bad in Chrome.

@Wizzyglvl3

Thanks for your comment, the character changes appearance based on equipment, as can be seen in the last screenshot, being the lower tiers of armor they are not supposed to be "awe"-inspiring. The colors of all tiles might not be final, and the "mood" of the game is not really set.

(This also being the reason why the game looks bad in Chrome, the 1x1 -> 2x2 pixel blow-up gets smoothed, while firefox has a boolean to turn smoothing it off.)

Also news:

-Added weapon attachment on attack and based on equipped item.
-Added an audio manager, there are a few sound effects now for testing purposes.
-Remade the GUI a bit and
-Optimized some code (things that should have been done in the first place, such as nulled objects)
 

GetTriggerUnit-

DogEntrepreneur
Reaction score
129
Yea I strongly doubt deletes call the GC. And I've looked and there's no way to call the GC.

Maybe you could look into recycling. Like all those systems used to do in Jass.
Ask for an amount of memory when the page loads and never let the GC claim in back.

Just want to let you know, I'm not an expert in memory management.
But I was thinking.

Code:
// On Load
window.data = []; // Create a new global variable of type Array
for (var i = 0; i < 10; i++) // Loop 10 times
    window.data.push(0.); // Ask for a double to be appended

// Whenever you need to calculate data
data[0] = 3;
data[1] = data[0] * 3;

Since Javascript is single thread, you shouldn't have any collision problems and this data variable would never be claimed back since it's in the global scope. You use the indexes of the variable to calculate your data.

Instead of using an array, you could just use a bunch of global variables as well. I think the key is to not use local variables.
 

GooS

Azrael
Reaction score
154
GetTriggerUnit; Interesting idea, but when I review my code I actually notice that most of my objects, atleast the heavier ones, are cached and unclaimable by GC, however, all local variables, and there are quite a lot of them, get created 60 times per second so there is quite a lot to take care of for the GC anyways.

There are some things I can think of in the system that could use recycling though so I'll probably add in some form of that system!

Edit: Actually, I can see it being a very good idea for my different types of text fields which are currently being created and deleted, saving different text fields under id's based on the string, so that they may be recycled and never claimable by GC.
 

GetTriggerUnit-

DogEntrepreneur
Reaction score
129
I honestly think that you should put those '60 local variables' on an object which is referenced in the global namespace (window object). I'm thinking you could do:
Code:
// On Load
window.goos = {}; // Create a 'dummy' object on global namespace

// Periodically
goos.angle = 3;
goos.x = 6 * sin(goos.angle);
goos.y = 7 * cos(goos.angle);
You could prepend goos. to your variables; a regular expression could do it very easily. Not only this would avoid the GC issue but it would most probably be faster as you do not have to allocate a new memory block each time the callback is called but only the first time the callback is called.
 

GooS

Azrael
Reaction score
154
Yeah, I thought about that after your post aswell, I'm gonna try it out when I get home!
 

Artificial

Without Intelligence
Reaction score
326
I honestly think that you should put those '60 local variables' on an object which is referenced in the global namespace (window object). I'm thinking you could do:
Code:
// On Load
window.goos = {}; // Create a 'dummy' object on global namespace

// Periodically
goos.angle = 3;
goos.x = 6 * sin(goos.angle);
goos.y = 7 * cos(goos.angle);
You could prepend goos. to your variables; a regular expression could do it very easily. Not only this would avoid the GC issue but it would most probably be faster as you do not have to allocate a new memory block each time the callback is called but only the first time the callback is called.

I think you understand the GC slightly incorrectly. Local variables are destroyed when the functions referring to them no longer exist, that part has nothing to do with the garbage collector. The GC destroys objects that no longer have any references to them. Primitive values such as the ones you're using in your example don't really add to the GC problem, as the GC doesn't really destroy values such as 3. While not solving any problems, this suggestion would make use of globals (a bad idea) and replace local lookups with object lookups (which, IIRC, are O(log n), and O(n) in IE).

Now if you really want to avoid 60 local variables from being created each time the function is run and/or want to preserve the values between function runs, you should use closures:

PHP:
var myFunc = (function () {
    var var1 = 3,
        var2 = 4,
        var3 = 23;

    return function () {
        alert(var1);
        var2 += 1;
        alert(var3 + var2);
    };
}());

myFunc(); // alerts 3 and 28
myFunc(); // alerts 3 and 29
myFunc(); // alerts 3 and 30
Using a closure would not only be better because it doesn't use a global, but also because it is faster (rather logical, because accessing the global scope is the same as accessing the higher function scope, and you'd add an object lookup to that). Edit: But the locals seem to be even faster.
 

GetTriggerUnit-

DogEntrepreneur
Reaction score
129
Interesting. Thanks for precising the behavior of the GC.

You're saying those local variables are not cleaned by the GC since the function is never destroyed?
 

Artificial

Without Intelligence
Reaction score
326
When you create a function, it gets a Lexical Environment attached to it. This environment associates all the function's local variable and parameter names to their values, and has a reference to the outer Lexical Environment. So if we have function A, and inside it function B, function B's Lexical Environment contains a reference to function A's Lexical Environment. Thus, A's Lexical Environment cannot be destroyed before (1) A has finished its execution, and (2) there are no references to B. Note that for example passing B to setTimeout would make setTimeout keep a reference to B until it had executed B even if you don't explicitly make anything in your code refer to B.

I'm not exactly sure Lexical Environment is the supercorrect term, but that's what I found in the ECMA-262 standard with a quick search and I don't have time to keep searching right now. :p
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top