Sign in to follow this  
Mjurfen

Unity [web] Creating a web based strategy game

Recommended Posts

Mjurfen    100
Hi all!
This is my first post here on this community so I hope you will treat me nice [img]http://public.gamedev.net/public/style_emoticons/default/tongue.gif[/img]

I'm a programmer and has very good knowledge in C# and SQL, but now on my spare time i was thinking of creating a game. I have created some small games in XNA before but this time I want to create a web based game forcing me to learn more programing languages.

I was thinking about using HTML and javascript, asp.net and mssql. I got myself all applications and servers needed for this task.

I have started (using pen and paper) to draw out the outlines for my game and how it will work basically.
My knowledge in html is about 3 on a scale to 10 and in javascript 2 on a scale to 10 but that is not something that will stop me (Google is my best friend [img]http://public.gamedev.net/public/style_emoticons/default/biggrin.gif[/img])

So now to my questions:

I was planning on creating a simple strategic game. I know there are lots of these types of games already but this is meant as a learning scenario for me.
The game itself should be about gather recources over time, buildning armies, attacking other players and so on, but not realtime game.

I want it to be based on time, let me show you an example:

The user should gain resource over time, lets say 10 gold each 15 min for example.
The player should also gain soldiers over time.

When the player choose to attack anther player, the attack will not be imminent. It should be delayed for let say 2 hrs.

So my question here is how will i handle this in code. I mean, the user will probably not sit and wait with the browser open until the attack, so this needs to be handled elswhere but how?

(1) Do i need to build some type of server application that pools the db to see if an attack should be executed or how should i approach this?

(2) How can i trigger events based on the time? For instance the resources, it should add resoucers to the player each xx min. Its easy when the user goes online i can calculate the amount by finding out how long the user been offline and then add the right amount. But when the user is online how will i add the resources? Using java
or what?

So these are my first question but more will come, rest assure [img]http://public.gamedev.net/public/style_emoticons/default/tongue.gif[/img]

// Mjurfen

Share this post


Link to post
Share on other sites
JNicholls92    100
Hey

I been looking thought your post and they are realy good questions to be asking, I am not sure of the anwser when it comes to asp.net, All i know is that using php you can create this timing effect using whats called a CRON job, this is a job done by the server anytime you set it to, So for example you could set it to go every min, and make it so that in your database you have min and hours, so every min the mins will + 1 and every 60mins the hours will plus 1.

This would make it so that you can exacute any command you wish to after any amount of time.

I have created textbased games using PHP, MySQL, HTML, Javascript, JQuery, AJax

Please feel free to email with any other questions jamienicholls1992@live.co.uk

Hope this helps

Share this post


Link to post
Share on other sites
Mjurfen    100
[quote name='Jamie Nicholls' timestamp='1313748061' post='4851129']
Hey

I been looking thought your post and they are realy good questions to be asking, I am not sure of the anwser when it comes to asp.net, All i know is that using php you can create this timing effect using whats called a CRON job, this is a job done by the server anytime you set it to, So for example you could set it to go every min, and make it so that in your database you have min and hours, so every min the mins will + 1 and every 60mins the hours will plus 1.

This would make it so that you can exacute any command you wish to after any amount of time.

I have created textbased games using PHP, MySQL, HTML, Javascript, JQuery, AJax

Please feel free to email with any other questions jamienicholls1992@live.co.uk

Hope this helps
[/quote]


Hi and thank you for your reply!
Well it's a start, i googled the CRON and added "ASP.NET" and found this article [url="http://msdn.microsoft.com/en-us/magazine/cc163821.aspx"]here[/url]. Maybe thats what I'm looking for....

I will most likely keep your mail adress for further assistance if you dont mind!

I have noticed that a lot of people are using PHP, sadly though I have ZERO experience with PHP [img]http://public.gamedev.net/public/style_emoticons/default/sad.gif[/img][img]http://public.gamedev.net/public/style_emoticons/default/sad.gif[/img] [img]http://public.gamedev.net/public/style_emoticons/default/tongue.gif[/img]

Share this post


Link to post
Share on other sites
JNicholls92    100
PHP is easy to use and i dont mind helping, i start PHP 2 years ago, i dont say i am expiranced yet, but i can create a text based game, for example
[code]
<?PHP
$MySQL = mysql_connect('localhost', 'user', 'pass');
$MySQL = mysql_select_db("name", $MySQL);
if(!$MySQL){die(mysql_error());}
?>
[/code]

That is all you need to connect to a mysql database and then to do a query it mysql_query("SELECT * FROM user WHERE id='1'");

Yea keep the email and email me if you want help with anything

Share this post


Link to post
Share on other sites
markr    1692
Sounds like it's a classic "tick based" web game.

Yes, you probably do need to have some process which periodically processes the "ticks". In Unix this would be a "cron" job, however, it is also possible to run such jobs in MSWindows from the event scheduler or by some other means (at a push you can have a console app which just does a lot of sleeping between ticks).

The normal architecture for such a game is:

* Web UI reports the "current state" of the game, and allows players to register an "intention" to do something the following tick, maybe the amount of resources to spend on various tasks, trade with or attack another player etc.
* "Tick processor" which processes all the "intentions" each tick, and adds resources etc (e.g. resources acquired by mining, farming), handles battles, character movement, etc, and updates all the "current state" tables

Which is pretty straightforward. You just have two sets of tables "state" and "intention".

There are a few tricky bits, such as how to prevent problems where players are trying to view / update things during the "tick" - they could simply be temporarily locked out.

The game design (and UI design, graphics design etc) is likely to be much more complicated than the actual technical basis for the way such games work. They're generally pretty fun and attract a decent niche audience if done well.

Share this post


Link to post
Share on other sites
pauline11    100
Reading this thread helps me understand how to use PHP, MySQL, HTML more. :) Cool!
[url="http://www.imageworksstudio.com/web/web-design-development/custom-web-design/index.html"]strategic web design[/url]

Share this post


Link to post
Share on other sites
SimonForsman    7642
[quote name='markr' timestamp='1317158067' post='4866577']
Sounds like it's a classic "tick based" web game.

Yes, you probably do need to have some process which periodically processes the "ticks". In Unix this would be a "cron" job, however, it is also possible to run such jobs in MSWindows from the event scheduler or by some other means (at a push you can have a console app which just does a lot of sleeping between ticks).

The normal architecture for such a game is:

* Web UI reports the "current state" of the game, and allows players to register an "intention" to do something the following tick, maybe the amount of resources to spend on various tasks, trade with or attack another player etc.
* "Tick processor" which processes all the "intentions" each tick, and adds resources etc (e.g. resources acquired by mining, farming), handles battles, character movement, etc, and updates all the "current state" tables

Which is pretty straightforward. You just have two sets of tables "state" and "intention".

There are a few tricky bits, such as how to prevent problems where players are trying to view / update things during the "tick" - they could simply be temporarily locked out.

The game design (and UI design, graphics design etc) is likely to be much more complicated than the actual technical basis for the way such games work. They're generally pretty fun and attract a decent niche audience if done well.
[/quote]

You don't actually need to update at a fixed rate, you could also have the php scripts requested by the users trigger the update logic if necessary, (This however will increase page load time for the first visit and you do need a locking mechanism to prevent multiple visitors from triggering updates at the same time.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Partner Spotlight

  • Similar Content

    • By Levgre
      I have a design doc I can share, either contact me here, at levgree@yahoo.com, or on Discord (tag is levgre#1415). I am only going over some of mechanics in this post, with more focus on combat than campaign, as combat is the core of the game.  designers could possibly be welcome, at the least I don't ever mind getting additional ideas/feedback.
      Like said in the title, the game is inspired by Darkest Dungeon, but aspiring for deeper and more varied combat/campaign mechanics.
      Theme: the player controls a party of raiders that go on missions, getting loot, building up reputation and experience, etc.  These missions would often be populated areas like towns and forts, but also could be caves, forests, and other settings.  
      The player will control a party of 6 characters.  Changing group formation and individual character positions will be an essential part of strategy for all party compositions.   However, most characters will still be in melee combat, as often the party will be fighting off enemies from both sides (just less often from the rear).
      Characters, both friendly and enemy, will be able to die or be severely injured in one hit, and no magical healing available.  However they will be able to dodge or deflect most attacks until they run out of "stamina", at which point they become sluggish and easier to kill.  So gameplay wise, stamina behaves sort of like the regenerating shield in halo.  However if the player makes a tactical error or puts a character in a situation where they are outmatched, characters could still be wounded even at full stamina.  So individual battles are not the only threat, but also tiring  from waves of enemies.
       The player's group can rest when needed, but that will allow the enemies to ready their defenses or get reinforcements.  So speed and smart stamina management is encouraged.  Although, there will be some level of variety in approach, the player could have a more heavily armored team that slogs through tougher fights, or a lightly armored quick characters for a fast team that relies more on the element of surprise. 
      Weapon and armor choices for each character will be significant strategic decisions, based on battle formation and also the strengths and weaknesses of the party comp/individual characters.
      The exact setting is not yet decided, it could be realistic medieval, high fantasy medieval with demihumans and magical creatures and some level of magic, steampunk, etc..  The "raiders" could be seafaring viking types, fighting in a religious conflict like crusaders, or some of both.
      Thanks for reading, and lmk if you are interested or have any questions.
    • By Spronx
      Hi guys,
      I'm Andy from StriX Interactive and we are
      LOOKING FOR A LEVEL DESIGNER
      to join us on this incredible adventure of developing Blood Oath. Open world fantasy 3rd person RPG in the style of The Witcher.
      We plan to launch a Kickstarter campaign by the end of the year. So it's not a paid job yet.
      We need someone capable of making terrain according to the world map that we have and over all level design. We have a great team and want YOU to be a part of it.
      Contact us on our facebook page https://www.facebook.com/StriXInteractive/

    • By Java Nigga
      Hi there!
      We are JN Studios, we are looking for people to work with us in our project.
      About US:
      JN Studios is a 2 people amateur studio. we have like 1 year making games, but this is our first professional project to show it to the public. We are a programmer guy(Me) and a 3d modeller.
      About the game:
      Strategist Sniper is a RPG/FPS game, yes RPG and fps :v you awake in the middle of the unknown and a small voice tells you that you have to go through the world killing other snipers to get out of there. the mechanics of the game are based on the basic controls of games like League of Legends and in FPS games like Counter Strike.
      What we are looking for?
      actually we are looking for another c# programmer, a musician and an artist(for game illustrations for the marketing of the game).
      Profits Share:
      when the game is in a stable alpha phase we will create a campaign in Idiegogo to obtain money to finance the game. each of the project participants will receive a percentage depending on the work done.
      How to apply?
      just send us a email with a portfolio and in what you can help our team -       trabajojava1@gmail.com


      Devblog1.mp4
    • By cursetalegame
      Hello! I am building the main scene in Unity for a 3D cards game. My goal is creating "card slots" to place the different cards from a deck and use it as "buttons". The image below represents somehow what I want to develop. I have been reading and I think that I have to generate a canvas and place in my scene the slots where I want to place the cards, but I am not sure about it. Also, to use the cards, I don't know if setting buttons is the best option (maybe I should use images instead).
      All recommendations and tips are welcome

    • By cursetalegame
      Hi! We are looking for a unity 3D developer to join our small "beginners" team. We are 3 artists (illustration, concept and 3D modeling), 2 designers and 1 programmer (me). We are developing an online video game that we have already designed. Our goal is to create a small studio and build up this game to take it to video game events around Europe and try to find publishers. Also we want to learn step by step how to develop games, so, is better if you don't have a huge experience in developing
      For more information, or any question, you can send us an email to cursetalegame@gmail.com 
      Cheers
  • Popular Now