Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 570 571 [572] 573 574 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 906885 times)

DrunkGamer

  • Bay Watcher
  • Beer loving Gentledwarf
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8565 on: December 03, 2015, 07:26:29 pm »

Hello!

I'm a Lua coder (mostly because it's the first and only thing I learnt so far) and I have been playing around with Love2D to make a basic Roguelike.

Love2D is great, but I feel like it's not really the best for a game like this... I wish to know if any of you (Which is probably everyone) haves any recomendations for another different language for me to learn or maybe something that uses lua so I can start making something.

Bear with my stupidity, please, as I'm still pretty much new.
Logged

Orange Wizard

  • Bay Watcher
  • mou ii yo
    • View Profile
    • S M U G
Re: if self.isCoder(): post() #Programming Thread
« Reply #8566 on: December 03, 2015, 07:36:39 pm »

For my projects I'm using Python with libtcod, which is a roguelike library with lots of useful tools like pathfinding and Perlin noise.
If you don't care about the other stuff you could use PDCurses for just the ASCII stuff. Pygame (or other 2D library, but pygame is the best) would be great if you want more functionality (at the expense of time/effort/learning).

Obviously if you don't want to use Python then that's all irrelevant. I still recommend learning Python though.
Logged
Please don't shitpost, it lowers the quality of discourse
Hard science is like a sword, and soft science is like fear. You can use both to equally powerful results, but even if your opponent disbelieve your stabs, they will still die.

DrunkGamer

  • Bay Watcher
  • Beer loving Gentledwarf
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8567 on: December 03, 2015, 07:38:57 pm »

For my projects I'm using Python with libtcod, which is a roguelike library with lots of useful tools like pathfinding and Perlin noise.
If you don't care about the other stuff you could use PDCurses for just the ASCII stuff. Pygame (or other 2D library, but pygame is the best) would be great if you want more functionality (at the expense of time/effort/learning).

Obviously if you don't want to use Python then that's all irrelevant. I still recommend learning Python though.

I'm not really well versed on Python, so I might be awful wrong, but I heard it's way more resources consuming than any other language? I'll still look into it anyways.

I never managed to get libtcod working, but I guess I can try to make something semi-from scratch with it.

Thanks!
Logged

Orange Wizard

  • Bay Watcher
  • mou ii yo
    • View Profile
    • S M U G
Re: if self.isCoder(): post() #Programming Thread
« Reply #8568 on: December 03, 2015, 07:45:06 pm »

I'm not really well versed on Python, so I might be awful wrong, but I heard it's way more resources consuming than any other language? I'll still look into it anyways.
It's not that bad. Interpreted languages basically always use more memory and run slightly slower than compiled ones. You probably won't even notice on modern hardware unless you're planning something very resource intensive.
Logged
Please don't shitpost, it lowers the quality of discourse
Hard science is like a sword, and soft science is like fear. You can use both to equally powerful results, but even if your opponent disbelieve your stabs, they will still die.

breadman

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8569 on: December 03, 2015, 07:57:34 pm »

I'm not really well versed on Python, so I might be awful wrong, but I heard it's way more resources consuming than any other language? I'll still look into it anyways.

I never managed to get libtcod working, but I guess I can try to make something semi-from scratch with it.
[/quote]
More?   Usually, if you're comparing it to a compiled language.  Way more?  Not enough to outweigh the ease of development.  Any other language?  Not hardly; plenty of languages are far more resource-consuming than Python.

I used libtcod for a PyWeek entry, but ended up writing my own maze generator and line-of-sight algorithm for it.  I had initially planned a roguelike, before realizing that a week is not nearly enough time for the plans I had, particularly around a full-time job.

Sometime I should port that program to something easier for the layperson to run.  Perhaps something like Putnam's tile maze.
Logged
Quote from: Kevin Wayne, in r.g.r.n
Is a "diety" the being pictured by one of those extremely skinny aboriginal statues?

DrunkGamer

  • Bay Watcher
  • Beer loving Gentledwarf
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8570 on: December 03, 2015, 08:01:51 pm »

Hmh, I got some extremely basic Python knowledge, but I guess I'll start with some basic things first. Thanks for the replies!
Logged

EnigmaticHat

  • Bay Watcher
  • I vibrate, I die, I vibrate again
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8571 on: December 03, 2015, 08:07:32 pm »

I'm not really well versed on Python, so I might be awful wrong, but I heard it's way more resources consuming than any other language? I'll still look into it anyways.
It's not that bad. Interpreted languages basically always use more memory and run slightly slower than compiled ones. You probably won't even notice on modern hardware unless you're planning something very resource intensive.
Python runs SIGNIFICANTLY slower than other languages.  The figure I've heard is 4x faster to write, 10x slower to run.  But for a RL Python is pretty perfect; 10x basically instant is still basically instant.  You also have the option of using Cython if speed becomes a problem.
Logged
"T-take this non-euclidean geometry, h-humanity-baka. I m-made it, but not because I l-li-l-like you or anything! I just felt s-sorry for you, b-baka."
You misspelled seance.  Are possessing Draignean?  Are you actually a ghost in the shell? You have to tell us if you are, that's the rule

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8572 on: December 03, 2015, 08:33:46 pm »

I was about to give an example of Python's speed (Civ IV), but I realized one example doesn't really say anything. Sonic '06 uses Lua for basically everything and is slow as hell in a lot of places, but so does Metal Gear Solid V and that game is one of the most technically impressive I've ever seen.

In general, actually, I'd say Lua's a damn good language to learn. It's (fairly recently) become just about the most popular scripting language around. Memory hacking (DFHack, Bizhawk, Cheat Engine)? Lua. Game scripting (Civilization V, MGSV, Binding of Isaac: Rebirth given next version, Tales of Maj'Eyal, Angry Birds, L.A. Noire, Garry's Mod, WoW, Dota 2, holy shit there's a lot)? Lua. If you're into games, yeah, Lua's very good.
« Last Edit: December 03, 2015, 08:37:05 pm by Putnam »
Logged

DrunkGamer

  • Bay Watcher
  • Beer loving Gentledwarf
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8573 on: December 03, 2015, 08:45:00 pm »

I was about to give an example of Python's speed (Civ IV), but I realized one example doesn't really say anything. Sonic '06 uses Lua for basically everything and is slow as hell in a lot of places, but so does Metal Gear Solid V and that game is one of the most technically impressive I've ever seen.

In general, actually, I'd say Lua's a damn good language to learn. It's (fairly recently) become just about the most popular scripting language around. Memory hacking (DFHack, Bizhawk, Cheat Engine)? Lua. Game scripting (Civilization V, MGSV, Binding of Isaac: Rebirth given next version, Tales of Maj'Eyal, Angry Birds, L.A. Noire, Garry's Mod, WoW, Dota 2, holy shit there's a lot)? Lua. If you're into games, yeah, Lua's very good.

So basically stick with Lua? Even for Roguelikes?
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8574 on: December 03, 2015, 08:57:14 pm »

I didn't say that, I just said it's good to learn. I wouldn't stick with a language at all. I've had successful, released projects in Python, Lua and Javascript, working-as-intended-but-unreleased projects in C++ and C# and contributed to some Ruby stuff. Most of those are pretty C-like languages anyway. The only language of those I'd actually say I'm fluent in is Lua.
« Last Edit: December 03, 2015, 08:59:27 pm by Putnam »
Logged

breadman

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8575 on: December 04, 2015, 12:40:39 pm »

I didn't say that, I just said it's good to learn. I wouldn't stick with a language at all. I've had successful, released projects in Python, Lua and Javascript, working-as-intended-but-unreleased projects in C++ and C# and contributed to some Ruby stuff. Most of those are pretty C-like languages anyway. The only language of those I'd actually say I'm fluent in is Lua.

Indeed, use the right tool for the job.  If Love2D works for you, great!  If it's not working as well as you'd like, feel free to try something else.  Fortunately, the more languages you've learned, the easier it is to pick up a new one.  I've used between forty and fifty, though I only a handful on a regular basis.  In general, the libraries available matter almost as much as the language itself.  (Almost; CPAN isn't enough to get me back into Perl for more than simple text processing.  And that's after having used it for a day job.)  The environment can matter even more, as evidenced by Javascript.
Logged
Quote from: Kevin Wayne, in r.g.r.n
Is a "diety" the being pictured by one of those extremely skinny aboriginal statues?

itisnotlogical

  • Bay Watcher
  • might be dat boi
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8576 on: December 04, 2015, 02:47:46 pm »

Suppose I were to write a 2D array of bools (it's meant to represent a tilemap but there's only solid/non-solid blocks). Should I write each individual coordinate into the file and then read them back, or should I write them in-order and read them back in a one-dimensional way? I wish Game Maker could serialize objects like Unity, or even had a concept of "objects" more complex than it does. Sometimes Game Maker's narrow focus can be a bit limiting...
Logged
This game is Curtain Fire Shooting Game.
Girls do their best now and are preparing. Please watch warmly until it is ready.

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8577 on: December 04, 2015, 03:37:50 pm »

You can do it either way, and the relative value depends on relative number of filled blocks vs empty blocks. It also depends on how big your 2D array is. If it's over 256 wide/long that basically doubles the data needed to store the "coordinates" version (2 bytes per x/y rather than 1 byte per x/y).

Let's assume that you have x = 256, and y = 256, which is the biggest map you can have and still use 1 byte coordinates. writing each cell into the file as 1 byte, you'd have a 65536 byte file. On the other hand, if you write coordinates of only the "solid" tiles, you'd have a 2 x "solid" bytes file. So, if less than half your tiles were solid, this would save memory. Obviously, if you want maps that are over 256x256 then you need 2 bytes per x and y, so 4 bytes per tile, and the 2D array version becomes more cost-effective in comparison.

Optimizations:
- 2D array version: use bits rather than bytes, this reduces the 2D array version by a factor of 8.
- Coordinates version: store "blocks" e.g. x1,y1,x2,y2 and draw chunks of the map at once, rather than individual tiles

Another consideration if that if you stick to the "1 byte per tile" storage, than later you can extend the system to support different tile graphics. leave the lowest 1 bit as wall/floor and use the remaining bits to indicate which tile to use.
« Last Edit: December 04, 2015, 03:41:34 pm by Reelya »
Logged

jaked122

  • Bay Watcher
  • [PREFSTRING:Lurker tendancies]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8578 on: December 04, 2015, 03:40:24 pm »

I'd write  a format like
Code: [Select]
<width> <height>
<bools serialized to integers>

However, I suspect that Gamemaker won't work for that(and so much more)... But if you can't serialize arrays of bools like that, then I'd recommend looking at the netppm format as a starting point, as it is human readable and most languages with decent IO are able to read it without too much trouble.

That being said, I'd recommend moving away from gamemaker if at all possible. That's my preference though, and I honestly have no idea how much it has changed since I dabbled in it six or so years ago.

itisnotlogical

  • Bay Watcher
  • might be dat boi
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #8579 on: December 04, 2015, 04:10:41 pm »

I like Game Maker. Like any tool, it has strengths and weaknesses. I quite enjoy that you can reference any resource by just typing its name in your code, as opposed to passing references and typing a million getComponent() lines as in Unity. But then, as is my problem now, Game Maker has rather limited file IO capabilities.
Logged
This game is Curtain Fire Shooting Game.
Girls do their best now and are preparing. Please watch warmly until it is ready.
Pages: 1 ... 570 571 [572] 573 574 ... 796