Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: ASCII GM - nothing yet  (Read 1669 times)

Lectorog

  • Bay Watcher
    • View Profile
ASCII GM - nothing yet
« on: March 15, 2013, 08:31:39 pm »

I am an inexperienced programmer.
I will be making a programming to be used for GMing - running a tabletop-style RPG.
This program will be based off of my desires, but input is appreciated from anyone.
C++ with PDcurses, because that's all I have more than an hour of practice with.
  That means it will be in the console, limited to ASCII display. As the title suggests.
  Oh, also ctime. Gotta get them random numbers.

Currently, I'm planning three stages of creation:
  • Dice rolling
  • Track and display entity information
  • Draw and modify the map
(1) will be easy. I know how to do this. It's a good thing to get rolling with, while still being functional. Because I don't have 6d6 and don't want to write down complicated damage calculations every round.
(2) is something I know how to do. External files - for saving and inputting info - will be the biggest problem, but only because I have never worked with anything but .txt files, which are inefficient and not UI friendly.
(3) is the challenge. I figured this would be a more suitable approach to learning than the roguelike I stopped working on after mashing keys for 8 hours. Display the entities (as colorful letters, of course), connected with their information from (2); display the dungeon (or other map) based on whatever file someone made*; reveal sections upon command (something I can't do well with dungeon tiles); easily move entities by inputting their full moves or manually moving the tiles. Useful stuff, not too hard to make, but good for practice. Can be built off of in the future, too.
* file interpretation ('language') is another challenge because the keyboard does not come with colors. Just something to figure out.

Anyway, I haven't started working on this yet. I may never, but I actually plan to.
I'll update this topic if I have ideas or progress, or for whatever reason. 's my topic.

All contributions appreciated. Minimum 1:1 construction: insult ratio if insult present.
This is something that will actually help me as a GM and programmer. If it can potentially help you too, just let me know and I'll try stuff.
« Last Edit: March 15, 2013, 09:35:32 pm by Lectorog »
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: ASCII GM - nothing yet
« Reply #1 on: March 16, 2013, 11:57:55 am »

I recommend picking up Boost::random! It's a robust rng library for generating all sorts of numbers. It also lets you not have to do rand()%100+1 instead replacing it with an elegant boost::random::uniform_int_distribution<> dist(1,100); dist(gen); XD
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Lectorog

  • Bay Watcher
    • View Profile
Re: ASCII GM - nothing yet
« Reply #2 on: March 16, 2013, 03:19:09 pm »

<>
I don't even have a clue what this means. I think I'll have to pass.
Anyway, it seems like just another PRNG. I really should be making my own, because randomization is currently my weak point. I started last night, but stopped once I realized that I need random numbers to roll dice and banging out numbers didn't cut it. And yes, I do enjoy reinventing wheels because there is a small chance mine will be slightly rounder.
Logged

cerapa

  • Bay Watcher
  • It wont bite....unless you are the sun.
    • View Profile
Re: ASCII GM - nothing yet
« Reply #3 on: March 16, 2013, 03:47:47 pm »

Proper random number generators already come with C++11. Here is the documentation.

Reinventing wheels is good to a point, but with randomization you will either make something broken, or something identical to commonly used algorithms.
Logged

Tick, tick, tick the time goes by,
tick, tick, tick the clock blows up.

Devling

  • Bay Watcher
  • You're all a bunch of socialists!
    • View Profile
Re: ASCII GM - nothing yet
« Reply #4 on: March 16, 2013, 08:21:16 pm »

I have no programming experiences, so I shall simply PTW because I am interested in the program.
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: ASCII GM - nothing yet
« Reply #5 on: March 16, 2013, 08:33:04 pm »

Proper random number generators already come with C++11. Here is the documentation.

Reinventing wheels is good to a point, but with randomization you will either make something broken, or something identical to commonly used algorithms.
It's actually identical to Boost's implementation, up to the syntax :D
It has a perplexing issue with allowing you to write uniform_int_distribution<int> then promptly throwing a DivideByZero exception, though. Has to be <>, I think. >_>

@Lectorog: The important thing is to learn! Boost has a tutorial that works with C++11's random code. <> just means that the template is set to the default.
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Killjoy

  • Bay Watcher
    • View Profile
Re: ASCII GM - nothing yet
« Reply #6 on: March 17, 2013, 08:34:17 am »

And yes, I do enjoy reinventing wheels because there is a small chance mine will be slightly rounder.
Nope, nope and nope.
But it is okay for the funzies of it, but you will not with your limited experience make something is remotely better than what makes it way into STL(No offence). Randomness, and especially the ability to generate random permutations is a big part of computer science as it lays the foundation for randomized algoritms. Therefore a lot of work goes into finding the most effective and uniformly random random number generators.

If you don't know how to make use of STL, then ask for help/examples and learn to use it. Else you are just going to get burned out on a very insignificant part of your game.

Now, I'll give you example use of a random number generator in c++11.
Code: [Select]
//C++11 dice example
#include <random>
#include <iostream>

class Dice {
   //Initialize random number generator
   std::default_random_engine generator;
   std::uniform_int_distribution<int> distribution;
public:
   Dice(int faces){
      distribution = std::uniform_int_distribution<int>(1, faces);
   }
   int roll() {
      //Roll the dice :)
      return distribution(generator);
   }
};

int main(int , char **){
   //Initialize Dice with 6 faces
   Dice dice(6);
   
   std::cout << "Rolling dice 1000 times!" << std::endl;
   float total = 0.0f;
   for (int i = 0 ; i < 1000 ; i ++){
      int roll = dice.roll();
      total += float(roll);
      std::cout << roll << " ";
   } 
   std::cout << std::endl << "Average: " << (total * 0.001f) << std::endl;
   std::cout << "Should be around 3.5" << std::endl;
}

Logged
Merchants Quest me programming a trading game with roguelike elements.

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: ASCII GM - nothing yet
« Reply #7 on: March 17, 2013, 09:48:05 am »

I was under the impression that uniform_int_distribution<int> cause a divide by zero error, but it doesn't seem that that's the case. >_> Maybe it was a problem with MSVC.
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Lectorog

  • Bay Watcher
    • View Profile
Re: ASCII GM - nothing yet
« Reply #8 on: March 17, 2013, 10:01:43 pm »

After some brief consideration I decided to go with a preexisting RNG. There's no way a generalized RNG could be more suited for my purposes if I made it, unlike many systems. And really, that's a major chore that's likely to turn me off of the project; getting around to programming is often hard enough when I care about what I'm working on. All of which points you all have made here.

I'll probably go with the C++11 setup. I really should learn a bit about C++11. Should've months ago.
Logged

timmeh

  • Bay Watcher
    • View Profile
    • My Portfolio
Re: ASCII GM - nothing yet
« Reply #9 on: March 19, 2013, 08:43:43 pm »

I've dabbled with something like this before myself to help avoid some of the slow-downs I've encountered in the weekly campaign I run... still haven't uploaded the tool itself, cause it's nothing close to complete, but there's a dice-roller I wrote in Python for Shadowrun here: http://tsassone.com/portfolio/software/srdiceroller.php

Additionally, if you're wanting to avoid raw txt files, I've also played with the idea of a data-storage format, which should be over here: http://tsassone.com/portfolio/software/SOML.php  (That one's got parsers written in c++, c# and python, so whichever you're most comfortable with)

Just in case something there might help; you're welcome to use them or learn from them however you want :)

You may want to try to pull them soon if you want them... the host is expiring soon, and depending on whether that day or my next pay day comes first, it may be down for a while if I have to migrate...
Logged
On the Wall is a Masterfully engraved carving of Urist McHardcastle and Goblins. Urist McHardcastle is surrounded by the Goblins. The Golbins are stamping on Urist McHardcastle. Urist McHardcaste is laughing at the Goblins. The carving related to the prolonged and bloody death of Urist McHardcastle in the Fall of 1659, the Winter of 1659, and the Spring of 1660. On the engraving is an image of Cheese.

Lectorog

  • Bay Watcher
    • View Profile
Re: ASCII GM - nothing yet
« Reply #10 on: March 19, 2013, 09:17:17 pm »

Thank you. I've not looked in detail yet, but I saved the pages. (Not bookmarked, downloaded.) Should be useful, even if I don't know much about Python - C++ is all I've had experience with, but C# is obviously close.
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: ASCII GM - nothing yet
« Reply #11 on: March 19, 2013, 09:23:53 pm »

SOML looks useful. I should download it for my use :3
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

timmeh

  • Bay Watcher
    • View Profile
    • My Portfolio
Re: ASCII GM - nothing yet
« Reply #12 on: March 30, 2013, 07:23:52 pm »

Done migrating, and installed Drupal while I was at it.  New links are here:

SOML:   http://tsassone.com/?q=soml
Shadowrun Dice Roller:  http://tsassone.com/?q=srdice
Logged
On the Wall is a Masterfully engraved carving of Urist McHardcastle and Goblins. Urist McHardcastle is surrounded by the Goblins. The Golbins are stamping on Urist McHardcastle. Urist McHardcaste is laughing at the Goblins. The carving related to the prolonged and bloody death of Urist McHardcastle in the Fall of 1659, the Winter of 1659, and the Spring of 1660. On the engraving is an image of Cheese.