How to persist game data such as score table, player names in Cocos Creator 3.x? - cocos2d-x

What is the recommended technique to persist simple game data such as score table, player names, user preferences, etc?
Is there a technique working across all platforms native+web?
I've found some references to LocalStorage but this seem to be available only for native:
https://github.com/cocos/cocos-engine/blob/6a29cb9fdb558a4ef99fe8aa7de47448527b0d7a/native/cocos/storage/local-storage/LocalStorage.cpp
If nothing is supported by Creator, do you think that searching for Sqlite for web is the right direction? If Sqlite is available for both native and web then this could be the solution for all platforms.

Related

Multimouse functionality in AS3

I am basically looking for a way to use multiple mouse plugged into one device so that multiple pointers can be seen and operate. This is for e-learning purposes, the goal is to have multiple students play an educational game in a classroom that has only got one PC but upto 10 or more mouse connected to a PC.
I did something similar a couple years ago in microsoft XNA framework. Currently I am developing applications and games in Adobe Flash AS3 and would like to find out if there is anyway that we can have multiple mouse functionality in a flash application?
Any sort of help would be great. Thank you!
For the web, this is probably impossible. If your flash project run on Adobe Air, you can add native code to handle this kind of functionality or you can use a local socket server to send information over socket to your swf or air application.
Example for native extension

MySQL+PHP+Flash+as3 How to save into a mySql data from a Flash AS3 2d RPG game in OFFLINE programming.?

It's my first time to ask online about my programming problem and I hope I can get feed backs as soon as possible. Me and my partner are working on a project of doing a 2D RPG game using FLASH CS5.5, AS3, PHP(Dreamweaver cs5.5) and Mysql(xampp). I would like to know if there's any way that wwe can create the game and connect it to mysql where we can save and retrieve data after a game is played and save it in the players status so that when the player plays again, he can have the last status of his game to continue. We want it to be an OFFLINE game and anywhere i search in the net, all of the tips are for online games. PLease help us. Thank you.
Assuming the game is mostly written in ActionScript 3
In order to save data on the an SQL server you need to pass the data from AS3 to PHP and insert it into the server.
To do this, you will need to become familiar with AS3's JSON library. There are numerous ways to do this, including the popular as3codelib, but the JSON library is built in and is much simpler than it first appears.
I would explain it all, but this tutorial will get you familiar with it.
P.S: Like others have said, you will want to test this locally so make sure you know how to perform basic SQL queries and run PHP scripts using XAMPP. If you do not, this should help
If you only want this to run locally (i.e. a user has their own set of data), why don't you just use a SharedObject?
This lets you save data to the users machine very easily and much more efficiently.

Migrate from Flash AS3 to AIR

I've been developing a project in AS3 but decided to switch to AIR instead, as I found out it's impossible to save files on user's hard drive without prompt appearing. My question is, what changes do I have to expect? is the code written in same AS3 syntax/style? Did instantiating objects / drawing shapes / positioning system / stage change in AIR? thanks.
Everything is the same from a code perspective, except that the AIR SDK includes quite a number of new APIs that are less restrictive and geared toward application development since the deployment target is no longer a web browser.
If you can, you should take a day or 2 and read thru the documentation so you will know what's available to you. Make sure to select the most recent versions of AIR and Flash Player under Packages and Class Filters: Runtimes so the docs are populated with what you need.

What to Use for PhoneGap Database Storage

I am writing an application using PhoneGap, and am finding it hard to work out how to store my data in a database. For the minute I just want to keep an open mind as I will be recommending technology options to our company.
The PhoneGap API for storage is here,
http://docs.phonegap.com/en/1.3.0/phonegap_storage_storage.md.html#Storage
It is based on this HTML5 spec,
http://www.w3.org/TR/webdatabase/
The problem for me is that the specification for this is not being maintained any more, and the standard has been deprecated.
The other problem is that I implemented a database using web database, and the versioning didn't work properly.
What is PhoneGaps stance on this and will PhoneGap look at other technologies such as the Indexed Database API,
http://www.w3.org/TR/IndexedDB/#database-concept
I am storing JSON data in the localStorage for now which is working great, but I am wondering if my database could get too big and it might not be the best option.
I faced the similar issue while developing an application few months back in which we were expecting to port the application to different platforms (with different versions). So instead of using the core storage mechanism which phonegap offers we went on using a dedicated storage framework which can provide consistent api but uses the best underlying storage mechanism.
There are variety of JS frameworks which can help you use the underlying storage. The following are few might interest you if you are planning to use the app on different platforms.
PersistenceJS - persistencejs.org
lawnchair - http://westcoastlogic.com/lawnchair/
persistencejs uses gears and localstorage in combination which helps to run the app on BlackBerry 5.x devices as well without any change.
I went on using the persistencejs and it have really worked well till now. We have ported the application on Android, iPhone, iPad, BlackBerry (5.x and greater)

questions about game development from web developper's point of view

i've been making web app's and working with various server side language like php, ruby, perl for a while now. I've always been curious about game development, it's actually what I set out to do but I ended up in web development. I am trying to transition in to GD, but I cannot help see games from a web development POV.
GD = Game Development
WD = Web Development
Technical Questions.
How do you design UI in games? in WD you have CSS, and need minimal graphics to create a quick menu. are there similar tools or concepts in GD ?
How do you deal with storing data ? Do you use flat text files? Or is there something like MySQL or sqlite that you use to store information about objects, users, and etc ?
What game engines is commonly used ? Are there any that use scripting languages ? I only know VB and basic understanding of C.
With the proliferation of Iphone and Android, is J2ME being phased out for mobile phones ?
open 3D web is coming. What is your thoughts on having 3d applications running natively from your browser ?
What tools make it easy for creating 3D objects, levels, game environment, and animating characters and so on ?
Where can I find out more about how server/client, client/client, and MMORPG networking works ?
Where can I get or find generic or commonly used game flows ? for multiplayer ?
How do you deal with physics? Is there freely available algorithm or library that you can use ?
How are real time cutscenes made in games ?
Market Questions.
Which market should you enter? Mobile, iphone, wii, PSP, DS, android , ps3, PC etc.
Shouldn't you always enter mobile market, as it is easy to make small games on your own yet sell a lot ? Are there any resources where i can find more about each markets ?
What is your thought on Steam content distribution ? Is it the distribution model of the future ? Whats wrong with the traditional publisher/distributor model ? How does the traditional model work exactly ?
How big is the web games market? ex) Flash games.
How is game development different from any other software development or web development ?
I have a lot more....but those are the ones that I have been thinking about lately.
Thank you very much for reading !
UI Development
Depends on the game- is it animated, or a board-style game? Generally, UI assets are created as images, sprites, or storyboards.
Data
Again, depends on the game type. Realtime games need FAST access, so you want to store your data in a local database and cache it as much as possible. Local file-based databases tend to be the norm, either custom or off-the-shelf, such as SQLLite.
Engines
There are tons of engines out there for 3D, board, etc. Popcap has made their C++ game engine open source. Others include Unity, Ogre3D...
J2ME
I wouldn't target this platform for games.
Don't know much about "Open 3D Web" but it sounds very browser-dependent, so mileage may vary across browsers.
You can play with 3D with Google Sketchup and Caligari Truespace. Truespace was bought by Microsoft and made free.
Again, tons of engines out there for networking. Example: Microsoft's XNA framework has some networking bits you can leverage.
Not sure what you mean there.
There are physics engines built into some of the gaming engines I've mentioned, and external ones you can use.
Once upon a time, realtime custscenes were pre-rendered with 3D Studio Max or Maya. These days in-game rendering is often good enough for cutscenes: look at the latest Halo 3:ODST game. All cutscenes use the in-game engine.
Market
I looked into game development earlier this year. Casual games look to me like a growth industry- high volume, relatively low development cost. Big Fish Games for the PC is a good example there- they publish a few titles and resell most.
I think mobile game development is a huge potential market but the barriers to entry are high because it will be a crowded space. iPhone games are the 800lb gorilla but Android is coming up. PSP and others have a limited audience and are notoriously difficult.
The most important thing I learned in my research is that game development is a labor of love. It's hugely multi-disciplinary: you need programming, art, concept, production. It's more like making a movie than anything else. It's also rough to make a profit because of all that overhead. If you want to get into it, I recommend joining a game developer to learn the business. Once you have experience you can carry it forward to larger gigs at larger publishers. Eventually you can get to work on a major AAA title, after which you can really write your own ticket.
I'll stick to answering the technical questions:
1 - UIs are usually completely bespoke, with nothing resembling a standard in the same way that HTML/CSS is a web development standard. Some people use ScaleForm which is based on Flash but that is by no means common.
2 - Data is often stored in flat files - rarely text, more commonly binary. Again, these are almost always completely bespoke formats. Sometimes they are aggregated into archive files which use the zip format or something similar however. Occasionally, some programs might use sqlite, and online games often use SQL databases.
3 -There are many game engines used, although the definition of 'common' is vague. There are well-known ones like the Unreal or Source engines, down to lesser known ones like Panda3D or Torque. Some of these are heavily focused on 3D and leave much of the rest of the functionality to other packages (or the game developer themselves). Most are able to be used with scripting languages, or come with one built-in. (eg. UnrealScript).
4 - J2ME - couldn't say, that's not the sector I work in.
5 - 3D web will be interesting when it's ready, but cutting edge games currently require gigabytes of client-side data. Running the application in the browser doesn't get around that download, so it's not a great benefit. Nor is it likely to be as high performing as a dedicated 3D game renderer for quite some time. So while it opens many doors, it doesn't significantly change the state of play for gaming just yet.
6 - 3D art assets are usually made with 3D Studio Max or Maya, although there are several other related tools.
7 - MMORPG networking firstly requires understanding of basic networking (ie. strip away all the HTTP fluff and get right down to the socket level). Start with Beej, work up. From there, you're best off reading talks given at conferences and reading the Massively Multiplayer Game Development books, coupling that with anything you can find on traditional game networking. 2 good starting points are the Source Multiplayer Networking docs, and Gaffer's Networking for Games Programmers. Don't expect to understand everything the first time you read it, either. And bear in mind this is a field with ongoing research and the problems are far from solved yet. And that it's also a field where "if you have to ask, you can't do it yet". Emphasis on yet.
8 - I don't know what you mean by game flow - it's not a term I've heard used before.
9 - There are several physics libraries available, including Havok, ODE, Bullet, PhysX, Box2D, etc. Some are free, some are not. You can also write your own physics for simple games, as it's not all that hard, and indeed that is what everybody did until relatively recently.
10 - Real time cutscenes are typically either pre-animated in something like 3D Studio Max, or scripted to run within the game engine.
It depends very much on the platform you are developing for. some game engines, or platforms, have built in platform specific means of creating UI systems. An example is developing for the 360 where there is a proprietary UI system provided with the SDK tools.
However, systems like these tie you to a particular platform and this can be undesirable.
Another alternative is cross platform libraries like Scaleform, which provide game-side libraries for displaying UI elements, and a common way of editing and creating UI systems across different platforms.
The complexity of UIs in videogames varies wildly. Look at something like Peggle, compared to something like Codemaster's Dirt or EA's Dead Space. Each system is therefore implemented differently.
Some use 3D packages and the standard game engine to animate and render UIs. Others implement Flash. Others roll their own custom solutions. There's no easy choice or a standard like CSS I'm afraid!
Hope this helps,
-Tom