Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6950115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:03:12+00:00 2026-05-27T14:03:12+00:00

I am implementing browser turn-based game, using javascript and asp.net MVC, probably going to

  • 0

I am implementing browser turn-based game, using javascript and asp.net MVC, probably going to use html5 at the future.

I have some issues regarding it, since I am pretty new to asp.net MVC and javascript:

  1. I don’t know how can I interact between javascript and MVC,
    which means how can I make a GUI that doesn’t reload the page but send the information given to a function/action at the server that uses it and update the GUI accordingly.

    for example: clicking on a button will call a server-side function that will update some fields at the website without reloading the page.

    naturally, I want to make the javascript responsible for the GUI only,
    and all the calculations will be on the server side, and it seems that:

    • Click on something

    • Send information to sever-side function

    • Calculate and update GUI

  2. I have lot of data need to be saved for each player during the fight
    and I wonder whats the best place to save this data.

    I will probably have a Battle object containing the data, that will both access the database and update the gui using javascript.

  3. Since its a turned-base game, I will have to implement a system that will sync between the players. The best way i think to do that is to create a timer on each client,
    that every 2 seconds will take information from the database and update the GUI accordingly if something has changed (for example, the other player done his move with X type of move dealt X damage). Do you have a better solution for this?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:03:12+00:00Added an answer on May 27, 2026 at 2:03 pm

    Yes, you need Ajax and possibly some JavaScript libraries to assist in your single page app. You might start your prototyping by using jQuery to get used to the Ajax approach:

    <script type="text/javascript">
        $(function() {
            $('#battleHitButton').click(function(e) {
                $.ajax({
                    type: 'POST',
                    url: 'Battle/Hit',
                    data: { 'opponent': 'someName', 'bonus': 42 },
                    success: function(data) {
                        $('#result').html(data);
                        // do some other stuff after hit
                    }
                });
            });
        });
    </script>
    

    And your MVC application on the back-end would need an action in a controller to support the /Battle/Hit URL

    public class BattleController : Controller
    {
        [HttpPost]
        public ActionResult Hit(BattleModel model)
        {
            string whoToHit = model.opponent;
            int bonusDamage = model.bonus;
            // do battle, persist to database, etc
        }
    }
    

    This is, by no means, a complete solution. However, it should get you started thinking in terms of MVC and JavaScript/jQuery. Once you get the hang of it, I’d highly recommend exploring some alternates to jQuery if your application gets more complex. jQuery.ajax can quickly turn into spaghetti code!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am implementing a browser based game with a small group of friends using
I am implementing Javascript Validation on an ASP.Net page that is inside a Master
So I am working on implementing an html5 based game into an android app
HI, I started implementing a HTML Browser in Swing. I want to use the
I'm implementing some asp.net application in .NET Framework 1.1. Within that application I want
I work on a hexagon map based browser game. I have this: http://www.dark-project.cz/wesnoth/map-view/1 and
Most smartphones use modern browser engines that have implementing HTML 5 (or at least
I am implementing an in-app browser using UIWebView, that shows an 'action' button up-top
I am implementing a tree browser in HTML. On clicking a node, I call
implementing publishActivity in PHP using the REST API using this code: $activity = array(

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.