Openbracket

19Dec/110

What is the best way to achieve a Flash/Unity app with shared Nodejs server?

Over the last week or so I have been looking into creating a shared nodejs server that has flash and unity interfaces. I'm still rather new to nodejs so this is a post to ask a question; I'm considering creating a JS file that flash and unity communicate to using external interface calls instead of putting the communication layer inside of the application.

My question is, is this an acceptable approach? One of the reasons I'm considering this is because it seems to be a pain in the ass in Unity to achieve this.

Let me know what you guys think!

26May/100

Lantern's Market

I would like to explore and get some thoughts out of my head on this topic.  But before I get too far into this, I should first explain a little about Lantern's item system, crafting, questing, rare items and in general how they are collected.

A feature that hasn't been fully scoped out yet, but roughly exists in my head is the crafting system for lantern (another post later) which will rely heavily on a rather different stat system, but that's another post as well. The crafting system will be similar to that you find in many other games when it comes to the end result. Players will be able to create items from raw materials to sell. The big difference is if I make a sword and you make a sword, these swords could end up being very different.  The quality of the sword, it's bonuses and other attributes will depend on the maker. For the market this means that items won't all be priced the same and players will need to figure out what is attributes are  valued when making and buying certain items.

The next interesting note is there will only be a handful of NPC's that sell items. Most of the items in the game will end up being player made.

A third factor is that this game will maintain a living universe. This means that rare drops from a certain boss/challenge will likely only happen the once. This means there will actually be items in the game that only one person will ever have.

Fourthly with monsters having limited to no drops a player will almost be forced to play the market to make money. That's right. No grinding for loot. You can grind for everything else but that :P

And finally, markets will be localized. What I mean by this is that if you put an item for sale in a town 'a', those in town 'b' can't see it. The issue with this, if I want the system to remain logical, is how the player can have an item on sale in town if they aren't there? A few story idea's have crossed my mind, but the one I think I'm going to go with is a group who offers you handle sales of items for a small percentage.

With all these different factors, my intention to allow the market to have the freedom to grow as it will (no imits on prices),  all players being able to craft to some extent and the ability to have players run a monopoly, I believe this could be a very interesting system.

6May/103

Lantern Map

Look at this awesome map! Look at it!

This is a rough map I made in a few minutes for my friend William aka jetfx (http://jetfx.livejournal.com/). William is a cartographer, a world builder freak and an aspiring author. He will hopefully be helping me with my maps and story for Lantern as we move forward. Whenever he has a better map that the pretty epic one I drew, I'll post it for you all to see.

*UPDATE*

William, being pretty damn quick, thought my map looked too crappy to share so he cleaned it up for me as you can see. I decided to leave mine so you can see how much better he is and why I'm pretty stoked he's agreed to help.

5May/101

Random Encounters

Progress on Random Encounters, a mini-game of sorts that I am using as a test bed for some of my Lantern concepts, is slowly trucking along.  The game engine along with it's content creation tools are almost complete. Skinning hasn't been thought about yet, but the game itself is close.  Something that I need to do and haven't yet is find a *cheap* host that will allow me to install mongo and nodejs.  Emphasis on cheap as I am broke.

Random Encounters for me is a test for mongo, some simple js. though the initial build won't have it and some gameplay concepts that aren't nessicairly related to lantern but ones I am playing with.

The game will constantly be in beta and will be my playground for new idea's and tests.  After the current road map I have in mind is complete, which I will write down and post later, I will likely publish all the code for people to use if they have the urge to host a crappy game.

Anyways, here's a little snippet of code for mongo to get a random record that took me a while to get working.

[code]

$numOfCreatures = $collection->count();
$ranCreatureId = floor(rand(0,$numOfCreatures-1));
$ranCreateObj = $collection->find()->limit(-1)->skip($ranCreatureId)->getNext();

[/code]

29Apr/100

Windows + VirtualBox + Ubuntu + nodejs = hooray!

As I'm sure some of my readers (all four of you) may know because of the IRC room, I've lately been trying to get nodejs running on a virtual machine (ubuntu since nodejs doesn't like windows and I don't want to virtualize osx) that is accessible from my host (windows) so I can use it for Lantern. Well I had a few minutes tonight to sit down and do some reading and I figured it out, hence the post so I don't forget.

I'll go right from step one in case anyone else is trying to do this with no prior knowledge ;) I should also mention if you're on *nix you don't need to do this.

  • Get virtualbox
  • Get Ubuntu (or whatever distro tickles your fancy)
  • Install a vm of ubuntu
  • Download nodejs on vm
  • Config/Make/Install - I had to install g++ and cmake to get it to build properly
  • (The tricky part) On your host (windows) navigate to your virtualbox installation via command - something like this : C:\Program Files\Sun\VirtualBox\
  • Run these commands :

VBoxManage.exe setextradata "ubuntu2" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol" TCP
VBoxManage.exe setextradata "ubuntu2" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort" 8000
VBoxManage.exe setextradata "ubuntu2" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort" 8000

  • Launch your vm, start node js and on your host in a browser go to localhost:8000- HOORAY!

So here's what I know about the commands what you need to edit to make it work

  • Instead of "ubuntu2" use the name of your vm.
  • the guestssh isn't important. Just a name use to group the settings. Call it whatever you want.
  • Guest and Host ports are the port you want to access on your vm.
  • If you change you're installation at all from the default you'll have to figure out the other changers yourself here : http://www.virtualbox.org/manual/ch06.html#natforward

Good luck ^^

27Apr/100

Lantern Update

In my last post I was discussing Lantern's combat and party system. These two features are very closely related to the map, which is going to be the main area of action in Lantern, so I have been thinking a lot about how to approach this map. I think from some discussions I have had with people in the #bbg irc room and with a few coworkers, I'm going to try to use nodejs for handling the communication and npc logic. From my understanding of nodejs (which is very limited so please correct me if I'm wrong) I can use it to push data to players that need it and create objects at run time on the server and run based on a timer. What I'm looking to do with this functionality is to run the npc's logic independant of players input.  I'm pretty sure nodejs will allow me to do this. All I need to do is set up linux on a virtual machine and get everything all playing nicely together so I can continue to develop on my local machine.

But as I work on Lantern and think about, the need to a test bed is becoming more apparent to me. So to fix this need I'm going to take a quick break from Lantern to make myself a small game that I can use to test different parts of Lantern. This will range from Mongo scripts to game tools (for creating quests/items/etc). The scope of the test bed currently is very limited to the mongo scripts and the game tools. If I can think of a way to test nodejs in this that would be great, but for now, just testing some idea's around those other elements would be enough. This small game test bed will be call Random Encounters. The game is exactly what it sounds like. You click a button and you encounter things. The game will suck, but it's purpose is testing.  This small game will hopefully be online in the next few weeks. Work has be pretty busy of late, so I haven't been able to look at anything lately.

So that's where I am. If anyone can confirm or deny my thoughts on nodejs that would be great.

15Apr/103

Lantern Combat and Party System

The time has come, the walrus said, to speak of many things: of swords and clubs and player groups, of adventures and rings... Ah to hell with it. Let's talk about how to create a party system for pbbg's that doesn't require players to be online, but is still interactive and fun, and killing things!

The thought of a party system is by no means a new idea. The challenge arises when you try to apply the principle to an environment where players won't be online when actions concerning them will be occurring. What I mean is that if a party of six players are on a quest, there's a good chance a when one player logs on, everyone else is offline. What will this player be able to do if they are a member of a party? Can they move the party? Will they be able to move around themselves but remain a member of the party? If so, will their gains be party gains?  And then we have party combat; Will the leader direct each member or will combat pause until each member can log in and take a turn. Or maybe it would be better to allow players to create a rule set that will manage their character in battle for them.

Party Formation

With the party we have a few options to look at as mentioned above. First up is each player in the party has the ability to move the party. With a party of six where each player has the power to more the party this, I think, would quickly dissolve into players arguing and fighting amongst each other about how movement and combat should be handled. In a game where movement and actions will likely be limited to a tick, this outcome could actually ruin the game for some players.  You also don't have the same clear definition of roles that can bring a lot of fun to party play.

How about party members being able to control themselves and their actions instead of being dictated by the party? This approach solves the what do players do when they are online and the combat because they are in full control. The issue is though is this is no longer party play. You are now playing the game on your own but yet remain in a 'party' of other individual players.  A thought that would give this style more of party play and still resolve several issues with combat is to not allow the members of the party to move more than 10 or so tiles away from each other.  Then if you make combat turn based, a player could engage an enemy and instead of fleeing stop playing until another member of the party or two and come and attack the enemy as well. I like this idea. It give players the option to still explore the world, combat and train while party members are not online but still gives the sense and benefits of a party.

The final concept I have for this is to have a leader that is the only one that can move the party. This means that when a player that isn't leader logs in there would need to be something they could logical do while in a party adventuring. And I can't think of anything. A player could log in and train or study, but that isn't really that fun in contrast to the leader where when they log in they have the power to move the party, enter battle and make all the quest decisions.  While this limits player interactivity, combat and general fun... Actually, that's pretty much all it does.

Combat

This issue is tightly related to the type of party system that is in play, and I can think of three possible (read as not necessarily good) ideas for this. Let's start with the idea for combat and party system that I am leaning too; Turn based combat with players able to control themselves and move about the area the party is in.  This approach would allow for players to decide how to enter combat. If an enemy is spotted five tiles over, the group may decide it's best for the tank to engage first and then have the other members join the fray. The enemies combat would also be turn based. The only point that is nagging me here is how would the enemy operate. Would they only respond when they have been 'activated' - attacked, tile entered? If so what happens when the tank attacks, the enemy strikes back, and then the archer 3 tiles away attacks? Does the enemy attack the tank or would it start to move towards the archer? Or maybe even move towards someone else that is in the area. Or flee. And what if the enemy is attacked simultaneously? Or if the archer attacks and then runs? Should the aggro stay active for a few turns and every time the archer moves, he calls the enemy to runs it's AI script and decide an action?

Keep in mind I only came up with this idea as I am writing this post, so this is what I think I would do with only a few moment of thought. I would have each player that engages an enemy active it for a number of rounds, even after combat. This means if the player tries to flee, it may be chased. But what this system also implies is that the enemy when it is engaged/activated/whatever it will run it's AI script and determine course of action around it. This means and could be really interesting, is that if a player that has attacked an enemy and decided to wait for help could still be killed when help arrives and triggers the enemy to make a move. My only concern is that this would lead to a player dying without knowing what happened. If all six members of a party attack an enemy at once and the enemies AI tells it to kick the crap out of the guy beside me six times before that player has a chance to refresh the page, they will refresh dead. This though would lead to party tactics and communication which I strongly support.

Another option for the party being control as a whole either by a leader or each member in the party is the concept of a combat rule set. What I mean is that a player will have a screen where they will see a list of options and how they would want their player to react to each own when they entered combat. For a system like this to work in my mind the players would need to receive rather detailed reports about the battle so they can tweak their rule set. And while this would be interesting, the party formation still limits much of the players actions and in the end rather boring (I think) way to do it. Not only can you not move yourself, your combat consists of conditional statements.

In the end for me, I think allowing the players to explore a limited area around their fellow members and creating some form of activated AI system seems like the best solution for me.  What do you think?

PS

For those who are unfamiliar with how I write posts like this, I literally come into it with the topic and almost no other thoughts on the topic.

19Sep/098

Creating an items table

Today I tried to do a little work on my game but I got stuck on a table which I have been pondering about for a little while now but today it stopped me so I need to address it.

In the game I am working on, players will have items, and will be able to use these items on themselves or others. And these items must be able to have an equation that manipulates the users and the effected players stats. This equation should be able to manipulate multiple stats of each player. I will eventually want to add splash damage but let's start out easy.

So, you have the user who we will call player 1 (p1) and the player that is going to be effected by this item; let's call them player 2 (p2).

Based on this idea I have been able to think of two solutions, one which I ditched almost immediately . But I don't know if the general idea behind this one is any good. So take a look and let me know what you think.

Items table

  • id - 1
  • name - bardic's staff of unimaginable penetration
  • equation - eq{target:10*(p1.str+p1.dex) / p2.def-50}
  • target - 0 // 0 = enemy , 1 = allies, 2 = all

As you can see, I am storing the equation in a JSON like object and would simply do a search on the search and replace the bold variables with player 1's and player 2' actually stats.  This method I think would allow me to easily keep the equation dynamic and clean.

Now lets look at something like area effects (splash damage, group shields) and how I would go about store such an equation in the table. This example has 3 equations in the equation object but only would be be used at most. I would either use target and others or all but I put all three is just for example.

  • equation - eq{target:10*(p1.str+p1.dex) / p2.def-50, others:10*(p1.str+p1.dex) / p2.def-20, all: 10*(p1.str+p1.dex) / p2.def-20}

With this setup I can have multiple equations and multiple stats in either set up. I did have an option 2 which was to bust out all the stats into their own tables but the more I thought about it in comparison to this it just seemed clunky and overly complex for something that shouldn't be that crazy.

Now, to prove to myself that I could actually do this I wrote some a simple script to do such a thing. Right now the script is messier than it needs to be but I wrote it kinda quick just to prove that I can do that I'm talking about here. I will eventually clean it up when I have some time.

But the gist of the script is it hide's the p1.stats and replaces them with actual numbers. This would naturally all come from a database but for the example I just have everything there.

I'd like to apologize in advanced for the lack of formating. I've tried three different highlighters and they break things worse than how they appear here. So till I find a better... sorry >.<

$eq = 10*5 / p1.str + p1.dex / p1.chr;

replaceHoldersWithVals(createStatArr(getHolders($eq)),$eq);

function getHolders($str)
{
$statArr = array();
$pos = 0;
$i = 0;
$len = strlen($str);
while(
$i != strlen($str))
{
if(
stripos($str,"p1",$pos))
{
$pos = stripos($str,"p1",$pos);
array_push($statArr,substr($str,$pos+3,3));
$pos += 6;
}else{
$i = $len;
}
}
return
$statArr;
}

function createStatArr($statArr)
{
for(
$i = 0; $i < count($statArr);$i++)
{
switch(
$statArr[$i])
{
case
"str":
{
$statArr[$i] = array("str"=>10);
break;
}
case
"dex":
{
$statArr[$i] = array("dex"=>7);
break;
}
case
"chr":
{
$statArr[$i] = array("chr"=>2);
break;
}
}
}

return $statArr;
}

function replaceHoldersWithVals($statArr, $str)
{
$pos = 0;
$len = strlen($str);
for(
$i = 0; $i < count($statArr);$i++)
{
$str = str_ireplace("p1.".key($statArr[$i]),$statArr[$i][key($statArr[$i])],$str);
}
eval(
"\$e = $str;");
echo
$e;
}

18Sep/095

Question : Alliance/Clan systems in PBBGs

Here's a thing I'm gonna try to go with. A weekly or twice a week question, where I present a question, two arguements and give a poll for people to vote on.

So the first question (and one I need the answer for so I can keep moving forward on my own game :P ) is :

So the question this time is : Do you think players in a position based strategy game should be forced  onto teams or should they be allowed to form their now teams?[poll id="3"]

On the one hand, you have forcing players into groups. This forces players to work together as a team to defeat the other side, gives a clear enemy and can have some interesting internal player dynamics as they struggle for power in their groups. It also for the designer/coder gives a solid number of sides to build gameplay around and ensure game balance.  But, it limits the freedom of the player, forcing them to work with people in game they may not want to and may stop them from being able to play with their friends.

An example of a game and uses this type of system is StarKingdoms. When you join the game you join a sector with about 20 other people who vote on their leader who has the job of ensure the sectors protection and growth by joining larger alliances and purchasing sector wide upgrades. Another game is FinalEarth which has been closed for ages, but forced players into Axis and Allies teams, allowing for smaller groups to be made with these large alliances. I found this to be my favorite style and the way I'm leaning to on my game but I want to run a few idea's by everyone.

The other side of the coin is allowing players to just join the game and form their own groups. This is a problem for me since I want the game play to be large scale battles and a constant back and forth that I'm not really sure I could achieve with hundreds of small groups.

One of the things that kinda differs in the strategy game compared to others, there is really a limited amount of space and instead of building massive empires you are levying for strategic positions.

But let's assume I picked the option to allow players to create their own groups. You join the game and play for a little while without being a message of a group. After a few days they join one and have all of a sudden need to follow the orders of a leader they may not agree with. You join another and another.  You eventually find one but instead of focusing on the point of the game you are just are trying to find a group you can deal with. Or you just join and never join a group, which means you have never played the game in the way I'm intending it to be played.

Let me try to be not so negative and everything works out. The players find groups they like and battle like I intend. You instead of two or three groups, have 10's-100's of small groups battling for position. This could be pretty damn interesting and would make the game very difficult since positions would constantly change hands. It would actually make it almost impossible for one small group to do this I think. I would think that would eventually merge groups to achieve their ends.

And while this could be an interesting idea, I think after all this writing I'm even more strongly leaning towards two or three teams players are forced onto (maybe with the option to reserve a friend slot or two) and then an internal struggle for leadership as the group works towards their common goal no matter who is leading.

But, what do you think? Vote and comment and we'll debate this till we have a solid idea.

PS: It seems I've written about this in the past.... And polled! But I think this is a much better explanation and a good segway for me to get back into blogging by repeating everything I've ever done xD

10Sep/095

My agrument for flash in PBBGs

I've been reading a lot lately about how flash is a dying language and how it's not going any where, etc etc. But this has nothing to do with that. This, instead, is a rant about why I think it makes sense to use Flash for PBBGs despite all the feedback I've received in the past saying I'm flat out wrong. So let's hope that I get just as much heat this time ^^

To start lets define PBBG. I believe I have done this is the past but I am far to lazy to look for it and I'm sure I have come a bit further since then anyways in my wondering of programming, web and PBBGs.

PBBG stands for Persistent Browser Based Game. By this definition, a PBBG requires a database  for it's persistence and needs to be played using the browser. How does flash not fit within that definition? Flash is a browser plugin. This means it runs within the browser.  A flash game differs from a PBBG that uses flash in the sense that a flash game is nothing more (usually) than a stateless game. You play, you quit, you come back and start at the beginning.  A PBBG that uses flash is the same as any other PBBG. You join, play and when you come back, the rest of the world has been playing and you start where to left.

So, Flash can be squeezed into the definition. It runs in the browser.

The next thing I got a lot of heat over is that flash is just a bad way to do this type of thing because of reason 'a' or argument 'b'.  Sure, it may be a bad way for some since they don't understand as3, but I don't see how JS is any better. Flash will behave the same across all browsers. I don't need to worry about writing my JS or CSS twice to make sure it works.  The only thing I need to worry about is if you're on an iPhone or don't have flash installed. But most people have flash installed.

I'm not saying JS is a bad way either. Each have their advantages but flash is what I know best and there are things I can do in flash that I can't do in JS. Also, if you are looking for animation (which I'm not) flash is your ticket, but animation is a lame excuse since we are where talking mostly about next games.

I could defend flash all day, but in the end, I still view flash as a good thing for PBBGs. Please, please, don't take this to mean make you whole damn site in flash. That's not at all what I'm getting at. What I mean is you use flash sparingly and in the appropriate context. If you have a battlefield map, that's a good choice. You have a crazy interactive inventory or crafting section, there's a good spot.  I would never suggest you use flash for the whole site.

As I've said in also every post this year (which hasn't been many. I'm sorry for slacking so much. I will try to be better but this is a claim I've made before), I'm gonna start posting again. I'm in the building stages of a game using Zend Framework and Flash.  I also will be working hopefully on a few games that fall out of the realm of PBBG, but I will also be talking about those here. One of these games is actually for my day job to boot, so I'm hoping they will let me blog about it ^^