Advanced C2 - Building a Online Browser Game With C2

Get help using Construct 2

Post » Fri Mar 06, 2015 6:52 am

*Moderators - this is a How to thread but is ever evolving like a presentation thread. If you feel it is more appropriate elsewhere on this site feel free to move it.

>>My Current Issue<< Starts on page 3

Hello all its been a minute but let's get back into this. I have found a solution to how I want to handle the players unlocked items. Instead of a very large CSV file that I am pulling from my server. Which is both slow and expensive. I simply have a JSON of a C2 Dictionary that list which items are locked vs unlocked. I then after loading the dictionary use it to change a master CSV that I pull from the project folder that has everything locked as default. Seeing as right now my one faction has 125 characters one can choose from plus each having unique stats and abilities this I found is a great solution.

Now the thing tripping me up at the moment is more basic to C2. In my menu I have six instances of my officers I can choose from. Also instances of text items for their name, various stats and abilities. This is something that I have always had a time of wrapping in my head. How does one translate how one object functions by using a different object?

I have a "For each Row in Column" Loop with the Compaire Two Items "CSVOfficer.At("Unlocked",CSVOfficer.CurRow). I also have a Pick instance just selecting instance 0 of one of my six sprites that show the portrait of the officer in question. I then want to change the frame of that sprite to equal the row (which is indexed numerically) of my CSV.

That works all well and good but now I am attempting to do the second sprite (the other five as well) Where it is the same only i Pick instance 1 of my sprite. But without knowing how to increment to the next option those five sprites end up being the same as Sprite number 0.

I've tried adding the sprites IID number to the option when setting the frame but that will not work since it is possible for the next row to be false so if they were on row 3 and I add one it then would display row 4 but if row 4 was false then that is not right.

And that is not even taking into account flipping through pages of all the officers.

CrazyVulcan

>>The Goal<<
This is going to be a continuously updated thread as I have decided against making a number of different but related threads. I will do my best to keep this post Up to date on the current issue I am focusing on.

My game is meant to bring the table top miniature war game to the easy access of the Internet. It is a Space Navy war game of my own original design meant to be played with two players using small to large scale fleets. Using a cost system I will hope to balance out players who bring powerful ships worth lots of points to any player who dose not have the rare or other wise expensive ships/officers/equipment

The game will be free to play with a cash shop monitization system where players can chose to buy in game currency with cash. This currency will of course be grindable by players who chose to not pay for their items. Things you could buy are things like new ships, special crew, access to new factions, and other things that while game effecting. Will be assigned a apropate number of points to balance them. Players win currency for playing online match's and a auction house that will allow players to sell their won items for their value in currency.

Players can gain new items for completing missions (more later) and winning games at random. These packs will be random and will need a key from the shop to open and unopened packs can be sold to earn currency faster. These packs will not be hard to come by so selling them is a viable option. Simply the more you play the more currency you get and buying currency for real money is simply a way to get what you want faster.

The business aside the game will be a large undertaking and I intend to see that a alpha will be done within the end of the year. This game will take place on its own web site and I am learning to code HTML, CSS, PHP, and MySQL as fast as I have time to learn. Its frustrating at times and often I have run into problems that while I could ask for help I had determinedly stuck to my own ability. But I came around to not only wanting help but to share what I am working on as I really am trying to push C2 to its limit.

Oh and for those that do not like to play online I intend to once I have the alpha done and move into beta I will make a single player campaign that you can play solo and even make your own ship and officers. that will then be available to use in online match's.

And once all these "small" tasks are done I will be launching a physical version that will allow you to play with your friends in your own home. Hopefully will get the ball rolling on that by next summer.

ps yes....yes I am crazy but it is what makes me so charming ;)
Last edited by CrazyVulcan on Wed Sep 16, 2015 6:25 pm, edited 18 times in total.
"Were all mad here. I'm mad, your mad." "How do you know I'm mad?" Asked Alice. "You must be" Said the Cheshire Cat. "Or you wouldn't have come here"-Lewis Carroll: Adventures In Wonderland
B
6
S
2
Posts: 113
Reputation: 1,220

Post » Fri Mar 06, 2015 7:08 am

Good luck! Its going to be tough especially the time it'll take for one person.

I am working on a similar project, The website for my game is http://keo.land/ and a video at https://www.youtube.com/watch?v=nSAqOm9URm0 .

I've tested passing data into the C2 game from the website as well as website data into C2. I purchased an icon pack and drew 800+ images to equip onto the avatar. The player's equipped items are in the database and the items on the inventory can be equipped. The "Explore" page shows a map that is map in C2.

I've been working on this on and off casually for about 4 months and at this rate, its still going to be miles away!
B
32
S
6
G
2
Posts: 317
Reputation: 2,801

Post » Fri Mar 06, 2015 7:15 am

Here is another similar topic.
B
105
S
25
G
217
Posts: 4,297
Reputation: 124,148

Post » Fri Mar 06, 2015 7:57 am

IndieKiwi wrote:Good luck! Its going to be tough especially the time it'll take for one person.

I am working on a similar project, The website for my game is http://keo.land/ and a video at https://www.youtube.com/watch?v=nSAqOm9URm0 .

I've tested passing data into the C2 game from the website as well as website data into C2. I purchased an icon pack and drew 800+ images to equip onto the avatar. The player's equipped items are in the database and the items on the inventory can be equipped. The "Explore" page shows a map that is map in C2.

I've been working on this on and off casually for about 4 months and at this rate, its still going to be miles away!


Looks great, This is very much what I am trying to accomplish. Think of each ship as a character with officers being equipped to it, and equipment equipped to it. And each officer is a character with Ability's, so its a group of characters grouped to another character, which is one of many characters you control. :? Its simpler than I am making it out to be but my game is a character Turduckin.

Do you mind going into a little more detail on how you passed data into C2. Like For that Dragon Sword. What file type did you use and what were some difficulty's you came across.

@rexrainbow , I owe a big thanks to you as your CSV plugin has carried me this far. If I had a way to edit those CSV docs on the fly I would be in great shape but now I am ready to move on to more advanced means of data storage. Thank you for all the work you do here
"Were all mad here. I'm mad, your mad." "How do you know I'm mad?" Asked Alice. "You must be" Said the Cheshire Cat. "Or you wouldn't have come here"-Lewis Carroll: Adventures In Wonderland
B
6
S
2
Posts: 113
Reputation: 1,220

Post » Fri Mar 06, 2015 8:07 am

CSV plugin 's "Action:Set entry" could change the value in event sheet.
B
105
S
25
G
217
Posts: 4,297
Reputation: 124,148

Post » Fri Mar 06, 2015 8:40 am

This thread has some awesome links and info! thanks rex!

Do you mind going into a little more detail on how you passed data into C2. Like For that Dragon Sword. What file type did you use and what were some difficulty's you came across.


Right now it is only loaded into the C2 project with url parameters like?a=b&c=d. So it is a one time thing when loading the iframe url, if i can pass a userkey into the C2 file, then it should be enough to communicate from C2 to the server with the user's identity. Rex's plugin looks like it will work better than this method!

The dragon sword isn't shown through C2, its just html+javascript+php, i changed the item system from database to json and back to database. Ultimately to do it properly, i guess a database would be the correct solution.

My difficulty is the lack of planning. I just had the ideas in my head so i keep on changing stuff! I should really create a plan like you have
B
32
S
6
G
2
Posts: 317
Reputation: 2,801

Post » Mon Mar 09, 2015 11:47 pm

I need to move my first question to here so my first post would be just my game synopsis and the current question. The Op will have links to each subsequent question.

03/06/2015 UPDATE[03/25]

Thanks to Rex I have managed to use the CSVplugin with AJAX to upload a debug CSV with 10 people on it with their stats. I feel comfortable using the plug in to pull data and push updates back to that file. Problem is that it is stored with my website. And I still do not know how to make a system of user accounts who each have a copy's of master CSVsheets and be able to change them though their unique gameplay.

I know I am on the right track with this but I must admit I am intimidated about MySQL. Currently I am using a simple note editor and bitballoon. I have on the top level all my web pages for my site with a sub folder for things like images and data, and another folder containing my latest version of my game. But where do I put all the users files? In a sub folder which each user having a folder of their own? I know that is wrong and way too big to work with hundreds of users.

I am looking at firebase but I cant get files to upload (see below question). And I will not build it by hand when my whole goal is to automate it as much as I can.

as always thank you all for your help.
Last edited by CrazyVulcan on Wed Mar 25, 2015 4:35 am, edited 1 time in total.
"Were all mad here. I'm mad, your mad." "How do you know I'm mad?" Asked Alice. "You must be" Said the Cheshire Cat. "Or you wouldn't have come here"-Lewis Carroll: Adventures In Wonderland
B
6
S
2
Posts: 113
Reputation: 1,220

Post » Wed Mar 25, 2015 2:17 am

Edit b: Solved! the JSON of a CSV should look like
Code: Select all
,Skill01,Skill02
Bob,AA,AB
Ted,BA,BB
Mike,CA,CB

Needs to be

{"table":{"Skill01":{"Bob":"AA","Ted":"BA","Mike":"CA"},"Skill02":{"Bob":"AB","Ted":"BB","Mike":"CB"}}}


Edit a: I seem to be trying to put a JSON into Rex's CSV plugin which of course will not work. But I still have questions on how JSON should be formatted into C2

JSON, after what seems like weeks of pondering and reading JSON's finally clicked and now I am able to wright them in theory. I however like many things seem to be running into a problem with syntax. I have a JSON file that I am loading into the CSVplugin Provided by Rex and I am running into issues with C2 reading the JSON. C2 wants a string containing the JSON but I have yet to figure on how it wants it.

I have a JSON example of
CODE: SELECT ALL
"Men":[
{"Name":"Bob","Skill01":"AA",Skill02":"AB"},
{Name":"Ted","Skill01":"BA",Skill02":"BB"},
{Name":"Mike","Skill01":"CA",Skill02":"CB"},
]


From my understanding this is a properly formatted JSON, but loading it raw into C2 gives me a number of errors mostly due to the double quotes ". After searching the forum and tutorials I am amazed that I can not find something that says simply "This is how a JSON should look when loading into C2". So either I needed to look for more than a hour or two. Or its such a simple thing that everyone knows it.
---
Given my difficulty with loading it into firebase it has to be something wrong with my writing of the .json My thinking is that I should be able to have all my data in my website folder under their own subfolder. But they should be loading using the import button but alas it keeps saying my file is not validated
---
Ignoring firebase for the time being I am simply trying to AJAX a JSON from the project folder then loading that string into the CSV table using the "Set from JSON" feature. I how ever keep getting javascript crashes once it loads because the JSON is not properly formatted for use in C2. So what should the above JSON look like if placed into any given C2 feature.

"{"Name0":"Key0","Name1":"Key1","Name2":"Key2"}"
?

If i drop the " from the start and end it will not go though saying { is invalid. so confused :?
"Were all mad here. I'm mad, your mad." "How do you know I'm mad?" Asked Alice. "You must be" Said the Cheshire Cat. "Or you wouldn't have come here"-Lewis Carroll: Adventures In Wonderland
B
6
S
2
Posts: 113
Reputation: 1,220

Post » Sun Apr 19, 2015 4:40 pm

Working with Database along side C2

I have migrated my site from Notepad++ to the more versatile WebMatrix3. Along with this comes with the feature that I am greatly needing and that is a database. I have made a table and have a good understanding on how to pars and edit it though my website. But getting it to work with C2 and in particular AJAX is giving me some trouble.

Although it is a pain to export and upload to a 3rd party web hosting site like Bitbaloon I have been able to call a .txt file with a CSV in it and post back changes to my website with not too much difficulty. But I do not know how I can access this new table inside my website from within C2. I can seem to access the file using a MySQL query form with in the HTML page for the website but I do not see how I can do such a search in C2.

And while on the topic of editing database tables can anyone tell me how I can make a user profile that when created makes a new entry of the table and creates a copy of the master tabel that they can then edit with their own unique player data? @rexrainbow is there a way to use your firebase plugin without using the firebase site? If not do you have or know of a plugin that will allow C2 to make MySQL calls?

I would like to just be able to use in C2
AJAX get form URL> "../"&varusername&"mydata.txt" then load that JSON into my CSV?

In this way each player when the make a account on my site in that first form they will choose a username and when registration is complete it makes a copy of my mastertable object and renames it to [playername]mastertable. I can then pass that into C2 AJAX calls.

I am getting by right now just having AJAX call project files that have my CSV.txt files and am able to work on other parts of my game but I need to get this nailed down before I go too far into it as really this game is a website that happens to have a HTML5 game built in.

Thanks for all the help.

-CrazyVulcan
Last edited by CrazyVulcan on Sun Apr 19, 2015 4:44 pm, edited 1 time in total.
"Were all mad here. I'm mad, your mad." "How do you know I'm mad?" Asked Alice. "You must be" Said the Cheshire Cat. "Or you wouldn't have come here"-Lewis Carroll: Adventures In Wonderland
B
6
S
2
Posts: 113
Reputation: 1,220

Post » Sun Apr 19, 2015 4:42 pm

@CrazyVulcan

My firebase plugins only could work on firebase service.
There are some services like parse which supports datebase-in-service.
B
105
S
25
G
217
Posts: 4,297
Reputation: 124,148

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests