Author Topic: My project: -yet unnamed game-  (Read 5318 times)

Offline tellmore

  • Level 12
  • *
  • Posts: 85
  • Reputation: +3/-0
    • View Profile
Re: My project: -yet unnamed game-
« Reply #25 on: December 28, 2009, 06:01:03 PM »
Not going to make this yet, here we go:

Yes, if the endless loop is killed by something,  the game world will halt.
But, I store the time stamp of the END of current turn, and how long a turn lasts.

This information enables me to use javascript to force a refresh on user end, and also enables me to show  a countdown till next turn on client side.

But, it also has other nice uses.
IF before I make the while(true) (start of endless loop part) I check whats the current time stamp, and the time stamp of the end of current turn, I can tell if something went wrong or not.

So, I just setup cron to run a copy of my endless loop. IF the check is true before the while(true) statement, I can simply use exit() function to terminate the endless loop.
IF the check is false, i can start endless loop.

This means, even if the endless loop is killed for some reason between 2 turns, it will get restarted (as long as windows task manager is able to start it)

On client side -> if the counter reached minus whatever seconds, i can redirect to a nice page telling : "sorry, server is down. try later".

The nice thing is, since i will store events not by time stamp, but turns remained to complete, compared the real world clock i may have delay, but the game world will be in sync all the time. EVEN, if the endless loop gets to be killed during update of the database. ( things that should happen NOW (game world time wise) have 0 turns left, if it was not processed last time, then this value would get decreased by 1 again, going into negative value. -> so if i first do things that have game wise time remained less than 0, i can force the server to catch up if -by some reason- the endless loop failed to update all records.

The endless loop i have takes 7020 K memory, when in the sleep state.
Windows notepad with no file loaded takes 3388 K memory.

It does not cost a lot to do this.
Even if it does some very complicated thing, its only a few lines of code , and 1 entry to windows schedule manager.
Comes the question what gives if database was not updated , because mysql went wrong?
Simple, the endless loop KILLS its self as soon as mysql returns an error.

It is no problem at all, no values updated in mysql simply mean the game went into a sleep stance.
Anytime I can restart it, the game world will be in sync.
Thats because time stamp just used to align next turn time (and also the sleep period of the endless loop, and refresh on client side), time unit used is TURNS .

So if the endless loop gets to a halt, but its not critical, just needs a restart, it will be done without interaction. I can use PHP exec() to run some alarm window for me if there is a critical problem.

It really takes no more than few lines of code to add such functionality to this -let me face it..) "dumb" solution. I bet its harder to do "on demand" processing of data, not to mention keeping the game world in sync if there is a problem / server shutdown / whatever.

As many things this is a double edged sword too.
I see it has drawbacks, but for the light application it will have to server, it is not inefficient enough to demand a better solution. Even if so, I can anytime turn to full cron based one.

Might ask why not just make the thing with cron job..
Well, if the endless loop gets terminated for any reason I can get a warning BEFORE it would have to do anything. IF i use full cron jobs, I will only notice things went bad, when the cron job should run.
It gives me time to fix things. (15 minutes is sometimes more than enough to find a small bug.)

Anyways Your opinion is welcomed, since its a problem that will scream for a solution later on.
Anyone willing to try this scheme should keep in mind what

ST-Mike

pointed out.

Best thing in BAM (http://www.bambalam.se/bamcompile/) is, that included PHP files get to be processed as well. So, if i make an exe out of a php file that does no more than include () a nother php file, i can modifie this file, and when i run the exe it will get executed without re-makeing the exe file.
In short, i can change whatever i need and keep source code variant only.

Sorry for the messy post, this is where my English knowledge ends. I can not express my self any better..  so it may not make sense for first few readings :)
No glory whit out suffering right?


Offline raestlyn

  • Level 29
  • **
  • Posts: 463
  • Reputation: +9/-5
    • View Profile
Re: My project: -yet unnamed game-
« Reply #26 on: December 29, 2009, 02:53:19 AM »
Not going to make this yet, here we go:

Yes, if the endless loop is killed by something,  the game world will halt.
But, I store the time stamp of the END of current turn, and how long a turn lasts.

SNIP

It really takes no more than few lines of code to add such functionality to this -let me face it..) "dumb" solution. I bet its harder to do "on demand" processing of data, not to mention keeping the game world in sync if there is a problem / server shutdown / whatever.


Actually, you are making the updating way harder than it is. You are already storing and comparing the timestamps, just drop the resource eating loop and do it on every page view, it will take less resources that way. Keeing the world in sync takes no effort really, because there is a individual timestamp for each entity.


I can send you pics of my cocks if you want reference.


Offline tellmore

  • Level 12
  • *
  • Posts: 85
  • Reputation: +3/-0
    • View Profile
Re: My project: -yet unnamed game-
« Reply #27 on: December 29, 2009, 06:41:13 AM »
I only store 1 times tamp.
Event table only has number of turns left stored.

So i only compare 1 time stamp.


Offline jannesiera

  • Level 35
  • **
  • Posts: 1,026
  • Reputation: +6/-1
    • View Profile
    • BBGameDesign
Re: My project: -yet unnamed game-
« Reply #28 on: December 29, 2009, 09:37:22 AM »
I only store 1 times tamp.
Event table only has number of turns left stored.

So i only compare 1 time stamp.


If you used Reastyln's method you would also compare 1 timestamp, for every user. You only need to code it for 1 user, right? It's a very easy solutions that works for most games, much easier than your infinite loop, to me.

Offline raestlyn

  • Level 29
  • **
  • Posts: 463
  • Reputation: +9/-5
    • View Profile
Re: My project: -yet unnamed game-
« Reply #29 on: December 29, 2009, 11:17:49 AM »
I only store 1 times tamp.
Event table only has number of turns left stored.

So i only compare 1 time stamp.


If you used Reastyln's method you would also compare 1 timestamp, for every user. You only need to code it for 1 user, right? It's a very easy solutions that works for most games, much easier than your infinite loop, to me.
You still have have hard time spelling my nick, Janne? :P

And back to the topic; What he said.


I can send you pics of my cocks if you want reference.


Offline tellmore

  • Level 12
  • *
  • Posts: 85
  • Reputation: +3/-0
    • View Profile
Re: My project: -yet unnamed game-
« Reply #30 on: December 30, 2009, 11:00:18 AM »
well the just run when users clicks is not really an option i would choose..
For a number of reasons.

But most important is i need to pause the game if i need to.
If i break the endless loop the game will go to sleep.
And anyways i use relative time scale, respect to last turn. Not real time mode.

Needless to say i acknowledge my approach has "a few flaws" :D
Games that are to be released to public in any form should consider what the others have suggested to me. For some reason i feel they might speak from experience.
I lack experience, but hell.. its my excuse to do a messy job :D
Don't want to blow it, right?

Anyways i haven't done a single line of code since i posted last time, I was watching code geass.
Not bad but , did like GITS better. I hate that every tv series like code geass shows huge mechanical suits as agile as a human body, fighting with swords and all sortha things they should not do. But at least the story is interesting :D

nah, enough of geass.
I think i have to force my self to commit the next step.
Bit more on game interface, and creation of the first system where the player can exsist, and make the verry first action possible:
FLY to location X.

Does not sound like something big, is quite a small step in the project, but a huge leap for me.
Still textlinks that change content of an Iframe, lol. Poor mans interface I may call it.
I'm not sure if i should use javascript to change content, or should i just use plain (<a> tag) links.
For the sake of my noble lazynes i stick with plain links for now.
Heck.. not even sure what kind of controls i need :D

Just one of those times when a project WOULD and SHOULD scream for some sortha documentation.
But -what a surprise- I'm lazy to do that.. so comes "add a good idea when you have one" solution.
Since I lack good ideas, it DOES solve a lot of problems :D

*edits, love -> SOLVE, darn keyboard, SOLVE i say, darn.. needs some though reading keyboard or what.



« Last Edit: December 30, 2009, 12:41:41 PM by tellmore »

Offline jannesiera

  • Level 35
  • **
  • Posts: 1,026
  • Reputation: +6/-1
    • View Profile
    • BBGameDesign
Re: My project: -yet unnamed game-
« Reply #31 on: December 30, 2009, 11:52:04 AM »

Anyways i haven't done a single line of code since i posted last time, I was watching code geass.
Not bad but , did like GITS better. I hate that every tv series like code geass shows huge mechanical suits as agile as a human body, fighting with swords and all sortha things they should not do. But at least the story is interesting :D


Funny coincidence. Just now, I finished watching the the last episode of Code Geass. The plot is pretty great :). The storyline gets better every episode, just a warning ;).

Offline codestryke

  • Administrator
  • Level 33
  • *****
  • Posts: 588
  • Reputation: +22/-0
    • View Profile
    • eXtremeCast Games
Re: My project: -yet unnamed game-
« Reply #32 on: December 30, 2009, 02:19:25 PM »
The idea of the endless loop is a good one, however, you are tasking PHP to do something it wasn't really meant to do. PHP is written with the idea something would make a request an instance of PHP is created to handle the request and finally that instance of PHP would be removed from memory. PHP is an instanced application and looking though the documentation still has some memory leaks because it relies heavily on it's garbage collection and instancing approach to running. Running just a endless loop and comparing it to another program doesn't really tell us anything. When you start making PHP do something over X amount of time then you will actually have some usable data.

PHP is a great language and has made dynamic page programming pretty easy but is starting to break down with the advances of the web. Real time processing, daemons and push technology are becoming more and more common and with those technologies PHP is lagging behind fast.

Good luck with your project, if nothing else it'll provide a interesting learning experience :)

Creating online addictions, one game at a time:

Offline tellmore

  • Level 12
  • *
  • Posts: 85
  • Reputation: +3/-0
    • View Profile
Re: My project: -yet unnamed game-
« Reply #33 on: December 31, 2009, 06:35:10 AM »
Can't disagree with that statement, but as long as it does not show any sign of memory leakage, it will do just fine. PHP has grown to be a commonly used, all around workhorse. Not the best in anything, but surely can fill any role with medium efficiency. I would be happy if my project would have like 5000 pageviews a day (including page refresh) but I'm not shooting for anything large.

I will be absolutely amused if i manage the barebone to work, and say.. 2 or 3 of you people give it a run. (log in, move to A, buy some B for C, move to D , sell for E)
I don't intend to make a full releasable game.
With no skills and o experience it would be total overkill.

Maybe if it works well, i might give a go and remake things properly, but probability of that is low.
Creating something heals my pain, so I would call this project a medicine.
As i only try to prove to my self i can still create something unique.



As for the memory leakage, I will make the endless loop create a table and fill it with  2-300 lines random stuff, then query it, replace a few things, and go to sleep.
If it can manage it whit out hogging memory, then it will be just fine.
I think that would be a good test. I have time till i finish things, for that time i will let it run on its own.
If it can return to use the same 7000 K memory while its in sleep() state then i have luck and no memory leakage.




Offline jannesiera

  • Level 35
  • **
  • Posts: 1,026
  • Reputation: +6/-1
    • View Profile
    • BBGameDesign
Re: My project: -yet unnamed game-
« Reply #34 on: December 31, 2009, 06:54:08 AM »
Creating something heals my pain, so I would call this project a medicine.

Beautiful quote  :o !

Offline tellmore

  • Level 12
  • *
  • Posts: 85
  • Reputation: +3/-0
    • View Profile
Re: My project: -yet unnamed game-
« Reply #35 on: January 02, 2010, 09:24:09 AM »
well, so far i'm done with the logic stuff.
Now comes the suffering..

HTML stuff..
Gotta hate it.

But, there is a good news too, have some friends who would pay a whopping price to show banners on the site. Ironic, i don't have a public site , lol.

Still it seems good idea.
If they do pay me, i will move the whole thing to a nice host with time.


Offline tellmore

  • Level 12
  • *
  • Posts: 85
  • Reputation: +3/-0
    • View Profile
Re: My project: -yet unnamed game-
« Reply #36 on: January 03, 2010, 12:17:47 PM »
So far as "logics" of a game, and its visual presentation, there are methods to make things properly.
Some say it is way better to have a proper design documentation way before doing anything, and the static webpages that will be modified.

I think it is not that simple. I seen a few posts on this forum about the problem of "when to release".
Release a game when it is able to work, that means the very basic functions.

I would say that every single approach has its flaw.
Design way before doing a code seems logical, but its very hard to design everything on paper.
Also, if You are not an experienced full fledged code maniac, you might not even now whats possible to do, and what not. And the concept of a game at the start may not even be similar when its finished.

So, i would say, there are things that are common in any browser game.
You need registration page, login page,
there is a "setting" for a game (space game, fps game, whatever game, set in future/past/now parallel universe, and so on..)

Those things do give a lot to work on, while you make them you will have more than enough time to
worry about some future features.

Also, a good idea is to play your won game from the moment it can be playd on any lvl.
If you find YOUR OWN GAME as interesting as a DEAD RAT, you need some features then.

Lets face it, browser games are played for a number of reasons..
-easy to master
-has almost no hardware requirements
-does not consume a lot of time

at least I play browser games for those reasons.
Creating a combat system that it way too complicated for the majority to understand (people who log in for a few minutes a day to check on things) will not work.
A skill tree that is so complicated it takes months to fully understand will not work.

Creating any feature that is hard to understand, hard to master, and complicated will not work.
One side is, you will be annoyed by coding such things.
Other thing is, players (majority) will not like it. Not just its hard to master, but the more complicated is something, the more things can go wrong, can be buggy. And thats annoying as hell.

Be a game ugly as hell, if it works properly its still more welcomed than something that looks good, but refuses to work properly.

The looks of the game can be changed anytime. In fact, a n00b like me can even get some help, if a player offers to make a few cool image. In fact, it may even be a good idea to let the community of your own game participate, like you can have players win cool things in exchange for the effort.
Next thing they do is tell everyone that something they made is included in a real,exsisting game, and will show it to many people. Those are all potential players. Best advertisement you can have.

So i would say one should aim to "regardless of tools" create the foundation of a game, then clean your code, while letting people test it.

The important thing is to learn from your own flaws. And ENJOY what you do.

And stay tuned, not too far in time my "nameless" trade game will be playable to some lvl.
I will try one of those 000 webhost things.



Offline tellmore

  • Level 12
  • *
  • Posts: 85
  • Reputation: +3/-0
    • View Profile
Re: My project: -yet unnamed game-
« Reply #37 on: January 06, 2010, 02:41:13 PM »
well, 000 webhost is not going to work.
So they say they have crons enabled even for free accounts.
Well, guess what? DID not work at all.

So 000 is out. I did set everything up right, JUST LIKE I WAS TOLD BY 000WEBHOST CUSTOMER ASSISTANCE, still it does not work. (well, works if I open the file from the browser).

Also, I was thinking maybe the include() was the source of problems, so I merged those things into 1, just to make sure.

Still does not work, so -thanks to this great host- my todays plan to reveal a link to visit my "work' i done so far is spoiled.

Now comes the sense of logics.
IF the host is not going to help me solve this issue while I'm at free hosting (so BEFORE I pay them anything) why would it help to solve anything if I become a payed hosting? (so AFTER I give them money)
If they don't help me before I give them anything, why should they do anything after I already payd..

Well, anyways free stuff usually equals to bad stuff.
Why would anyone do anything for free, right?


Mh..
To get back to something interesting:
Many games use plain text links to do stuff.
The $_GET method to pass anything is just ugly.
So until I manage to find a free host with:

- ENABLED AND WORKING CRON JOBS
- 100 Mbyte storage
- 1 Mysql database
- decent speed
- PHPmyadmin


I will turn all my $_GET links into a different animal.
They shall use the $_POST method.

This does call for a bit of javascript, something I hate for no reason (but hell I DO HATE it).


Supposedly..
A javascript function can submit a form.
Code: [Select]
<script type="text/javascript">
function submitform()
{
  document.yerform.submit();
}
</script>

The form it self is easy to make, but instead of a submit button I use a text link.

Code: [Select]
<form name="yerform" action="whatever.php">
<input name="stuff" type ='hidden' value="anything you want"/>
<a href="javascript: submitform()">some dumb text</a>
</form>
<script type="text/javascript">

Why would this be cool...
Nope, it ain't cool at all.
Some kids always try to exploit stuff by bookmarking links.
IF I would use the $_GET method, anyone would be able to see everything at the bottom of the browser, the name of the variable, and the value (in case I send one with $_GET).
Surely, the page source code will show all this information.

But, I simply HATE to see those long long ugly links.
And it also stops less educated ones (who are probably not educated enough to view the page source anyways) to copy the link from the page, and start doing pointless things.

It is absolute not a very useful thing to do.
I just do this for my own fun.

//BTW, if anyone happens to know of :
a.) how to make 000webhost crons work,
b.) a host that qualify for my needs, and is free
DO post here. I would be looking forward. Really. IF you have one of those affilitate referral stuff links, then PM send it. I don't care what solution, until it works. As I can not keep my own computer running 24/7.


Offline tellmore

  • Level 12
  • *
  • Posts: 85
  • Reputation: +3/-0
    • View Profile
Re: My project: -yet unnamed game-
« Reply #38 on: January 07, 2010, 09:11:37 AM »
okay, links had been changed to javascript POSTs.
Thats something i enjoy.
NO more clumsy "http://www.whatever.xxx?bla=some_stuff&bla2=even_more_stuff&bla3=THATS_JUST_UGLY_AS_HELL

No way. Never again.
Instead, it just shows:

Javascript : stfu(bla,bla,bla)

Oh yeah, now i feel like GOD.
Not less, at least. Its for my own selfish comfort. I bet my IQ have risen by a factor of at least 10^3.

And, best of all if some guy "rightclick->open in new tab" -s this link, will get a BIG, FAT, EMPTY WHITE screen.
I love it.

While I was sharpening this, I came to the conclusion i have to change how i store the stuff my space stations sell/buy.
For now I only had 1 kind of thing to sell, and 1 kind of thing to buy for each station.

Terrible...
If I was to expand it, it would be plain ugly.
So, i will remake the database, (at least this part..) as station location IS stored, I will add every single goods that are available for purchase at that given station as a new line in mysql. So, given i have the location of the player, I can query this. If the position is matches, then i can list all goods for sale, and for purchase.

This allows some flexibility, it was not quite realistic that a big huge space station only demands 1 thing to produce stuff. (like.. my ice crystal mine needs only fuel cells ATM. That is surely enough, but what about say.. an ore processing plant? Surely, needs ore, but also needs energy too..  So this is a very logical step to make.)

At the moment the script that shows what is available to purchase/sell (trade screen) is quite simple, only like 5 lines of code. Nothing wasted, easy to convert things.

Hopefully sooner or later i WILL find a host that works properly, OR I manage to get money from somewhere to get a payed hosting service.  I would like to show the stuff i made so far, but for now its impossible. SADLY. ah, anyways..

Off to make new table for goods, and update the game script a bit.

I'm very very pleased so far. :D



Offline tellmore

  • Level 12
  • *
  • Posts: 85
  • Reputation: +3/-0
    • View Profile
Re: My project: -yet unnamed game-
« Reply #39 on: January 08, 2010, 05:03:23 PM »
I'm getting depressed.
so-so..
Database rewrite and adjusting the PHP code is almost finished.

Whatever i do I have some requirements..
-brutal amount of food..
-huge jugs of tea. LOTS.. I drink over 6 liters a day in any time of the year
-some good anime/manga.

Soon i will finish off death note too.
What em I going to watch afterwards??


Offline Nox

  • Level 35
  • **
  • Posts: 738
  • Reputation: +12/-2
    • View Profile
Re: My project: -yet unnamed game-
« Reply #40 on: January 08, 2010, 05:08:52 PM »
You managed to make a blog out of this forum ;)
Meet us at an IRC irc.freenode.net #bbg as well
Enjoy http://spiritbeacon.noxart.cz/ !

Offline tellmore

  • Level 12
  • *
  • Posts: 85
  • Reputation: +3/-0
    • View Profile
Re: My project: -yet unnamed game-
« Reply #41 on: January 08, 2010, 05:36:04 PM »
well, might as well admit it is a kind of blog.
did not intend to be one when i started it,
but some do seem to enjoy my pathetic entrys, so might as well continue them.

Just a for of recreation for me, and maybe a form of recreation for others. Whom might it hurt, at worse i could get some "unpleasent" replys. Nothing i should worry about.

Absurd number of views on this "project topic" (at least for its useful content) reveal some do read this stuff.

Offline jannesiera

  • Level 35
  • **
  • Posts: 1,026
  • Reputation: +6/-1
    • View Profile
    • BBGameDesign
Re: My project: -yet unnamed game-
« Reply #42 on: January 09, 2010, 02:59:11 AM »
I'm going to see Death Note and InitialD in the future (right now reading InitialD online).

Have you seen Full Metal Alchemist or Tenjho Tenge? If you you haven't you should check it out :). I don't have much time to watch anime so that's everything I can suggest :P.

Offline tellmore

  • Level 12
  • *
  • Posts: 85
  • Reputation: +3/-0
    • View Profile
Re: My project: -yet unnamed game-
« Reply #43 on: January 09, 2010, 08:13:29 PM »
done with death note-

I was told that code geass and death note share the basic idea.
But, all of them where wrong.

I like Code Geass better. It does teach something different, and far more useful than death note.
Also, in Code Geass, the "hero" manages to accomplish everything, while he does in fact pays a price that simply does not worth it. I don't see this is death Note.

Both story is interesting, but Death Note is lacking of many things. And I was hoping Ryuk has more to do whit the story than being a bystander almost all the time.

Well, anyways both story tells something important.
Code Geass teach that anyone who has the power to change the whole world, must -at some point- loose every and any thing he/she finds value in. Code Geass shows the struggle of Lulu, the way his OWN laws set are breached along the way. The constant challenge of reaching his goal and the fact that every major step towards demand a HUGE sacrifice.

Death Note on the other hand just tells, no matter if one has the power to become the "ultimate judgment", none can judge others without being judged him self by others. Fire can not be defeated by fire.

What i never understood in these manga/anime stuff, is how come 99% of the good storys start with:
A COMMON STUDENT

Is it the accepted plot in japan?
Or it has something to do with young students appetite to be "different" from others in a uniform world, and these stories -showing a common student gain power- help them to get over it?

Ah, never mind it.
Probably no one could ever answer those, and BBgameZone is not quite a place to discuss it..

To get a link to the previous reply:
Yes, i love the Full Metal Alchemist.

I will look into InitialD, the name sounds interesting :D

And, to get back to the very purpose of this whole topic:
With a bit of help from the coding section - Thank You a lot codestryke- I was able to FINALY make my form validation script work again.

And, I finally figured out why i hate javascript.
In PHP, if you want to use a variable, you put a $ sign in front of it.

In javascript You don't.

In komodo edit (what i use, I did give a try to other editors out there, but i found it the most and single useful thingy ever) javascript looks like a mess. The syntax highlight makes it hard to use javascript.

Wish javascript would have a methood like php, and use $ in front  of variables.
Also, no way to hide javascript source code of a webpage, simply NO way at all.

Other than that, the magic javascript word:
this
...
Well, saved me a few lines of code, surely, but its still reminds me of people who can only reference things as "stuff".
Hate it when all they can say is:
"Hey, could you help with this stuff, I'm stuck at this when i get to this stuff, and I don't know how to pass on to the next stuff"
Could mean the person has problems with math or physics, but could also mean he can't push his shopping cart to the chips...

Same goes with javascript for me, I like what it can do, but hate how it can do it.
Some might say: then don't use it.
Sure.. But I have to use it.

Well, anyways it is my problem to deal with any problems related to my project, so I guess i will be better to somehow learn to use it properly then moan about how badly i hate it..

"javascript takes its toll"







Offline jannesiera

  • Level 35
  • **
  • Posts: 1,026
  • Reputation: +6/-1
    • View Profile
    • BBGameDesign
Re: My project: -yet unnamed game-
« Reply #44 on: January 10, 2010, 06:19:36 AM »
In the beginning I hated javascript too. I really hated it, so frustrating... but I got used to it and now it doesn't bother me at all. At the moment I am creating a game map with the HTML5 canvas element so atm I'm only doing javascript. Have no problem with it at all anymore.

Offline tellmore

  • Level 12
  • *
  • Posts: 85
  • Reputation: +3/-0
    • View Profile
Re: My project: -yet unnamed game-
« Reply #45 on: January 10, 2010, 07:06:59 PM »
MUST focus more on the project it self, it seams i got a bit carried away.

Anyways, one might be interested to know how do i make a dynamic market.

If it was not clear, the game is mainly about trading between various space stations in space.
Every station produces something, and buys something else.

For my example, i will use only 2 stations.
A solar power station, that produces fuel cells from ice crystals,
and an asteroid mine, that produces ice crystals with the help of fuel cells.

It seems that a player could spend his time just shipping ice crystals and fuel cells back and forth between this 2 stations. This is where dynamic market comes into mind.
What it does:
If a lot of fuel cells are sold, then the sell price of fuel cells will be higher.
(same goes for ice crystals sold, and so on. You get the idea.)

It would be trivial to manage this.
But, imagine the following horror episode:
You doc at the solar power station, and the server sends you ACTUAL prices.
You see, fuel cells cost only 12 credits each. While you think it over where to ship it, another player docs, and buys a HUGE amount of fuel cells. Naturally the price would change.

So, what to do? Make it AJAX style, and update the price on every user? It would be highly likely that JUST before you would buy the fuel cells, the price would change, and it would be annoying like a dead rat in your breakfast. And still could happen the price you just saw when hitting the button to buy the cells is not the same as when the server is processing the request you sent. I would be mad if something like that would happen. No doubt. That would be the problem if it all was real time.

What gives if prices are not upgraded in real time?
Then, the request would NEED to contain the price of the fuel cells. So the server could deduct the founds from your balance. It would get hacked with ease. As I simply could not check the validity of the request.

So, here comes the N00Bzie(x) fashion solution of mine.
My game is tick based, so prices will be upgraded at every single tick.
Now then, since end of the tick will reload the page, you will see actual data, and prices.
Relaxing, this method offers the ability to verify the validity of the trade requests sent to the server.
Way to go..

But.. there is still a problem..
HOW to change sell/buy prices?
Should all stations have a stock, and if the stock gets low, ask for higher price?
Sounds very realistic, but it has a few flaws..
This stock would need to replenish. The rate of replenishment is critical, so is the stock.
Starter players at the starter systems have low cargo capacity, so i would need to set the stations to a low stock, and prices should change at low purchase. So i could force players to seek other systems.

Now comes a bit of problem, what would give if a higher ranked player, with a huge cargo space would buy a LOT of fuel cells? next turn prices would be sky high, and new players could not make any profit..

And comes again the N00bize(x) solution:
Stations don't have a stock.
Stations do not have a rate of production.
At the end of every turn, the processing script will check how many fuel cells had been sold.
If more than X, the price will increase by 1 credit. If less than X, price will decrease by 1 credit.
Stations have a minimum price, and maximum price for all commodities they are selling / buying.
This way I can set the maximum price one commodity can reach (and also the minimum price it could drop to) frequently visited stations would slowly increase price (selling) and decrease price (purchase) so players would do the best to try and avoid over populated areas. That also involves the starting places.

To help players decide if a commodity is sold at a price that may lead to profit, I will make a small javascript thingy. It will be a box for every commodity a station offers to sell , this box will have a color. Price maximum and minimum lets me calculate the average price. If the current price is higher than average, then the box will be RED, if its less than it will be green. (for purchase, naturally)
I would suppose this will help players make profit.

This is already working, it also will mean that distant places will sell things for dead cheap, and buy stuff for high prices. One more factor for players to try and explore the whole game area.
It would not likely benefit if all systems a player can go would be safe.
So, sooner or later i will have to add pirates. (some systems will have them, other will not have them)
So, if You managed to gain enough credits to upgrade your ship with weaponry, you could go to systems with pirates, and trade. If not, you will end up LOOTED.

Not sure yet how to add PVP, but surely with time I will manage to find some clever solution to do it.
I don't want small players end up looted by big players all the time.

Well, so much for the dynamic market. I don't know how well will it work out, keeping a balance will be very hard. But anyways, keeping in mind that I don't think this will ever be a popular game, IF it ever gets to be hosted and published.. It should not be a problem at all.
:D

//honestly I just aim to get the title of GAME OWNER too. Sounds SO awesome, lol.. Even if it not a big deal. In my country we have close to 9.5 million citizens. Out of that only like 30 people could say the same. Still not 1 in a million, but at least I could at least say I'm special in something..




Offline codestryke

  • Administrator
  • Level 33
  • *****
  • Posts: 588
  • Reputation: +22/-0
    • View Profile
    • eXtremeCast Games
Re: My project: -yet unnamed game-
« Reply #46 on: January 10, 2010, 09:33:40 PM »
Ok I didn't read the entire post but there is more at issue then just how to program the market or by what technology to use. Let me speak from very personal experience on running an open market on a game and what you WILL encounter.

1) Players WILL inflate the prices to transfer funds to each other
2) Players WILL offer prices very cheaply while there buddy is online so they can buy it
3) Players WILL (if it's a blind market) price resources with a special price to notify/signal there buddy to buy

Given a free flowing market in a game will not actually create a free floating market. What it does do is create a way for two or more players to create a way to circumvent the system. I went 6 years of modifying a market system in a game and still had people using it not as a market but a way to transfer resources.

Just some things to be aware of besides just the technology aspect of creating a market.

Creating online addictions, one game at a time:

Online Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,133
  • Reputation: +26/-1
    • View Profile
Re: My project: -yet unnamed game-
« Reply #47 on: January 11, 2010, 05:04:46 AM »
it seams i got a bit carried away.
No doubt :D

I never made open market game, so theoretical only.
- The market is blind, everything is immediately sold/bough at the current price (it is sold to the "game" not players).
- Depending on quantity of sell/buy transactions in the PREVIOUS DAY (to avoid timezones problem) the price is changed.
- The price has global minimum/maximum and daily maximum change (+/-).

My biggest concern, if such system would be introduced, wouldn't it be simplier to just make a completely random price change set arbitraly by the game?

Offline raestlyn

  • Level 29
  • **
  • Posts: 463
  • Reputation: +9/-5
    • View Profile
Re: My project: -yet unnamed game-
« Reply #48 on: January 11, 2010, 05:57:10 AM »
intresting, you don't like JS but want to use AJAX...


I can send you pics of my cocks if you want reference.


Offline tellmore

  • Level 12
  • *
  • Posts: 85
  • Reputation: +3/-0
    • View Profile
Re: My project: -yet unnamed game-
« Reply #49 on: January 11, 2010, 06:38:05 AM »
Well, answer is no.

If i would have random numbers, there would be almost no need to go anywhere from the starting system, as random price change would mean buying something for a good price is possible anywhere, just have to dock and wait for a good price.
Whit my method, profit is best if you can go to a system where only a few people trade things. So your purchase power does not increase sell prices / decrease purchase prices.

This is supposed to force players to populate the whole game area.
A simple random price change will not have that effect.


 


SimplePortal 2.3.3 © 2008-2010, SimplePortal