2020-06-23 05:22:02

ok, hi.
so, I wanna make a rpg with html.
I need a java skript to play sounds.
can anyone direct me?
also, should I even use html? should I try html5 or php?
thanks.

I am a divine being. I can be called a primordial deity, but that might be pushing it, a smidge. I am the only one of my kind to have ten tails, with others having nine. I don't mean to sound arrogant, but I have ascended my own race.

2020-06-23 05:59:46

I don't have good or quick tutorials.  But to answer the really easy ones quickly:

HTML5 is HTML.  The 5 is a version number, but people talk about it differently because it added lots of things that are useful like audio and video elements that don't need flash.

You need javaScript for WebAudio.  PHP won't help you if you want this to be anything more than text with links.

Chrisnorman7 had luck with Dart and Flutter.  I haven't used Dart and Flutter for lack of need, but they're good tech backed by smart people, and designed to be relatively easy for newbies, and it looks a lot like BGT in terms of the language syntax.

But in general you will need HTML, JS/something-that-compiles-to-JS (Dart for instance), and a backend language if you want to save progress.

The web isn't easier, to put this another way.

My Blog
Twitter: @ajhicks1992

2020-06-23 07:25:00

for backend language, I recommend python (maybe because I'm more comfortable with or in terms of rapid development), although many of web hosts offer php out of the box, and the reason is wordpress.

2020-06-23 11:24:32

just a small note. you can use Web Storage and Indexed DB to store things locally on the browser without needing to use a backend, but your browser might evict the data eventually if either storage system gets full and the data for your game happens to be chosen by the browser's eviction algorithm.

A way you can protect against this loss is to give the user option to download a save game as a file, which they can use to restore a game.

But, to provide automatic game saving and reliability that the save game won't be lost you will need a back end.

you shouldn't really need anything very complex though. for python, flask is quick to get started with.

2020-06-23 14:19:20

the thing is that local data can be tampered easily.

2020-06-23 14:43:10

@4
I'd actually point people at Django if they're newbies.  Flask has its place but you get a lot more out of Django for free that's valuable for this kind of thing, and as many tutorials as you could want for using it.  That and sqlalchemy is kind of a brick to the brain, and you don't really have that many other good options.

But in all honesty, for someone completely new, Dart and Flutter works on the backend and the frontend, and to my surprise it's accessible enough that we now have one audiogame written in it, so in hindsight I probably should have just pointed them at that flat out.  Can do everything in just one programming language, instead of 3 or 4.

My heuristic for this at a non-newbie level is "Do I want the Django admin" combined with "do I want DRF".  And usually you do want the Django admin, because you can't beat free accessible dashboards.  And if you know DRF you can get everything you've ever wanted in a rest API by installing it and switching settings on.  I have literally written a Rest API for 20 or so entities in 3 hours with this stack, and if that hadn't been the craziest job interview ever, I'd have put in another hour and had non-programmer-friendly backend dashboards.  But unfortunately the learning curve on DRF is insane, more like a learning cliff.  Nonetheless it's hard to justify Flask beyond tiny one-file microservices, because you end up reinventing or hunting for lots of wheels eventually, and so the trade-off is ease of learning versus ease of literally everything after you've learned it once.  Except that while you can learn Flask in an hour or two, you then have to find and learn all the supporting libraries for the things it intentionally doesn't offer.

My Blog
Twitter: @ajhicks1992

2020-06-23 16:53:41

Thanks

I am a divine being. I can be called a primordial deity, but that might be pushing it, a smidge. I am the only one of my kind to have ten tails, with others having nine. I don't mean to sound arrogant, but I have ascended my own race.

2020-06-23 20:43:22

@5 not sure what you mean by that. if you mean that another web app can overwrite the same names. then use namespacing. If you mean a player can cheat and give themselves more gold or exp then for a singleplayer game who cares? also in regards to cheating, that is pretty much always a possibility with web games much more with other games. you can make it much harder by using obfuscation, but again does it really matter if someone cheats at a single player game?

@6 you know now that I think about it, I think you're absolutely right. reason why I tend to reach for flask is since if I just want to do a very simple web service very quickly then it gets the job done faster than anything, but the thing that kind of kills it for me is that a lot of the extra stuff just isnt that high quality in comparisn to the core. django has it all and it is all of a really good quality. the setup is certainly a lot longer, but in the long run especially if you need a good ORM for working with databases, use authentication, and web page templating, then you get it all in django and it is quite good.

2020-06-23 22:19:17

@8 consider a game that your stuff can affect others.
for example a game like politicsandwar or so.

2020-06-23 22:50:36

@8
If you learn DRF (which, like I said, learning cliff), it's as fast as Flask.  Especially if you keep a template project around to start from.  The real problem with Django isn't that it's less productive than Flask, it's just that there's a lot of parts you need to know before it's as productive as flask, but then once you do it goes further by a lot, and the upper end of what you can do while being incredibly rapidly productive is a much higher ceiling than what you can pull off with Flask.

Of all the programming languages I have used or even know of, the only thing that seriously competes with Django for what django tries to do is Rails.  You can't beat vertical integration and being opinionated in this arena.

My Blog
Twitter: @ajhicks1992

2020-06-24 08:43:59

I'll try not to repeat what others already said, but just a short intro:
If you are intent to create a game that needs a lot of data to be stored for later / longer usage, you definitely need some database. Yes, you can pick whatever you want for a small project - sqlite, mysql, mongo or whatever, but if you will use back-end language that works on the server side, you get the possibility to do it safer and more reliable than saving the data directly using browser's functionality and it's judgement.
I don't know a lot about RPG games, but lets imagine that I do and try to put things together to help you decide what do you actually need:
I remember myself when I was 14 years old and one of the most popular games that come to my head is Travian. I don't know if you know this game, but there you need to build your empire from scratch by building various buildings in order to get resources, then on different conditions you can create different warriours, attacking other players and grab theri resources, chatting with them, seeing atack progress, getting messages after successfull / non-successfull attack and see your progress. Your cities or towns (I don't remember well) can be expanded by building each town in some different place by using coordinates (for example 1;1, 2;1, 7;3 and so on) so therefore is a map to help players to choose which one to pick as a pray and determine the distance between your town to the target to see how long your warriours should walk to reach it.
OK, enough storry part, lets focus on the things we with my old friend did to achieve at least something quite simmlar to my description and what happened:
We definitely need somehow to create front-end to display all the game's content, so we use HTML for that of-course. Since style was important too, we used css (I don't remember if css3 was invented yet) big_smile OK, we picked javascript too for displaying warnings when user enters wrong data in the form field or does something non-desirable and also to warn the player about attacks. These days you can use js to play sounds, use frameworks to create flashing messages, even force screen reader (with aria) to tell various messages and so on...
We need to track user's progress, because it is multiplayer game, so we picked mysql as our database, it's widely used even today. So we created tables for user acount, for towns, messages, alliances, attack_progress, warriours, buildings and began to put things together...
Since we wern't fammiliour with anything but php, we picked that as our main programming tool and connected to the database that way. So we could store the progress player has and even all the progress could be sent to the offline player via it's email address in order to reach user when the danger is coming. Since PHP is almost on every online web host service even today, you can definitely pick it up and work with it. Please realise that I don't say that it is the best or even a wise choice, it's just one of many ways to achieve the result and python or some other languages can help you do just that. Anyway, when you start to build a building, you put the record to the table and reference it to the user by it's unique ID and that way we can use front-end to show user the building progress, how many seconds left untill it's done, what benefit he/she will get after it's complete...
As a programming paradigm, you totally should pick object-orriented style. I remember we didn't know that stuff yet so we wrote everything procedural way and believe me, that's not a good choice and when I really think about it, I don't understand how we did that game at all big_smile PHP isn't that good as Python or some C languages in object-orriented style, but it does have the most important features either so there is no reason to run from that if you decide to pick it up. Since I write PHP professionally these days, so I know what I'm talking about here.
These technologies are totally fine if you will create game like this, however...
Lets pick another type of game in order to get most of it:
Imagine you will create a card game. I know that we talk about RPG's here, but logic and interaction is the same so why not to choose what I like more that RPG to describe things you will face. If for instance you will make a game like UNO, where few players can sit around the table and play together. They do interact and you need to know when (in almost real-time) other put the card on the battle field / arena. In a game like this, you need more things to deal with:
Perhaps you will pick web sockets, which is still considered as a new technology so implementation on the server side might be harder than usual. Another way is to use ajax and json to transfer information between server and client (your web browser is considered client here), so ajax can make XMLHTTPRequest and send an information via post or get (via url) to the server and request the information back from it (encoded in json for example), which javascript can decode to the object straight away. This way you can pool information from server each 3 seconds (or more freequently) to check if state of the game is changed and if it did, you just parse that json to update user with the newest information on the gaming board. You can keep your cards in database and link everything with foreign keys, thats is all for you to start big_smile
Don't forget that in web is harder to protect from various cheeting methods, because js on the client side is accessible to the person for an injection, but for a simple game it isn't so important as it seems.