Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 11 12 [13] 14 15 ... 31

Author Topic: Can delphonso make a commercial game?  (Read 48718 times)

delphonso

  • Bay Watcher
  • menaces with spikes of pine
    • View Profile
Re: Can delphonso make a better game?
« Reply #180 on: December 30, 2021, 10:28:44 pm »

It's time.

Let's get down to business:



For this project, I won't make the window so small. I'd also like to properly implement the box containers which allow you to change the size of the UI quite easily (at the cost of some up-front time-investment.)



You'll notice that everything is blue again - that's because I'm using my laptop to develop this, this time. We'll see if that makes the editor more friendly. My laptop is only slightly stronger than a raspberry pi, unfortunately.

I whip together the main scene I want to have. I title it "ground" and imagine it should have a grassy texture, and perhaps - a piknik blanket.



We'll have a "LineEdit" - which is the sort of text box like a username/password input or search bar. Only one line. Then the two buttons - randomize and enter.



I add a label at the bottom that we can put an error message in - if the player tries to enter a non-six letter word, we can give them a friendly reminder here.

Pleasantly, LineEdit has a feature to limit text to a certain number of characters. Any characters pressed after the 6 is filled will be ignored.



And...because I'm a god-damn psychopath - let's...do this.



I toss a script onto the ground scene and connect up the buttons. I don't know if I showed it last time, but every node has a set of signals they produce, which can conveniently be connected into code. They have quite a few options - but pressed() is enough for us.



And those become functions ready to go:



delphonso don't do this. You're a monster.



We get two new variables here: record, which is a blank dictionary, and vermin which is a very long string of 6 letter words. We'll talk about that later. My plan for the dictionary is simple - as far as I know, hashes are specifically designed to not be reverse-engineerable. That means, you can turn strings to numbers, but can't turn those numbers back into strings. However, if we keep track of all the strings and numbers (in our database), we can match them back up later if we end up with only a hash and not the string. I'm not sure if this will be necessary in the future, but I figured I'd get ready for it just in case. We might even end up making a reverse-engineerable algorithm instead.

[I missed a screenshot here, woops]
Code: [Select]
func _ready():
vermin = vermin.split(" ")
for n in vermin.size():
record[vermin[n]] = hash(vermin[n])
linein.text = vermin[randi()%vermin.size()]
The split(" ") here is just simply making the long string into an array, cutting out all the spaces and leaving us with only the 6 letter words. It's a bit easier on me than following the array syntax.

then, we go through the array and add each bug-word to the record dictionary, connected to its respective hash. Finally, we add a random word to the text-input box because it looks a bit nicer.

Let's give it a shot.



Uhhh what the fuck?

Well that's a nightmare. I'll deal with that in a second. Why does it look like a weird meme? At least the other stuff works. I added print(vermin) and print(record) to the end of the ready function. Here are the results.



Hmm. Some of the hashes are of different sizes. This is to be expected, but I'm not sure what that will mean for making stats from those numbers. Number lengths seem to vary between 8 and 10, mostly favoring 8.



Okay, well...deleting that text box and adding a new one with the same name fixed it. I also enabled the feature which allows you to easily clear the box by pressing the x.

For the reroll button, we'll just do the exact same thing we did in the ready function.



For the commit button, I think we'll probably need a new function there. So let's just set that up.



Okay, let's get started on that. First things first, let's make sure it's a six letter word.




If it is six characters (this won't care about if those are punctuation, numbers or letters, right now), we make a new bug and we run the randomize button to refill the box with a new bug (I might change this, in case the player want to just add like...20 jeremies or something.)

If not, the text is ignored, and the label we set up earlier will say "six letters, please". Then I create a 3 second timer, when that counts down, the warning message returns to "" - meaning nothing is shown and the box is effectively hidden. I then have to free the timer, otherwise we'll end up bloating the scene with timers if you keep putting in non-six-letter words.



This is all fine and dandy, but we need some bugs, man.

Let's work on the newbug function. I changed the above text so that the commit button send the inline.text to the newbug() function, thus you'll see the new variable: newguy here.

[I also missed this screenshot]
Code: [Select]
func newbug(newguy):
if newguy in record:
print("already got it!")
else:
record[newguy] = hash(newguy)
vermin.append_array(newguy)
print("new bug added to record")

Pretty self-explanatory. If newguy is already a bug we've seen, nothing happens. We can be sure that the text coming in is 6 letters, so we don't need to check it here again. If the word is new, we add that to the record (with its hash) and append it to the array. Should be easy!



Cool - checking if the bug is already on record works no problem. Let's add a new bug..."fucker"



You motherfucker.

This was actually a very dumb mistake on my part. "append_array" does not append the array - it appends an array onto an array. The function is simply "append()", so it looks like this now instead:
            vermin.append(newguy)

And with that:



It works! We're now creating hashes and adding them to the record - the game is also adding those words to the list that it can randomly roll. Nice!

Here, I pressed random until the word I typed in showed up, confirming that it is working as intended.



But still. We need a bug. I think the best way to do that is to make a new scene.



A new scene: insect. As of now, it consists of just a sprite and a label.



At the beginning of the program, we get ready to instance it. And then we go to the newbug() function and add the following:



A new bug is added, then added to the scene tree. Their name is whatever name was passed to commit, and they're dropped into the window somewhere (randomly within screen size, for now - a +50 was cut off at the end, with the goal of running a 25 pixel barrier along the top, so that we don't get bugs on top of our buttons.

Let's try it out!


It's beautiful

We are already approaching the desired result:



I ran a few more 6-letter strings through to see what sort of hashes we can expect to see. Many of them start with 4, which is interesting.



-=-=-=-=-

A few additional notes: Here's the quick and dirty method for matching hashes to their original strings.



I was also thinking about bugs and I would love it if I could get them to walk in a sine wave like how many ants and cockroaches usually forage:



Spoiler (click to show/hide)


I checked the capumon code and you should be able to get about 25% crit chance at maximum - which is pretty low, considering most combats end within 6 turns. If you have a cactus in your party, you crit chance lowers, but your accuracy greatly increases.
« Last Edit: December 30, 2021, 10:49:07 pm by delphonso »
Logged

Starver

  • Bay Watcher
    • View Profile
Re: Can delphonso make a better game?
« Reply #181 on: December 30, 2021, 11:54:09 pm »

The thing of reversing hashes to (possible, maybe not the original) hashed inputs is sometimes called a Rainbow Table. It is entirely possible for multiple inputs to have the same hash-output, but I don't think that's an issue. My advice is to not bother with this. A 'dictionary' and reverse-lookup for 22,000ish possible 6-letter words will take at least 22000x(6+4)ish bytes of memory (i.e. about 215KiB, which doesn't sound large) but may be much larger if you start recombining and adding further lookups. Merely storing the hashable word in the bug-record (and also the hash-value if you don't want to calculate this static value more than the first time) is going to far be easier on the resources.


And I reckon the apparently variable hash-length is because (as a value) it would be zero-padded at the top end. They're also probably (because they often are) really hexadecimal values as well, though you're 'looking' at them in their decimal form by default. Do you have the printf() and/or sprintf() functions in Godot? (The former formats to output, like a straight 'print', the latter formats but for further internal processing.) Using hexis=sprintf("%08X",hashis) (or whatever works for you, with appropriate variable name rewriting) should convince you of this.

0xFFFFFFFF=4294967295 (8 hex digits => 10 decimal digits) which, at a glance, I think your decimal values are all beneath, and is four bytes or a doubleword - fairly standard possibility for a hash. 0x04D400AB=81002667 (10 hex digits, the first a zero-padding => 10 decimal digits only if you double-pad the start with zeros), which I think is your lowest listed value. With just "%8X" formatting or not doing "%010d" for the decimal[1], you'll get the variable-length 'number-strings' you see.


Yes, you can probably make a hash the input seed to a rand() stream to get 'more information out than you put in', and if it's suitably 'twisty' (e.g. mersenne-twisty!) then it may look like an increase of entropy. But if you put 1, 2 3 or 4 as the only possible seeds into a PNRG then you'll get no more than 4 'unique' sequences of arbitrary length, and putting in 32-bit dword value will 'only' give you 2^32 (possibly, not guaranteed!) PRNG sequences. Should be more than enough, but adds complications when a halfway decent (semi-?)cryptographically-secure hash gives you probably most of 256^6 starting positions (or 2*(256^3)?) spready fairly 'randomly' around the 4-byte hash-space. Beyond that 'resolution' you're probably asking too much of it though it also may not be obvious to the end-user/player if you push over the limits just a little bit...


Ah, sorry again for just blurting all that out. I do like my programming theory, as you know. ;)



[1] If it's a hex value, you know you can continually mod-2 it (and shift-right, ready for the next mod-2) and always have an equal chance yes/no, etc, for the 32 times you do it. Treating it as decimal means that the most-significant-decimal is 0..4 only (and proportionately less chance of the 4 being true) at the end of your ten mod-10s.
Logged

Eschar

  • Bay Watcher
  • hello
    • View Profile
Re: Can delphonso make a better game?
« Reply #182 on: December 31, 2021, 02:25:24 am »

BTW, I played the final capumon version (and beat both opponents pretty easily.) Despite its tiny size, I liked the demo/game, mainly because the various mons intrigued me. I love them

pro tip: is there a limit on how much HP your mons can gain? regardless, if you have Sundrop in your team, you can use blinding/paralyzing attacks to keep opponents at bay while Sundrop's passive pumps up your mons' HP to convenient levels

edit: i can't stop thinking about them
« Last Edit: December 31, 2021, 02:50:47 am by Eschar »
Logged

delphonso

  • Bay Watcher
  • menaces with spikes of pine
    • View Profile
Re: Can delphonso make a better game?
« Reply #183 on: December 31, 2021, 02:54:12 am »

Do you have the printf() and/or sprintf() functions in Godot?

You're not going to believe this. This is how you print formatted strings in Godot:

var formatted_string = "Boy, this seems like %s"
var additional_string = "a bad idea."
var actual_string = formatted_string % [additional_string]

This is even worse than the usual Python stuff. There isn't a way (at least that about 30 minutes of searching documentation could find) of either grabbing the original hex or even turning the decimal integer into a hexidecimal one - though the standard library does contain methods for changing hexidecimals into decimals (named hex_to_int). I assumed hexidecimals would be an easy way of generating colors as well, for the insects' bodies - so if I can find a way to do that, it'd be great (though, I suspect we'll end up with a shit-ton of pure black or pure white bugs).

This may be grounds for me to learn how to import libraries in Godot - as the standard library doesn't really have ways of dealing with this. Otherwise, I may be able to run the conversion myself. It's also possible to use C# (and I suppose, through that, just about any C-compatible language) - which gives us another option.

BTW, I played the final capumon version (and beat both opponents pretty easily.) Despite its tiny size, I liked the demo/game, mainly because the various mons intrigued me. I love them

pro tip: is there a limit on how much HP your mons can gain? regardless, if you have Sundrop in your team, you can use blinding/paralyzing attacks to keep opponents at bay while Sundrop's passive pumps up your mons' HP to convenient levels

edit: i can't stop thinking about them

Thanks a bunch, Eschar. And no - there is NO LIMIT. I made a 3 sundrop team and ended the fight with 300 health.

Eschar

  • Bay Watcher
  • hello
    • View Profile
Re: Can delphonso make a better game?
« Reply #184 on: December 31, 2021, 03:19:37 am »

Currently using an all-Sundrop team for fun. The Sundrop that I kept out of battle for most of the fight gathered up to 475 HP.

...is Sundrop's Refresh supposed to deal negative damage? it just did
« Last Edit: December 31, 2021, 03:21:24 am by Eschar »
Logged

delphonso

  • Bay Watcher
  • menaces with spikes of pine
    • View Profile
Re: Can delphonso make a better game?
« Reply #185 on: December 31, 2021, 04:18:15 am »

You've discovered the secret of Sundrop.

Edit: by now you probably know that the lady has a new team every time.
« Last Edit: December 31, 2021, 04:22:46 am by delphonso »
Logged

King Zultan

  • Bay Watcher
    • View Profile
Re: Can delphonso make a better game?
« Reply #186 on: December 31, 2021, 04:35:22 am »

Liking the sounds of new game, also I like how I'm used in the example.

Shitty is a fine name. Does it run in the family?
Yes I come from a long line of Shitties! Also how did you find this out, are you spying on me!?
Logged
The Lawyer opens a briefcase. It's full of lemons, the justice fruit only lawyers may touch.
Make sure not to step on any errant blood stains before we find our LIFE EXTINGUSHER.
but anyway, if you'll excuse me, I need to commit sebbaku.
Quote from: Leodanny
Can I have the sword when you’re done?

delphonso

  • Bay Watcher
  • menaces with spikes of pine
    • View Profile
Re: Can delphonso make a better game?
« Reply #187 on: December 31, 2021, 05:18:19 am »

Jesus fucking christ. print('%08X' % hash) works to get a hexidecimal (as a string). I always way over-think this stuff.

Something about you just screams, 'Shitty'. >:}

King Zultan

  • Bay Watcher
    • View Profile
Re: Can delphonso make a better game?
« Reply #188 on: January 01, 2022, 03:39:34 am »

Something about you just screams, 'Shitty'. >:}
Probably my award winning personality.
Logged
The Lawyer opens a briefcase. It's full of lemons, the justice fruit only lawyers may touch.
Make sure not to step on any errant blood stains before we find our LIFE EXTINGUSHER.
but anyway, if you'll excuse me, I need to commit sebbaku.
Quote from: Leodanny
Can I have the sword when you’re done?

delphonso

  • Bay Watcher
  • menaces with spikes of pine
    • View Profile
Re: Can delphonso make a better game?
« Reply #189 on: July 31, 2022, 11:08:24 pm »

Bugs are dead, long live the bugs!

I spent a few days trying to work out the math to draw an ellipse and randomly attach legs to it in different positions all pointed /out/ and also mirrored if on the left or right side of the body. Needless to say, I didn't achieve the dream, and the bugs were squashed under my boot - that is, booting a new OS, as I did many times and have certainly lost any files I might have had before (including that Smallhands PDF I was working on...for the third time now.)

Rouge.

A...uhh...red powder...made of...uhh...ferric materials...
*I squint at the back of my hand, the ink smudging under flop sweats*

Ah wait - Rogue.
Yes, a rogue-like, to be clear.

"What is a rogue-like?", asks no one, since we're all too familiar with the concept. Yes.

More importantly, I found this and this dude is a fan of DF, so shit, maybe I'll message them too. Now I'm a busy fella these days - what with the baby who puked all night last night, the wife, who was puked upon several times last night, a little dog, who managed to avoid the puke, a job at a kindergarten where I often encounter puke, and several succession games that I committed and just can't do because I'm too busy cleaning up puke. But hey, it's my summer holiday, babyyyy.

I've got one month, to be exact, so I'm going to do this tutorial and tutorialize what I'm doing for the lot of you and at the end of it, hopefully I'll have a little rogue-like worth being proud of. On top of that, if I finish it quick enough, we'll see how far I can extend it past what is in this tutorial, you know - add some random generation to the world or make a little world map to encounter the dungeons on (maybe a sort of...FTL format travelling system. Those seem all the rage these days.)

What am I looking for out of this?
Beyond dusting off the ol' coding skills, I'm also eager to learn about and implement classes/object-orient programming, as I believe rogue-likes tend to do well with that sort of structure, and honestly I know very little about how to use classes. 

I'd also like to put together a little sprite sheet ala curses and maybe extend it into a DF tileset that I start using. We'll see!

Anyway, I didn't sleep last night because of all that puke I mentioned, so I'm going to not do any coding today, but if the mood strikes, I'll read more of this tutorial. Wish me luck and I hope you all stick around to pitch ideas!

King Zultan

  • Bay Watcher
    • View Profile
Re: Can delphonso make a better game?
« Reply #190 on: August 01, 2022, 03:27:01 am »

Huzza your making a new game, and maybe one of the monsters could be puke based?
Logged
The Lawyer opens a briefcase. It's full of lemons, the justice fruit only lawyers may touch.
Make sure not to step on any errant blood stains before we find our LIFE EXTINGUSHER.
but anyway, if you'll excuse me, I need to commit sebbaku.
Quote from: Leodanny
Can I have the sword when you’re done?

Starver

  • Bay Watcher
    • View Profile
Re: Can delphonso make a better game?
« Reply #191 on: August 01, 2022, 09:02:29 am »

I spent a few days trying to work out the math to draw an ellipse and randomly attach legs to it in different positions all pointed /out/ and also mirrored if on the left or right side of the body. Needless to say, I didn't achieve the dream

Is something like this useful? Or this?

Probably not, as library functions do as much to get a quick render of a shape like an ellipse (even if not by the tightest and nattiest integer-maths you'd have been proud to have squeezed into your assembly code, in days of yore), and not just in axis-normal orientations (i.e. r<sub>x</sub> and r<sub>y</sub> being the key eccentricity indicators).

But if you're drawing by quadrant/octant, like that, you can decide to stop at any given ellipse-point, for a moment, and extrude the point outward from the origin into a radial 'leg'. And do that equally over left/right reflections (and/or front/back), with trivial integer pixel-hopping gradient mathematics, before plotting out more of the 'curve' until the jext opportune leg(s) position.


Not to draw you back into that sinkhole of academic curiosity, if you're now dabbling with the abstractions of OOP/etc. Although you could implement a 'fast' ellipse-drawing algorithm behind a class structure that you customise to render (or return) an arbitrary hybrid vector/raster data construct that can service a graphical output anywhere from SVG to ASCII Art... ;)

(Maybe once you've sorted your Ultimate Roguelike to your satisfaction, and/or your desire to become more disemetic again.)
« Last Edit: August 01, 2022, 09:04:17 am by Starver »
Logged

delphonso

  • Bay Watcher
  • menaces with spikes of pine
    • View Profile
Re: Can delphonso make a better game?
« Reply #192 on: August 03, 2022, 07:50:42 am »

I set down my 7th cup of coffee today.
"Hey stranger. I hear you're looking for roguelikes. Well tough luck, bub!"
I stand up from my desk abruptly. I promptly fall backwards, light-headed, reaching for an stable surface to support myself. My hand falls on a few lines of jagged, poorly copied code. You think you see a finger detach and fall to the floor.
"I ain't slept in 3 days, and I ain't plannin' to any time soon," I shout from the floor, my hand gushing blood that has the same viscosity as flat cola. "You wanna see some map generation? Well go fuck yourself!"
You begin backing out of the office.
"I'm on holiday! I'm RELAXING," you hear, as you lock the door behind you and leave.

So...map generation:

Rather than warming my toes by the fire of some softball, well-practiced code, I decided to dive into the hardest part of the roguelike projects: proc-genning maps. I've never done this before and really only have a tenuous understanding of how it works.

Bozar's tutorial does away with this problem easily by...not doing it, basically. The end result looks like this: with only the outside boarders and the square in the middle counting as "wall".


(taken directly from Bozar's Chapter 9)

So, I did a bit more searching and looked for a more interesting roguelike example to rip off tutorial.

I found Thoughtquake's tutorial to make something similar to Powder, a roguelike that I really enjoyed. Thoughtquake's tutorial is pretty short (a 40 minute video) and sort of blasts through things so it's a bit advanced for an absolute idiot like me. I was able to understand enough of their level generation code to rip it off, though, and got the following in a quick test:




Having only procgenned one map before (a 2-d wormsish thing), I was pretty happy with the result and better yet, I understood the code! However, I think this was the wrong direction. Let's start at the beginning. Make some shitty sprites and goons and then dig into the real shit: map gen.

I'm going to follow Bozar's tutorial until the end and see what I can implement from the Powder-like game which Thoughtquake put together.

That is, if I get any time to sleep or to focus on programming, which looks like is pretty light this week.
« Last Edit: August 03, 2022, 07:52:21 am by delphonso »
Logged

King Zultan

  • Bay Watcher
    • View Profile
Re: Can delphonso make a better game?
« Reply #193 on: August 04, 2022, 01:37:16 am »

So what kind of monsters are you thinking about for this game?
Logged
The Lawyer opens a briefcase. It's full of lemons, the justice fruit only lawyers may touch.
Make sure not to step on any errant blood stains before we find our LIFE EXTINGUSHER.
but anyway, if you'll excuse me, I need to commit sebbaku.
Quote from: Leodanny
Can I have the sword when you’re done?

delphonso

  • Bay Watcher
  • menaces with spikes of pine
    • View Profile
Re: Can delphonso make a better game?
« Reply #194 on: August 04, 2022, 01:44:06 am »

With little time: maybe the DF classics like a kobold, elf, etc. I'd love for them to be named as well, which shouldn't be too hard to do. Chesefeebus the kobold is just a few randomized word components.

With more time, I'd love to make a Forgotten Beast style boss who is randomly generated each game. We'll see how long it takes to get there.
Pages: 1 ... 11 12 [13] 14 15 ... 31