Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 228 229 [230] 231 232 ... 796

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

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3435 on: November 09, 2012, 11:10:19 am »

Also, new version! Entity interactions! Also, enemies! Walking thingies that fall off platforms, and walking thingies that don't! If you walk into them, you die. If you land on them, you bounce! Also, the window is now resizable by changing the window size in the options menu and restarting.

Found it completely unplayable this time around. Extremely laggy. Even getting past the opening menu was a pain. And I had some difficulty getting it to even run /at all/, which is odd, since it worked find last time - I had to manually execute it via the command line within a java context.

Not sure entirely what's going on.

I guess you use Windows, because it's slightly laggy for me there too (I have no idea why), it only works lag-free on my Linux partition. Also, I guess that the double-click annoyance is because it needs the data directory path now (which it generates from the CWD path), and double-clicking doesn't set the CWD correctly. Let's see if I can work around these things.

how do I store stuff in a .txt file with python?
I tried this:
Code: [Select]
        score_file = open('highscores.txt', 'w')
        score_file.write(username + score)
        score_file.close()

That didn't work. The file is still empty.

Try converting to a string first?
Logged

Dutchling

  • Bay Watcher
  • Ridin' with Biden
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3436 on: November 09, 2012, 11:11:22 am »

Editing should give a ninja warning :P.
Logged

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3437 on: November 09, 2012, 11:11:51 am »

Worked fine under WinXP, for me, but that was on a pretty fast i7.
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

Dutchling

  • Bay Watcher
  • Ridin' with Biden
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3438 on: November 09, 2012, 11:27:40 am »

I assume the only way to edit a .txt is to open the whole file, change what you get, and save the whole thing again?
Logged

GlyphGryph

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3439 on: November 09, 2012, 11:28:36 am »

I guess you use Windows, because it's slightly laggy for me there too (I have no idea why), it only works lag-free on my Linux partition. Also, I guess that the double-click annoyance is because it needs the data directory path now (which it generates from the CWD path), and double-clicking doesn't set the CWD correctly. Let's see if I can work around these things.

'nix, actually. So it's definitely not just a windows thing. And my computer isn't bad, either.

Quote from: Dutchling
I assume the only way to edit a .txt is to open the whole file, change what you get, and save the whole thing again?
You can actually append to the end of the file too without resaving the whole thing.
Logged

Dutchling

  • Bay Watcher
  • Ridin' with Biden
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3440 on: November 09, 2012, 11:42:56 am »

How exactly? score_file.append() does, as I expected, not work.
Logged

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3441 on: November 09, 2012, 11:55:08 am »

How exactly? score_file.append() does, as I expected, not work.

You have to open the file in append mode:

Code: [Select]
score_file = open('highscores.txt', 'a')
Logged

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3442 on: November 09, 2012, 12:23:07 pm »

'nix, actually. So it's definitely not just a windows thing. And my computer isn't bad, either.

This is something that is very weird. Exactly how bad is it (The lag, not your computer)?
Logged

GlyphGryph

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3443 on: November 09, 2012, 02:11:25 pm »

Extremely. It's difficult even getting through the opening menu, and the game is entirely unplayable.

The fact that the opening MENU almost locks up is a preeeetty good sign there's something wonky going on in your code.
Logged

Euld

  • Bay Watcher
  • There's coffee in that nebula ಠ_ರೃ
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3444 on: November 09, 2012, 03:01:25 pm »

So I've been following project CLANG, a Kickstarter whose goal is to make a real one-to-one sword fighting simulator.  They just sent an email from one of their "animators" (sounds more like a programmer?) about their process so far of getting a computer to understand sword-related inputs.  I'll post it here, 'cause well... I'm curious if anyone can put this in laymen's terms.

Spoiler: Wall 'o text (click to show/hide)

Dutchling

  • Bay Watcher
  • Ridin' with Biden
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3445 on: November 09, 2012, 04:42:52 pm »

I'm thinking of downloading PyGame, but it seems like their latest version is 3.2.0, while I use Python 3.3.0.
Does this even remotely matter?


editt: I have some sort of ebook of questionable quality now. Expect less question. And with less I mean more.
« Last Edit: November 09, 2012, 04:58:36 pm by Dutchling »
Logged

GlyphGryph

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3446 on: November 09, 2012, 05:55:29 pm »

Haha! Finally! Dear god this took me way too long, but I finally did it.

Here's my first custom map with my crappy mapmaker tool! Note that you yourselves won't be able to make apps unless you download the code (though I believe saving both those pages should get it all) and replace the map1.json file contents with the output given to you by the mapmaker.

But I've got something working, so wooh! (Obviously, the sprites are not yet being included in the mapmaking process)

www.test.glyphgryph.com/main.html
www.test.glyphgryph.com/mapmaker.html
Logged

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3447 on: November 09, 2012, 09:21:01 pm »

In which case, I suggest beginning by growing out from the towns in a simple circle. I assume you already have resources and such in the world nailed down. As the circles of influence (just use some fuzzy-logic stuffs for those) envelope valuable resources, begin expanding in a circle from those as well (also assuming said resources would be easily realized and/or exploited; for hidden resources which don't come into play early on, just ignore them until the population realizes their value). These valuable resources include both natural and man-made resources; count any roads with high or valuable traffic (roads connecting towns, roads connecting towns & resources, respectively) as resources in themselves, growing out from them as well. Vary rates of growth based on how valuable any given resources would be.
While I appreciate the gesture, I think you kind of missed the point of the exercise. I am not playing around with populations and resources or anything of that nature. I am attempting to generate land mass in a way that forces a certain progression. To do this I am going to generate blots of land, then have obstacles connecting them that require some item or upgrade to solve, à la Zelda II.

To generate these land masses, I first require a way to make natural looking blots that I can control the size of.

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3448 on: November 09, 2012, 09:33:23 pm »

Also, new version! Entity interactions! Also, enemies! Walking thingies that fall off platforms, and walking thingies that don't! If you walk into them, you die. If you land on them, you bounce! Also, the window is now resizable by changing the window size in the options menu and restarting.
Works pretty much fine for me. No lag except ephemerally while on moving platforms.
Windows 7, good budget laptop.

EDIT: Dammit, meant to edit, not double post. Ah well, what ever.

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3449 on: November 11, 2012, 06:26:27 pm »

The most complicated way of getting random numbers yet, did render me some cool element and mineral names:
Code: [Select]
int NMaterialManager::getRandomInt(const int& seed, const int& max){
  boost::mt19937 gener(seed);  // Mersenne twister
  boost::uniform_smallint<> normal(0,max-1); // uniform distribution optimised for small integer ranges
  boost::variate_generator<boost::mt19937&,boost::uniform_smallint<> > rng(gener, normal); // Variatic generator combining the two
  return rng(); // Finally, a number.
}

Spoiler (click to show/hide)
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))
Pages: 1 ... 228 229 [230] 231 232 ... 796