Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 20 21 [22] 23 24 ... 31

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

delphonso

  • Bay Watcher
  • menaces with spikes of pine
    • View Profile
Re: Can delphonso make a commercial game?
« Reply #315 on: January 01, 2023, 06:50:15 am »

So you can't just add that stuff to your existing game?

Also exciting sounding new game you've decided to make.

Not really. This is basically a write-from-scratch situation.

I could do the saving thing with the game that I already have, but then I wouldn't have the opportunity to learn new and useless skills like A* pathfinding  8)


Getting started now - just reading up on some similar projects that are open source.

EDIT: Not worth a full post - gotta prepare everything before I even start using tilemaps

I decided not to just cut corners on everything right from the get-go. I put a little time into the main menu and managed to achieve the level of Newgrounds in the late 2000s.



Nothing particularly special here - I'm using a particle emitter to drop all those single-pixels and generate snow.
The background is from OpenGameArt and the font is a free one from Dafont.



just buttons, rectangles and labels so far. Not even a script to hook it up to a game.



But I did discover I can replace the particles with sprites. This gave me just a bit of joy at the end of a long day.
« Last Edit: January 01, 2023, 07:33:52 am by delphonso »
Logged

Eschar

  • Bay Watcher
  • hello
    • View Profile
Re: Can delphonso make a commercial game?
« Reply #316 on: January 01, 2023, 12:52:15 pm »

It's raining (snow)men

Cool start
Logged

King Zultan

  • Bay Watcher
    • View Profile
Re: Can delphonso make a commercial game?
« Reply #318 on: January 02, 2023, 02:57:43 am »

Snowing Snowmen an exciting way to start off a 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 commercial game?
« Reply #319 on: January 02, 2023, 08:10:58 am »

Presenting:
An update about how to learn something you know nothing about.


Topic 1: A* Pathfinding

So. A* pathfinding is how you get things to move on a grid. I don't know why it's called A Star, but I do know that it uses a Szudzik function to find the shortest path between two points (well, the shortest to travel).

If I'm remembering a random video I watched on youtube once correctly, a Szudzik function keeps track of all pathing options until it reaches the goal, then only processes the paths which could potentially be less than the first successful path (thus doing none of the unnecessary calculations to test every single path on the map.)

Now to do that programmatically...well. I have no fucking clue.

There's two good bits of luck at play here, though.

First, this is Godot and Godot is good.
Here we have the documentation on the AStar object (2D and there's also a generic, 3D version). Even without much programming experience you can see there's methods for "compute_cost", "add_point" and "get_point_path". That seems like all the tools I need. Now, if only I could find an example...

Oh! The second bit!
Excellent youtube tutorial guy and dreamboat Heartbeast has specifically an A* pathing tutorial. Better yet, his code is open source under an MIT license, so I could just use it if I want. Let's take a look at the project to get an idea of what we'd need to do if I were to do it on my own.



So here we have a simple map. Floor, a pawn and then walls. Upon running the game, it runs the A* process to determine all possible paths on the map (keeping track of all "points" (read, squares) on the grid.



Pressing Enter toggles the path-grid as visible or not.

Finally, clicking on a square allows you to reveal the path the character would take.



The pawn doesn't move, however I know that this path is just a array of coordinates, so it should be easy to either have them walk the path, or just teleport to the end.

So, what's the issue?

Well, basically this:



Check that line counter on the left. 250 lines of someone else's uncommented code. With the video to rely on, I should be able to fully understand the code given enough time and effort. And here's a fork in the road for me.

I can either take this seriously and actually put in time/focus to become a better dev, or I can figure out just enough to scoot by and get this task done.

This is honestly a tough decision for me.

The grid-based pathfinding is where I've always stopped these types of projects. And this is a real shame, because these are some of my favorite games, and I've always wanted to make one of my own. I even went so far as making about 20 8-bit sprites of insects/vermin as part of a tactics game that was abandoned at the grid-based pathfinding back in 2020. And game-dev is a hobby I really like. I'm proud of Sewer Kings, which is honestly a strange feeling. I've written and drawn for over a decade and rarely made anything I didn't see full of flaws and holes and yet here I see my 3rd ever real game and it's like "wow, I can't believe I was the one who made this."

But on the other side of the coin...

                      I'm pretty fucking lazy.

*copies and pastes the script into my game and moves on*

brewer bob

  • Bay Watcher
  • euphoric due to inebriation
    • View Profile
Re: Can delphonso make a commercial game?
« Reply #320 on: January 02, 2023, 09:24:39 am »

Pathfinding is some kind of foul sorcery I never understood.

...But then again I don't know anything about coding (unless some dabbling in BASIC and Turbo Pascal ages ago counts) and am not such a smart person.

Edit.
*copies and pastes the script into my game and moves on*

Good choice! I would've done the same.

bloop_bleep

  • Bay Watcher
    • View Profile
Re: Can delphonso make a commercial game?
« Reply #321 on: January 02, 2023, 05:50:47 pm »

A* isn't too difficult. The 250 lines are probably for the graphical overlay. You should be able to accomplish it in about 50 lines.
Logged
Quote from: KittyTac
The closest thing Bay12 has to a flamewar is an argument over philosophy that slowly transitioned to an argument about quantum mechanics.
Quote from: thefriendlyhacker
The trick is to only make predictions semi-seriously.  That way, I don't have a 98% failure rate. I have a 98% sarcasm rate.

Starver

  • Bay Watcher
    • View Profile
Re: Can delphonso make a commercial game?
« Reply #322 on: January 02, 2023, 06:59:49 pm »

So. A* pathfinding is how you get things to move on a grid. I don't know why it's called A Star, but I do know that it uses a Szudzik function to find the shortest path between two points (well, the shortest to travel).
The way I heard it, in the search for a good pathfinder they tried Algorithm version 1 (A1), then Algorithm version 2 (A2), then they decided that they could prove A2 was the optimal of all possible A-type algorithms, so they renamed it "A*" as being "the best and entirety of all 'A's, of whatever version..." (though, by tweaking A*, you can even get a version of Dijkstra's algorithm, should you so wish[1]).

This may be apocryphal. I've seen other less exciting (FCVO!) but possibly more mundanely possible reasons given, too.  :P

[1] ObxkcdReference: https://xkcd.com/342/ ;)
Logged

delphonso

  • Bay Watcher
  • menaces with spikes of pine
    • View Profile
Re: Can delphonso make a commercial game?
« Reply #323 on: January 02, 2023, 10:12:28 pm »

Pathfinding is some kind of foul sorcery I never understood.

Apparently, I'm getting a grasp of it. But yeah, it's certainly a hurdle. It's one of those things that is so clearly /computer-y/. Humans, with our super-processor brains, can do the whole path-finding thing in our sleep, but for computers, they've got to check every possible path, because there's no intuition or heuristics at play. All the more efficient path-finding methods just do the barest minimum to not check every possible path.

I wonder if there's any cases of brain damage or disease that causes people to lose their pathfinding capabilities. Just climbing over the check-outs to get to the milk in the shop.

A* isn't too difficult. The 250 lines are probably for the graphical overlay. You should be able to accomplish it in about 50 lines.

Yeah. I read through all the code and could probably cut it down to about 100 lines. It comes with some additional stuff that is Godot specific (adding exit code to units so they can clear themselves from the map without needing additional code) and includes several variations - there's pathing code for just pathing, for pathing around obstacles, and pathing around obstacles and units. Obviously, I'll only need one of those.

The way I heard it, in the search for a good pathfinder they tried Algorithm version 1 (A1), then Algorithm version 2 (A2), then they decided that they could prove A2 was the optimal of all possible A-type algorithms, so they renamed it "A*" as being "the best and entirety of all 'A's, of whatever version..." (though, by tweaking A*, you can even get a version of Dijkstra's algorithm, should you so wish[1]).

I love how dumb that is. It was actually the Dijkstra's algorithm that I was thinking of before. In the code there's both a Cantor and Szudzik algorithm, however Szudzik is what I'll be going with.

Here's a write up on them both for those interested.

Okay.

Topic 1: A* Pathfinding, Continued

I spent most of last night and a good portion of this morning pouring over Heartbeast's code and commenting it myself. I think I have a decent grasp of how the algorithms in this work, and what tweaks I can make.

It's pretty elegant, though the code is...how to say? It's very Python. There are a lot of functions which perform only one method - I would have just put them in the main function, but I will admit that this did help chunk it up and make it more digestible for me.

When the game starts, an AStar object is created and filled with all the points on the map. It also keeps track of a list of obstacle points and player position points. The pathing grid that is shown is actually not all of what was processed, but an updated one which ignores units and obstacles.

This is all taken from a "board" object, which is the tilemap. I will use this same method for making the map of this little game. I could probably achieve this with random map generation (using the walker algorithm from Sewer Kings, or learning to use cellular autonoma, but I don't particularly want to bloat this project any more than I already have.) There is also an issue with this algorithm - if you choose a point that is inaccessible, it will explore all options that /are/ accessible before figuring out that there is no path. This means if I make a giant XCOM-style map, and if there's any regions that are inaccessible, then the processing time would bloat incredibly when you clicked on those inaccessible places. This is mostly just a note for myself for later.

The walls are actually indexed by group. Godot allows you to add such a property to any node. This means I can use a variety of things for cover (trees, snowmen, and rocks) but process them all the same way when it comes to path-finding.

After establishing the grid, it's just a simple check for where you clicked, then drawing a line to that point. Heartbeast built in several expected functions. For instance, I can limit the distance (obviously would call from a character's move-speed):



Clicking past 6 tiles just paths to the 6th tile and then ends.

I can also keep track of the line, and move the character to that point.





Basically, this is all I'll need to make a tactics game. It will require some polish and customization, but I think I'm at the right point to move on. My comments on the code pushed it to about 300 lines of code. I should be able to cut large swaths of it, because there are a lot of redundant/unused functions and some that are specifically for different types of games.

Figuring out line of sight and shooting is going to be tough, because I won't be able to reuse this code to do it. But it should be possible to check if a straight line from the attacker to the target meets an obstacle. There might be some issue here because of unit differences. The grid is calculated based on the tilemap size (64x64 here).

Also a note on the resource-based saving. The Resource files, I mentioned, are written in plaintext and are loaded as plain text into the game. I'm fine with people finding them and setting their strength to 10,000 or something, but there is an issue when it comes to running executable code...You can get the OS to perform stuff by injecting code into the save and have Godot execute that upon load. I'll find a way to hash it and unhash it or something.

King Zultan

  • Bay Watcher
    • View Profile
Re: Can delphonso make a commercial game?
« Reply #324 on: January 03, 2023, 04:46:22 am »

So far it looks like a chess game with guns to be added.


Sounds exciting I wonder if that means the pawn will finally be able to topple the king?
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?

Eschar

  • Bay Watcher
  • hello
    • View Profile
Re: Can delphonso make a commercial game?
« Reply #325 on: January 03, 2023, 11:27:00 am »

Finally, Chess 2.
Logged

Starver

  • Bay Watcher
    • View Profile
Re: Can delphonso make a commercial game?
« Reply #326 on: January 03, 2023, 11:57:21 am »

Finally, Chess 2.
You remind me of Battle Chess... Although I feel safe exposing this directly in front of our Friendly Neighbourhood Developer as that was just regular chess with 'fancy' (for the time, arguably) animations and not any next-level(/-dimension) expansion.

But I'll stop myself before I blurt out my own Chess: The Next Generation ideas. At best, I'll swing delphonso's development arc away from the already planned one, at worst I'll actually guess what's going to happen and make it look like I swayed things. ;)


(Guessing that the Chessness is just handy graphics, though. An understandable placeholder theme.)
Logged

delphonso

  • Bay Watcher
  • menaces with spikes of pine
    • View Profile
Re: Can delphonso make a commercial game?
« Reply #327 on: January 04, 2023, 12:38:43 am »

So far it looks like a chess game with guns to be added.

Sounds exciting I wonder if that means the pawn will finally be able to topple the king?


(Guessing that the Chessness is just handy graphics, though. An understandable placeholder theme.)

This is correct, it's just the placeholders that Heartbeast used, I'm pretty sure they're from Kenney, who is a great artist who makes a lot of free assets for amateur game devs.

I don't have much to show at this point. Yesterday I put together the tilemap and built the game world:



Today, I'm far too hungover to code.

You remind me of Battle Chess... Although I feel safe exposing this directly in front of our Friendly Neighbourhood Developer as that was just regular chess with 'fancy' (for the time, arguably) animations and not any next-level(/-dimension) expansion.
I loved Battle Chess as a kid.

Finally, Chess 2.

The Sequel
(this actually looks pretty neat)
« Last Edit: January 04, 2023, 07:34:50 am by delphonso »
Logged

King Zultan

  • Bay Watcher
    • View Profile
Re: Can delphonso make a commercial game?
« Reply #328 on: January 04, 2023, 02:34:43 am »

Oh god it's snowman VS snowman, it's gonna be snowmageddon!
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 commercial game?
« Reply #329 on: January 04, 2023, 08:01:35 am »

Hmm. Alright, I tried briefly to run the pathfinding debug script on the game I made and here's the notes:

First, it didn't work at all (except it did take the dimensions from the tilemap (16x16 instead of 32x32 in the example) so there's that.



I set the debug lines to red so I can actually see them. Here we have some interesting issues.

First, the editor, though using 16x16 sprites was actually in 8x8 units, so that's why the grid is perfectly aligned with some things, but not perfectly aligned with some others (the snowman in the top-right). The pathing lines just cover the entire map. So...why?

Well, I thought I had solved it. It was a simple capitalization error on my part - 'Units' instead of 'units'. A quick fix later and...



What the fuck, guys?

Obviously it's no coincidence that the only obstacle that is actually caught is the one that is slightly off the 16x16 grid. I'll figure this out tomorrow.
Pages: 1 ... 20 21 [22] 23 24 ... 31