Dynamic TRPG Creator

Started by Grimston, March 11, 2014, 06:11:08 AM

Previous topic - Next topic

0 Members and 5 Guests are viewing this topic.

Grimston

Been awhile since I did a update on progress. To be honest I have not really done much besides research why it was not behaving.

Now my issue with Input to scripts is solved and below is my test script, run by the server wanting server input(really bad idea for a real game btw, but will be implemented for maybe a DM? or something? I don't know, just leaving options in.


>pytest
Using Python Provided Library

Python Test
OS Name:  nt
Python Version:  2.7.3 () Platform:  cli

Current date and time using str method of datetime object:
2014-03-11 20:57:14.331000

Current date and time using instance attributes:
Current year: 2014
Current month: 3
Current day: 11
Current hour: 20
Current minute: 57
Current second: 14
Current microsecond: 331000

Current date and time using strftime:
2014-03-11 20:57
Hello! What is your name? >Grimston
Well, Grimston, I am thinking of a number between 1 and 20.
Take a guess.
>15
Your guess is too high.
Take a guess.
>10
Good job, Grimston! You guessed my number in 2 guesses!


> = Input

The scripted used is as follows

Spoiler

try:
   import clr
   clr.AddReference('StdLib')
   print "Using Compiled Standard Library\n"
except:
   print "Using Python Provided Library\n"
import datetime
import sys
import os
import webbrowser
import random

#Settings
ShowDate = 1

print "Python Test"
print "OS Name: ", os.name
print "Python Version: ", sys.version, "Platform: ", sys.platform

if ShowDate == 1:
   now = datetime.datetime.now()

   print
   print "Current date and time using str method of datetime object:"
   print str(now)

   print
   print "Current date and time using instance attributes:"
   print "Current year: %d" % now.year
   print "Current month: %d" % now.month
   print "Current day: %d" % now.day
   print "Current hour: %d" % now.hour
   print "Current minute: %d" % now.minute
   print "Current second: %d" % now.second
   print "Current microsecond: %d" % now.microsecond

   print
   print "Current date and time using strftime:"
   print now.strftime("%Y-%m-%d %H:%M")

#Works! Not really helpful for a game, unless you want to push to rules? or help?
webbrowser.open("http://dev.npipes.net")

guessesTaken = 0

myName = raw_input('Hello! What is your name? ')

number = random.randint(1, 20)
print('Well, ' + myName + ', I am thinking of a number between 1 and 20.')

while guessesTaken < 6:
    guess = raw_input('Take a guess. ')
    guess = int(guess)

    guessesTaken = guessesTaken + 1

    if guess < number:
        print('Your guess is too low.')

    if guess > number:
        print('Your guess is too high.')

    if guess == number:
        break

if guess == number:
    guessesTaken = str(guessesTaken)
    print('Good job, ' + myName + '! You guessed my number in ' + guessesTaken + ' guesses!')

if guess != number:
    number = str(number)
    print('Nope. The number I was thinking of was ' + number)
[close]

I made some slight changes to the script to clean it before posting.

Next is to get the scripting working for the client, Only issue I can see is with how the DLR runs, It will be a little complex to get scripting to work.

To get events going the script will need to be a Python Class, which while could be done, I would prefer to not try to force people to create a class for everything, if I cant find another way, I will have the editor create a base class, along with example events, or even placeholder events.
I'm a suicidal planet and I'm aiming at the sun,
All the gravity inside me will give way to a beautiful calm,
If you're gravitating to me, now's the time to turn and run,
I see a raging ball of fire, burning life lines in my palms

Throndir

Ohh, this is looking really promising! I can't wait to see when you start adding more of the functionality you planned. I'm going to have to start refreshing up on Python, haven't touched that in years.

Grimston

I Have been thinking about keeping the classes, and just provide a skeleton class when you create a new item in the editor, this will then allow, proper variables, and easier use with an API, for example all races, Have a Name and a ID number, so a base class would be expected, This way the API can just expect the base classes.

The base classes, could then have shared events/methods. such as Character.Hurt(int damage, string source = ""), Character.Heal(int value, string source = "")

What do you think about classes in the scripting? I think it might be the way to go (and its easier to implement :P )
I'm a suicidal planet and I'm aiming at the sun,
All the gravity inside me will give way to a beautiful calm,
If you're gravitating to me, now's the time to turn and run,
I see a raging ball of fire, burning life lines in my palms

Throndir

If it works it works! XD

Have you thought about all the potential classes/methods you plan to implement? That way we can better visualize what the requirements you can aim for in the scripting language.


Grimston

#4
Actually no I haven't.  I have a list of base objects, just need to work out what methods should be provided.

classes would make events much easier to implement.  as each method could be an event.

base classes are.

Location
Race
Character
Item
UsableItem
EquitableItem
Stat
StatDescription - helper class made the output file smaller the way its saving.
PlayerParty

Thats all I can remember at the moment. I will create a modal diagram of the library when I can later today.

I think building a list of suggested events / methods would be better.

all methods need to have a variable "DEventArgs args" which is really a Dictionary array "Project" is the staple argument it will contain.  which is the current project thats running. so every script access to other objects.
I'm a suicidal planet and I'm aiming at the sun,
All the gravity inside me will give way to a beautiful calm,
If you're gravitating to me, now's the time to turn and run,
I see a raging ball of fire, burning life lines in my palms

Throndir

Hmm as a start you can look into incorporating the functions and methods LT has already done, then expand from there.

Once you post up a list of all the planned classes. functions, and methods, I can help input too.

Grimston

Class Diagram, yes its very messy, it was generated using NClass

http://npipes.net/DynamicRPG.Shared.ClassDiagram.pdf

Will create a list of basic methods soon.
I'm a suicidal planet and I'm aiming at the sun,
All the gravity inside me will give way to a beautiful calm,
If you're gravitating to me, now's the time to turn and run,
I see a raging ball of fire, burning life lines in my palms

Hasabushi

mmm love python :D.

Nice layout now I understand more where you are going with this. So why not do it similar to how the original NWN's did it. Using constructors to setup up base class access, of course that was C++ and left a lot to be desired lol.

Grimston

Its a messy layout really...

what did nwn have I never really looked at its editor much.

the server and gamehost related classes will be removed.  an external server application will be used.
I'm a suicidal planet and I'm aiming at the sun,
All the gravity inside me will give way to a beautiful calm,
If you're gravitating to me, now's the time to turn and run,
I see a raging ball of fire, burning life lines in my palms

Grimston

Client will be OpenGL based using MonoGame, running on Kara, which is my modular game engine/library

Kara.UI
Simple User Interface Library

Controls

  • Base Control
  • Window
  • Button
  • Textbox
  • Checkbox
  • ComboBox
  • NumericBox
  • ProgressBar

Keyboard/Mouse Support

The UI will be based on this:


I will not be implementing to much extra, maybe the scroll bar though, have to think about small resolution clients...

Will keep you informed  ;)
I'm a suicidal planet and I'm aiming at the sun,
All the gravity inside me will give way to a beautiful calm,
If you're gravitating to me, now's the time to turn and run,
I see a raging ball of fire, burning life lines in my palms

Throndir

That is looking really slick and beautiful.

Grimston

Preview of the UI in action, just a small test window.

Pressing + or - will change the progress bar.

This version should work on Windows and Linux. (Mono for Linux)

Known Issues

  • Textbox Caret is not finished, its very ugly
  • Textbox is not nearly as responsive as I would like
  • Textbox does not allow moving the caret using a mouse (arrow keys only)
  • Textbox does not scroll text correctly yet (Goes forward, but not back)
  • Window title does not yet scroll its text (that's how I will deal with long titles)

UIPreview.zip
http://npipes.net/request.php?1

I have not finished the Cursor, so the built in "Cross" is the actually how the cursor looks for now, designed for debugging and wont appear in a proper release.

After its initial start up, it will create a folder called "Config" inside is "Config.ini" you can modify those 3 settings to see how the UI reacts to different sizes, default settings is below


[AppConfig]
Fullscreen = False
Width = 800
Height = 600
I'm a suicidal planet and I'm aiming at the sun,
All the gravity inside me will give way to a beautiful calm,
If you're gravitating to me, now's the time to turn and run,
I see a raging ball of fire, burning life lines in my palms

Grimston

My old site was obliterated during a server move.... So all previous links are considered invalid, one or two might function, If I end up replacing them.

In greater news.

DTRPG is back on production!

This includes a huge change in the direction of the project, some might say BOO! to this but screw you.

The new direction is as follows.

Editor - Create Game -> Export DLL (THE GAME)
Game Server - Run the Game from the DLL (With some minor INI file adjusting, or via its console... maybe... I'm lazy)
Client - No such thing

Notice something that seems very very strange there?

That's right NO client. the simple reason lies in the simplicity of the new direction.... was that right?

Game Server
C# Programmed Game Web Server.

The Game Server, will actually host the game on the web, allowing your favorite web browser to run the games.
This greatly reduces the amount of networking code needed.
The modular design allows a single Game Server to run many games on different ports.

Extra nifty bonuses to this is you can replace or customize the default interface that comes with the game. (Twitter bootstrap based - Desktop,Tablet,Phone view)


The entire aim is to streamline the game creation, I might even add a subset of the game server in the editor for quick testing.


I hope you enjoyed my small attempts at humor in this post, and found it almost as funny as repeatedly shooting arrows into someones face.


So now the only requirements is for the server to run .net4/Mono4 (Hoping it cross compiles to mono at the moment)

And the client to be running a HTML5 compatible client.

-----

Please let me know what you think of this new direction, I think its for the best, and about the only way something like this can really compete with everything else.
I'm a suicidal planet and I'm aiming at the sun,
All the gravity inside me will give way to a beautiful calm,
If you're gravitating to me, now's the time to turn and run,
I see a raging ball of fire, burning life lines in my palms

Grimston

Been writing up everything I have been doing on planning for the web client, here is an update.

DRPG Web Client

Major Challenges

  • Input
  • Audio Support
________________________________________________________________________________
Audio Support
Audio will probably be difficult to implement, unless the browser is HTML5
compatible, this could be worked around by some JavaScript to detect if its
possible. Then fall back to something like a hidden flash player.

Audio Support - Result
After some searching the best player I could find is JPlayer. HTML5/Flash player

JPlayer OS Support:

  • Windows: Chrome, Firefox, Internet Explorer, Safari, Opera
  • Windows (legacy): IE6, IE7, IE8, IE9, IE10, IE11
  • OSX: Safari, Firefox, Chrome, Opera
  • iOS: Mobile Safari: iPad, iPhone, iPod Touch
  • Android: Android 2.3 Browser
  • Blackberry: OS 7 Phone Browser, PlayBook Browser
   
JPlayer Audio Format Support:

  • HTML5: mp3, mp4 (AAC/H.264), ogg (Vorbis/Theora), webm (Vorbis/VP8), wav
  • Flash: mp3, mp4 (AAC/H.264), rtmp, flv

Recommendation:
    mp3, ogg, wav
    Preferred: ogg(Chrome, Firefox, Opera), wav(Safari), mp3(Internet Explorer)
   
    Conflicting information, I think Internet Explorer actually supports wav
    since wav is standard in windows anyway. and we should avoid mp3
________________________________________________________________________________
Input
Input might be fairly difficult. If we want to ask the user for some input like
there name? how can we do this without to much effort on scripting....

Client end could just be a JS Input box... or even a modal window in the page.

Possible Solution
    Callbacks. something like the following
    currentPlayer.GetInput(InputName, Question, Callback)
   
    InputName = Unique Identifier (used for getting the value back)
    Question = What we will ask the player
    Callback = Another function that will handle the input when returned
   
Example (Not real code, just a mash up)

currentPlayer.GetInput("WhatsYourFavNum", "So.. Whats your fav number?", FavNumResponse())

func FavNumResponse(InputName, Value)
    print "So you like the number: " + $Value;


This might seem to some as... annoying, but it will probably be much easier as
you can then spread your scripting into smaller and easier to manage functions.
________________________________________________________________________________
The HTML client will probably point the development of the scripting in ways
that make it easier for the players to use it, while actually making good
habits on the scripting, callbacks should be used a lot, Kind of like a HTTP
response, GET page, fill details POST page back to server, GET page. Its
probably a lot cleaner and easier.

Audio is not really high priority, and could even be disabled. But its a shiny
that would be wanted by some. You could even have BG music.
I'm a suicidal planet and I'm aiming at the sun,
All the gravity inside me will give way to a beautiful calm,
If you're gravitating to me, now's the time to turn and run,
I see a raging ball of fire, burning life lines in my palms

Grimston

Web Server
__________________
C# Application running a "Application" Which is a host process for the game.

Currently the server works well unless you get a 404 error, for some reason... when it attempts to redirect to the 404 file, it works, but never closes the connection. This causes the browser to sit and wait for the rest of a message that will never come.... even if header: "connection: close" is set... Have to look into that... Might just build a raw response which does work, probably just a bug in the 404 generator.

The server can manipulate the get and post requests.

Browser/IP/Application based sessions are supported
The best session for DRPG is Application, its shared between all clients. (Requires manual User session handling, IP Based? Cookie Based? Need to look into the best option)

Server Web Config Tool is almost complete.
___________________

DRPG Editor Changes
Removed the Syntax Highlighting - This is to ensure it will run on windows/linux/mac
Further changes to this will be adding a open in external editor button. Then you can use an external editor with syntax highlighting to edit the script until I either find a cross platform editor or create my own.
I'm a suicidal planet and I'm aiming at the sun,
All the gravity inside me will give way to a beautiful calm,
If you're gravitating to me, now's the time to turn and run,
I see a raging ball of fire, burning life lines in my palms