Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - melville

Pages: [1]
1
Player's Plaza / Roguelike via SSH/Telnet server (small FOV preferable)
« on: January 13, 2015, 02:08:53 PM »
I just ordered Blackberry and it seems best way to play roguelike on it (good fit for gaming while in work - short, often interrupted periods) is to use SSH/Telnet connection.

I'm aware of servers for DCSS, but I'm also exploring other possibilities. Small FOV in game would be a nice feature, since screen estate is limited. I like hack-alikes in general (POWDER, Infra Arcana etc.), but Nethack is not for me.

Maybe in the end I'll go with self hosted solution, but first I'm looking for hints, since Google didn't yield any meaningful results.

2
Programming / Re: Weighing the dice
« on: July 13, 2014, 04:02:17 PM »
I have investigated some alternative approaches to RNG. Some discussion here is misleading, other is spot on. First let's start with approach similar to deck of cards.

You probably want a small stack with fixed content, otherwise it defeats purpose and you are better using RNG. Numbers are poped from stack, when empty replenished with numbers and then shuffled (you can find algorithms for shuffling arrays). You need only entropy for shuffling, poping numbers can be done linear. Here is example of stack with 20 element with numbers in range 1-6 (I just made it up, so nothing special):

1, 2-2-2, 3-3-3-3-3-3, 4-4-4-4-4-4, 5-5-5, 6

Distribution of numbers isn't even, so you already get different odds: 5% chance for one, 15% for two, 30% for three and so on. Let's say that one is a miss and six is a critical hit - you can actually get two of those in a row (same number at the end of one stack and at the beginning of another). This should be a rare event, also periods without misses after and before event will be longer. You will also never get more than two misses in a row.

Why small stack? If you increase size of stack, you will probably want to increase probability of poping specific number. Not only streaks will be more common then, but also those streaks will be longer. Deck/stack approach gives you control over streaks and guaranteed occurrences.

About predictability from player perspective - if you don't know where stack starts/ends it is hard to abuse. One way to mitigate that is to change size of stack a little bit, every time it is created e.g. you discard one to five elements from deck with 50 elements.


Omnivore and Bear mentioned progressive system. Similar solution is used for drops in World of Warcraft: http://www.shacknews.com/article/57886/blizzard-details-secret-world-of . I won't describe it, since article is pretty clear.


You can find some nice discussion here: http://stackoverflow.com/questions/910215/need-for-predictable-random-generator . Just to quote:

Quote
Given the behavior you're asking for, I think you're randomizing the wrong variable.

Rather than randomizing whether this hit will be critical, try randomizing the number of turns until the next critical hit occurs. For example, just pick a number between 2 & 9 every time the player gets a critical, and then give them their next critical after that many rounds have passed. You can also use dice methods to get closer to a normal distribution -- for example, you will get your next critical in 2D4 turns.

I believe this technique gets used in RPGs that have random encounters in the overworld as well -- you randomize a step counter, and after that many steps, you get hit again. It feels a lot more fair because you almost never get hit by two encounters in a row -- if that happens even once, the players get irritable.

3
Programming / Re: I don't understand random seeds.
« on: May 28, 2014, 09:33:16 AM »
Oh, cool Melville! So basically, there *isn't* anything preventing us from seeding the rand() function with an uninitialized pointer, but it's likely to make something go boom, am I right? I think I'll look into that clock_gettime() function, actually. It sounds promising.

If you are using rand(3), seeding is probably least of your problems. Bad PRNG is still a bad PRNG, no matter how good the seed is. Even when you are using a better PRNG like Mersenne twister, time(3) is good enough in most cases - what matters is uniqueness of the seed across games. I would be more worried about a modulo bias than seed itself.

ASLR (Address space layout randomization) is used by mmap(3) on most systems, I wonder if it could be abused as a part of a seed? Still this is over complicating things in my opinion.

Example showing differences between time(3) and clock_gettime(2).

Code: [Select]
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

long int give_seed(void);

int
main(void)
{
        int i;

        for (i = 0; i < 20; i++)
                printf("Seed: %ld\t%lld\n", give_seed(),
                        (long long) time(NULL));

        return EXIT_SUCCESS;
}

long int
give_seed(void)
{
        struct timespec ts;

        (void) clock_gettime(CLOCK_REALTIME, &ts);

        return (ts.tv_sec ^ ts.tv_nsec);
}

I forgot to mention that arc4random(3) is non-deterministic, entropy is injected multiple times, since it is geared toward cryptographic applications. That could be a wrong usage case for roguelike, depending on your needs.

4
Programming / Re: I don't understand random seeds.
« on: May 24, 2014, 10:55:37 PM »
Uninitialized variables can be used, a crude example:

Code: [Select]
unsigned int i, junk[100];

for (i = 0; i < 100 && junk[i] == 0; i++)
        ;

printf("Seed: %u\n", junk[i]);

Still it is a bad practice, since it relies on undefined behavior. Compiler can optimize it out, which can lead to weird situations. More information: http://kqueue.org/blog/2012/06/25/more-randomness-or-less/

If you want a seed that varies a lot why not ask kernel for entropy instead or at least use clock_gettime(2) function, which provides nanosecond precision?

Some of those issues are addressed by arc4random(3) family of functions. They don't require seeding, they take care of it on its own (reseeding also). One problem here is portability, those functions are native only on *BSD systems and Mac OS X. On Linux they can be found in libbsd library. There are also portable versions of it (working also under Windows I think), one example: https://www.mirbsd.org/a4rcontrb.htm

Function arc4random_uniform(3) is also nice, since it can be used to obtain numbers in a specified range without modulo bias. Possible issue that can occur is performance. Those are cryptography grade PRNGs, so speed is a secondary objective.

5
Installed the SDL libraries through Homebrew yet "include/Engine.h:7:10: fatal error: 'SDL.h' file not found", meh. Trying to get it to work as an XCode project now, it's... spitting up fewer errors than when I started, I feel confident.

What version of SDL you installed? SDL2 won't work - in many ways it is different library. You need SDL from 1.2.* series.

Makefile is looking for "sdl-config" binary provided by SDL, you can check if it is in your PATH by running "sdl-config --cflags". Output should point to location of headers. Maybe it is just matter of adding "sdl-config" location to your PATH.

Does IA log errors anywhere useful? Was having a perfectly nice time shooting a tesla cannon at deep ones when suddenly FATAL ERROR, and in such a nice run too. Probably will put me off the game for a bit.

You can build debug version from source that provides more information e.g. "make BUILD=debug" (prints to shell). As much I don't want to say it, it could be a problem with WINE. With native version you could try to obtain core dump - won't explain details about that.

What you can do: provide as much detail about situation before crash. That could help replicate the situation.

6
Can't get the make file to build it either, somesuch thing about not finding some SDL file that appears to actually be there.

You need SDL, SDL_mixer, SDL_image libraries. Best way to get them on Mac OSX is via Homebrew or Macports. People reported that other than that it compiles out-of-box on Mac OSX. You can find more details here (use "Show more replies" link to see whole thread) : http://infraarcana.wikispaces.com/share/view/65547238

7
Playing in WINE, I have found that the "Ressurect" menu option works pretty literally: it lets me continue with my last dead character. I guess something is not being deleted properly? If I forget that I died last session I save scum on accident.

I can't reproduce that on Linux. Something weird is going on - not sure if it could be WINE related. Additional information about when/how it did happen (if you remember) probably would help NON.

I wouldn't be surprised by existence of such issue, when it comes to version 15.0. There were numerous issues related to saving in that version. Since then it did get decent amount of testing and NON created test coverage for that code. Finding issue related to saving seems less likely now, still it is possible that something slipped by.

Personally I don't use saving, since IA a short/fast game anyway.

8
I would like to ask chooseusername not about game itself, but about tool that was mentioned in previous changelogs (at least I think so): Google Breakpad, if he doesn't mind.

What experience you have with using it? How hard is to integrate it into existing code base. How useful information provided by Breakpad is, compared to GDB? What overhead it has e.g. library size?

I'm asking since I learned about this tool for first time here (I have been lurking around for some time, just didn't register before) and it looks useful. It is hard to replicate event in roguelikes thanks to randomization, core dumps would help here, but expecting normal/casual user of being able to obtain core dump is asking way too much. Even then, size of core dump can be huge, which doesn't help reporting either.

9
Design / Re: Wound system
« on: April 30, 2014, 04:30:14 PM »
That's pretty much how Infra Arcana's sanity system works...

Which is kinda funny, since there was a bug in IA that would crash game, when you reach 100% insanity. Guess not many players reached that state and just died long before that.

As for ideas related to wound/HP mechanic, soft/hard health points idea isn't something new, it was just executed previously a bit different. Rechargeable shield can serve as soft HP, were you don't take any damage, when shield is still on (typically small amount of shielding is provided and it is recharging fast). When it wears off, damage is done against hard HP, which often is not easily regained or not regained at all. This can work for some games and fit some themes/settings.

The problems starts, when soft/hard HP are affecting same resource as proposed by NON. As I see it gaining one wound would increase chance of getting second one and so on. Cap between not gaining and gaining wound would be lowered each time. Combined with the fact that Infra Arcana isn't easiest game already, in my opinion it wouldn't work.

Right now wound distribution is random, but flat. Chance of getting wound at low and high HP is the same. Penalties for wound are there, yet if need you can play few levels with wound in critical situation relaying more on other resources (using more ammo etc). 

10
Programming / Re: Trying to compile Advanced Rogue 5.8
« on: April 30, 2014, 04:11:54 PM »
For free() and exit() you need "#include <stdlib.h>", for str* family of functions you need "#include <string.h>". Those headers are pretty often missing from old code, but even without those compiled binary should work. Man pages are your friend, so something like "$ man strcpy" should give you information what headers you need in future

11
Incubator / Hack (PDP-11 version from year 1985)
« on: April 30, 2014, 03:59:42 PM »
I'm not sure where to put it, if topic fits better another section of forum, please move. edit: It looks like it would fit "The Incubator" better - I would like to request move, if anyone capable of doing so is reading this.

So I was tinkering with old Hack versions for some time. For those unfamiliar, before NetHack there was a Hack: http://nethackwiki.com/wiki/Game_history Version 1.0.3 of Hack made by Andries Brouwer is still distributed with NetBSD and OpenBSD systems. It isn't much a challenge to get it working on Linux. I decided to go with even older version.

Code for Hack version 1 for PDP-11 was released according to email timestamps in February 1985: http://nethackwiki.com/wiki/Jay_Fenlason%27s_Hack I had some previous experience with code archeology (running C code from year 1989), so what not compile PDP-11 Hack then? It took me about hour to patch code a little, maybe more before it compiled, linked and displayed something. Some screenshots:




First one should be familiar. At that point you could move in the game and explore dungeon, but bumping into anything would crash the game (same goes for things like opening help etc). Still seeing this screen for the first time was quite something.

Second one is result of some hidden code. Game prohibited playing in working hours (9:00-17:00 Monday-Friday).

I worked a bit more on code, which included tracing some problems with GDB. In some cases that wasn't much of use either, since whole stack was smashed - venerable printf debugging did come to rescue. I got to the point, when game was quite playable, so I made video with my commentary, which is about 10 minutes long: https://www.youtube.com/watch?v=4ros1L0LycA

I'm not sure were I will go with this, if anywhere at all. As I pointed in video, distribution of changed code is questionable for many reasons. Still maybe some folks here will enjoy this video a little bit.

Pages: [1]