Chunky by FelipeFS
Chunky by FelipeFS
GPWiki.org
It is currently Thu Oct 30, 2014 6:09 pm

All times are UTC




Post new topic Reply to topic  [ 14 posts ] 
Author Message
 Post subject: Texty
PostPosted: Tue Jan 14, 2014 1:19 am 
Digerati

Joined: Thu Sep 09, 2004 1:17 pm
Posts: 1816
Location: burrowed
I never thought i'd post here, but oh well :D
So then, i tried doing a teensy bit of research for this, but i'm not very familiar with web technology, so i thought i might aswell ask some of the wiser people :)

Ok, so here's a rundown of the idea in it's completeness:
I'm intending to port Redacted to the web, not the game, but the backend. What i'd ultimately like to have is something like this:

A site serving as a an editor, basically a textbox with a save/publish button, and a front end where you will be able to play through the dialog.

The editor will firstly enable you to edit your dialog markup file and save it to the server.
It is probably wise to use a database, but i'm not really familiar with web security, and even though the asp.net scripts seem fairly straight forward, i don't want to meddle with it and compromise the servers integrity. So lets say for now to just save the file by using php fwrite(). (stop me right here if that is the worse idea)

The markup will be shoved through a parser (possibly written in asp, since the original parser is in c# aswell, so porting it would be trivial i imagine) and ideally output any errors the parser encounters.

Then after publishing you'll be redirected to the frontend site (using unique id's by some hash or so) using your parsed markup as input so you can interact with it as you would do in the executable.
The interaction is another part i'm not quite sure about. Since the keywords are defined in the markup i could statically insert tags including onclick events on the corresponding keywords when parsing the text. the onclick would call a function which further appends text, depending on the parameter (i.e. keyword) which got pressed.

So this would, how it currently is formulating in my head, be a mixnmash of php, js, and asp. I'm not sure if thats a good idea, or if thats just how web dev works. :confused

_________________
Long pork is people!

wzl's burrow


Top
 Profile  
 
 Post subject: Re: Texty
PostPosted: Tue Jan 14, 2014 2:11 am 
Ankle Nibbler
User avatar

Joined: Tue Sep 25, 2012 12:57 pm
Posts: 142
Location: Adelaide, Australia
That sounds pretty complicated. Time to simplify!

What's the game written in? c#? You could rejig it it use console (stdin/stdout) instead of a GUI. This would require text inputted keywords instead of clicked keywords, I don't know if that wreaks the feel. You should be able to do this via a compile-time or run-time option. Then a fairly simple script could be used to interface web browser to your game.

web browser <-> glue code (cgi/php/whatever) <-> original c# game running on web server

There would be one game instance per use on the website; if your traffic is high you would need to consider a queue or something to limit simultaneous sessions, but that won't be an issue to begin with.

Take a look at https://travis-ci.org/ and it's scrolling list of output as tests are run. It's a script running on a server and feeding output to the web browser. You would build the same thing, but bi-directional. There might already be scripts out there for doing this.

That's stage one. Get that working first. Stage two is the modding features, and that's more involved because you have to deal with the issue of multiple simultaneous users. Do they all edit the one mod, or do they choose a mod to edit? Is there user login? Can multiple users edit the one mod at a given time? Is it all stored in a db and then published into the files you game understands? Plenty of things to decide here.

_________________
Chaotic Rage - a fast paced, shooter game that's a little odd, but still fun.


Top
 Profile  
 
 Post subject: Re: Texty
PostPosted: Tue Jan 14, 2014 3:08 am 
Digerati

Joined: Thu Sep 09, 2004 1:17 pm
Posts: 1816
Location: burrowed
Thanks for the input. :D

I'd rather rewrite it completely to not bother with some weird server processes and i/o stuff.
I've been talking a bit on irc about it and i've got a few ideas on how to handle it (in a very basic manner). There is still things i'm not quite sure about. But i will need to get to that at a later stage.

Basically asp gets scrapped. I really didn't wanna use js, but i don't want the processing load on my server, if it can be easily made on the client side. I'm still kinda sad that i have to use js instead of c#, but oh well.

For the back end, editing etc, i will for now save it, as mentioned before, to a file (eventually applying safety checks and put it in a table i guess).
This sounds easy enough so far.
The frontend will query/load the markup script and do some js magic to parse it. the rest would be managed by a bunch of onclick events i suppose.
I will play around with it tomorrow and let you know how it goes :D

_________________
Long pork is people!

wzl's burrow


Top
 Profile  
 
 Post subject: Re: Texty
PostPosted: Thu Jan 16, 2014 1:41 am 
Digerati

Joined: Thu Sep 09, 2004 1:17 pm
Posts: 1816
Location: burrowed
Alright! I got the basic thing working. It does parse the compo script quite fine (not in all parts, need to sort how i will manage narration parts in the markup)

http://wzl.cygnus.uberspace.de/webtexty ... ntend.html :yeah

Feel free to look at the source and gimme a bash for everything you think is super dumb :D

I'll try to advance from this point and get more features into the markup before i'll work on the editor and hosting part.

_________________
Long pork is people!

wzl's burrow


Top
 Profile  
 
 Post subject: Re: Texty
PostPosted: Fri Jan 17, 2014 4:23 pm 
Digerati

Joined: Thu Sep 09, 2004 1:17 pm
Posts: 1816
Location: burrowed
Okay, i'm getting to the point where i need to manage the files created.

Several problems are in my way:
Creating a secure connection to the database for read and write access
Stripping html and sql commands from the text file

Here's the current implementation:
http://wzl.cygnus.uberspace.de/webtexty/index.php

(fancy colors woooooh :spin)

There would be the homepage, which lists the latest submissions in chronological order
There's a create link that will take you to the text editor site from where you can edit and submit your adventure
About will contain the usual things, FAQ and help

I'm not sure about the process of editing yet. I'd like to have it all public, in a sense that you could edit/fork another adventure. Not quite figured out how to determine between edits and forks. If not handled correctly every edit could potentially litter the db too much. User management would be a way to solve that, but i don't want to bother with it, and i don't think it's necessary at this stage.

I might consider adding user management later on if people want their adventures to be private, but that can wait until the core features are working.

_________________
Long pork is people!

wzl's burrow


Top
 Profile  
 
 Post subject: Re: Texty
PostPosted: Wed Jan 22, 2014 11:09 pm 
Digerati

Joined: Thu Sep 09, 2004 1:17 pm
Posts: 1816
Location: burrowed
Finally managed to get some more stuff done :D

I have the viewer and editor ready, aswell as file saving/loading. works reasonably well.

http://wzl.cygnus.uberspace.de/webtexty/editor.php

The sample script is not complete, and neither is the markup feature list. Theres some things to come.

Also i was playing around with something i had in mind, although it's still not complete by any means:
http://wzl.cygnus.uberspace.de/webtexty ... php?gpwiki

A sort of introductional text for users new to game programming. Might be helpful to get some specific pointers.

_________________
Long pork is people!

wzl's burrow


Top
 Profile  
 
 Post subject: Re: Texty
PostPosted: Wed Jan 22, 2014 11:14 pm 
BANNED

Joined: Sun Jun 24, 2012 12:49 am
Posts: 504
I'd rather just have an HTML5/Javascript based interactive tutorial system, but I'm not feeling like making it. :(


Top
 Profile  
 
 Post subject: Re: Texty
PostPosted: Wed Jan 22, 2014 11:48 pm 
Bibliotherapist
User avatar

Joined: Wed Nov 03, 2004 1:28 pm
Posts: 7114
Location: Wilts, Englandshire
Nice. Not using jQuery? It makes a lot of the interaction stuff so much simpler.

_________________
10 PRINT "Bad Monkey ";
20 GOTO 10


Top
 Profile  
 
 Post subject: Re: Texty
PostPosted: Thu Jan 23, 2014 12:25 am 
Digerati

Joined: Thu Sep 09, 2004 1:17 pm
Posts: 1816
Location: burrowed
Codehead wrote:
Nice. Not using jQuery? It makes a lot of the interaction stuff so much simpler.


Since it was my first attempt at some web scripting i wanted to be as barebones as possible, just to see what's going on. How stuff is dealt with. And how utterly weird and disgusting it all becomes :O

But really, it hasn't been all that terrible. Made some good progress without a lot of deadlocks.

_________________
Long pork is people!

wzl's burrow


Top
 Profile  
 
 Post subject: Re: Texty
PostPosted: Thu Jan 23, 2014 6:04 am 
BANNED

Joined: Sun Jun 24, 2012 12:49 am
Posts: 504
jQuery is rubbish.


Top
 Profile  
 
 Post subject: Re: Texty
PostPosted: Thu Jan 23, 2014 7:37 am 
Ankle Nibbler
User avatar

Joined: Tue Sep 25, 2012 12:57 pm
Posts: 142
Location: Adelaide, Australia
I disagree

_________________
Chaotic Rage - a fast paced, shooter game that's a little odd, but still fun.


Top
 Profile  
 
 Post subject: Re: Texty
PostPosted: Thu Jan 23, 2014 11:09 am 
Bytewise
User avatar

Joined: Sun Aug 05, 2012 9:32 pm
Posts: 268
I guess, i kind of agree with pieman? I like to write my own code line by line so I'm not really fond of any kind of wrappers or toolsets in general. but I guess it probably helps writting faster, cleaner and better managed code if you need it.

_________________
Did you ever wonder, how time works?


Top
 Profile  
 
 Post subject: Re: Texty
PostPosted: Thu Jan 23, 2014 8:19 pm 
Bibliotherapist
User avatar

Joined: Wed Nov 03, 2004 1:28 pm
Posts: 7114
Location: Wilts, Englandshire
I used to be a write from scratch person, but these days I simply don't have the time. Also, when people are paying for a software project, they want a quick development cycle rather than craftmanship (sad but true). This is one of the reasons I ended up using C# over C++, I can throw a .Net app together in a quarter of the time it would take to provide the same functionality in C++.

Lastly, jQuery provides good cross browser support. All the hard work of making sure everything works everywhere is already done and jQuery gives a clear indication of minimum browser versions which removes a great deal of guesswork.

_________________
10 PRINT "Bad Monkey ";
20 GOTO 10


Top
 Profile  
 
 Post subject: Re: Texty
PostPosted: Thu Jan 23, 2014 9:56 pm 
Ankle Nibbler
User avatar

Joined: Tue Sep 25, 2012 12:57 pm
Posts: 142
Location: Adelaide, Australia
The biggest benefit of jQuery is that it normalizes things for you. For example, mouse move events provide the parameters pageX and pageY on the event object. But in IE8 and below, they aren't available so jQuery creates them for you based on clientX and clientY which are provided. There are tons of things like this that jQuery provides a shim for:

addEventListener/addEvent becomes .bind() or .on()

querySelectorAll/getElementsByClassName/getElementsById/sizzlejs becomes $() and .find()

XMLHttpRequest/ie ActiveXObject shim becomes $.ajax()

Anyway that's enough from me about it :)

_________________
Chaotic Rage - a fast paced, shooter game that's a little odd, but still fun.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

Powered by phpBB® Forum Software © phpBB Group