• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 08:18
CET 14:18
KST 22:18
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
RSL Revival - 2025 Season Finals Preview8RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12
Community News
ComeBackTV's documentary on Byun's Career !8Weekly Cups (Dec 8-14): MaxPax, Clem, Cure win4Weekly Cups (Dec 1-7): Clem doubles, Solar gets over the hump1Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2BGE Stara Zagora 2026 announced15
StarCraft 2
General
When will we find out if there are more tournament ComeBackTV's documentary on Byun's Career ! Weekly Cups (Dec 8-14): MaxPax, Clem, Cure win RSL Revival - 2025 Season Finals Preview Weekly Cups (Dec 1-7): Clem doubles, Solar gets over the hump
Tourneys
Winter Warp Gate Amateur Showdown #1 Sparkling Tuna Cup - Weekly Open Tournament $5,000+ WardiTV 2025 Championship RSL Offline Finals Info - Dec 13 and 14! Master Swan Open (Global Bronze-Master 2)
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 504 Retribution Mutation # 503 Fowl Play Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress
Brood War
General
Klaucher discontinued / in-game color settings BGH Auto Balance -> http://bghmmr.eu/ How Rain Became ProGamer in Just 3 Months FlaSh on: Biggest Problem With SnOw's Playstyle screp: Command line app to parse SC rep files
Tourneys
Small VOD Thread 2.0 [Megathread] Daily Proleagues [BSL21] WB SEMIFINALS - Saturday 21:00 CET [BSL21] RO8 - Day 2 - Sunday 21:00 CET
Strategy
Simple Questions, Simple Answers Game Theory for Starcraft Current Meta Fighting Spirit mining rates
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Mechabellum PC Games Sales Thread Path of Exile
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas Survivor II: The Amazon Sengoku Mafia TL Mafia Community Thread
Community
General
Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine US Politics Mega-thread The Games Industry And ATVI YouTube Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
TL+ Announced Where to ask questions and add stream?
Blogs
The (Hidden) Drug Problem in…
TrAiDoS
I decided to write a webnov…
DjKniteX
James Bond movies ranking - pa…
Topin
Thanks for the RSL
Hildegard
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1551 users

The Big Programming Thread - Page 802

Forum Index > General Forum
Post a Reply
Prev 1 800 801 802 803 804 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
TanGeng
Profile Blog Joined January 2009
Sanya12364 Posts
November 23 2016 15:18 GMT
#16021
lol
Moderator我们是个踏实的赞助商模式俱乐部
Manit0u
Profile Blog Joined August 2004
Poland17540 Posts
November 23 2016 16:01 GMT
#16022
On November 24 2016 00:15 tofucake wrote:
[image loading]

some of our devs need to learn how to manage their queries :\


That seems really small compared to what I deal with on a daily basis... One page doing 1.6mil requests in 21 seconds, another one doing 3 requests in 39 seconds...
Time is precious. Waste it wisely.
emperorchampion
Profile Blog Joined December 2008
Canada9496 Posts
November 23 2016 16:13 GMT
#16023
On November 23 2016 16:16 Acrofales wrote:
Show nested quote +
On November 23 2016 13:23 WarSame wrote:
I'm making a dungeon game and my trolls around running around like they're on meth. I can't figure out how to calm them down. This is in pygame.

The heartbeat:
    def run_game(self):
# Heartbeat
while not (self.game_over or self.level.player.is_dead):
self.handle_events()
self.move_creatures()
self.draw_screen()
pygame.time.wait(100)
self.end_game()


where draw_screen is
    def draw_screen(self):
# Update game visuals
self.screen.fill((0, 0, 0))
self.draw_blocks()
pygame.display.flip()
self.clock.tick(60)


The problem is that I can make the trolls slow down by increasing the wait time between game cycles, but then the player moves too slowly. I'm looking for a fair way to slow down how frequently the trolls move. Any ideas?


I believe the solution is:
self.remove_meth()





If only that worked IRL :/
TRUEESPORTS || your days as a respected member of team liquid are over
Cyx.
Profile Joined November 2010
Canada806 Posts
November 23 2016 16:46 GMT
#16024
On November 23 2016 13:23 WarSame wrote:
I'm making a dungeon game and my trolls around running around like they're on meth. I can't figure out how to calm them down. This is in pygame.

The heartbeat:
    def run_game(self):
# Heartbeat
while not (self.game_over or self.level.player.is_dead):
self.handle_events()
self.move_creatures()
self.draw_screen()
pygame.time.wait(100)
self.end_game()


where draw_screen is
    def draw_screen(self):
# Update game visuals
self.screen.fill((0, 0, 0))
self.draw_blocks()
pygame.display.flip()
self.clock.tick(60)


The problem is that I can make the trolls slow down by increasing the wait time between game cycles, but then the player moves too slowly. I'm looking for a fair way to slow down how frequently the trolls move. Any ideas?

Maybe I'm misunderstanding this, but I think what you want to do is often done by measuring how much time has passed since the last frame, and passing that value into your `move_creatures()`. Then you can scale that by movement speeds to get movement amounts:

last_time = pygame.time.get_time()
while not game_over:
time = pygame.time.get_time()
dt = time - last_time
self.move_creatures(dt)
last_time = time

// ...

def move_creatures(dt):
for c in self.creatures:
c.position += c.velocity * dt;
Manit0u
Profile Blog Joined August 2004
Poland17540 Posts
November 23 2016 16:59 GMT
#16025
Have you tried tinkering with the frames? If I remember correctly you can speed up/slow down the game via the frames setting.
Time is precious. Waste it wisely.
tofucake
Profile Blog Joined October 2009
Hyrule19178 Posts
November 23 2016 17:50 GMT
#16026
On November 24 2016 01:01 Manit0u wrote:
Show nested quote +
On November 24 2016 00:15 tofucake wrote:
[image loading]

some of our devs need to learn how to manage their queries :\


That seems really small compared to what I deal with on a daily basis... One page doing 1.6mil requests in 21 seconds, another one doing 3 requests in 39 seconds...

Yeah but 7 million people doing it on the landing page after login :|
Liquipediaasante sana squash banana
Acrofales
Profile Joined August 2010
Spain18154 Posts
November 23 2016 19:17 GMT
#16027
On November 24 2016 02:50 tofucake wrote:
Show nested quote +
On November 24 2016 01:01 Manit0u wrote:
On November 24 2016 00:15 tofucake wrote:
[image loading]

some of our devs need to learn how to manage their queries :\


That seems really small compared to what I deal with on a daily basis... One page doing 1.6mil requests in 21 seconds, another one doing 3 requests in 39 seconds...

Yeah but 7 million people doing it on the landing page after login :|

I hardly ever visit the landing page. Does that solve your problem?
tofucake
Profile Blog Joined October 2009
Hyrule19178 Posts
November 23 2016 19:32 GMT
#16028
On November 24 2016 04:17 Acrofales wrote:
Show nested quote +
On November 24 2016 02:50 tofucake wrote:
On November 24 2016 01:01 Manit0u wrote:
On November 24 2016 00:15 tofucake wrote:
[image loading]

some of our devs need to learn how to manage their queries :\


That seems really small compared to what I deal with on a daily basis... One page doing 1.6mil requests in 21 seconds, another one doing 3 requests in 39 seconds...

Yeah but 7 million people doing it on the landing page after login :|

I hardly ever visit the landing page. Does that solve your problem?

On our website you have to login to see anything (it's a reimbursement program thing) so everyone always sees the landing page.
Liquipediaasante sana squash banana
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
November 23 2016 19:39 GMT
#16029
On November 24 2016 01:46 Cyx. wrote:
Show nested quote +
On November 23 2016 13:23 WarSame wrote:
I'm making a dungeon game and my trolls around running around like they're on meth. I can't figure out how to calm them down. This is in pygame.

The heartbeat:
    def run_game(self):
# Heartbeat
while not (self.game_over or self.level.player.is_dead):
self.handle_events()
self.move_creatures()
self.draw_screen()
pygame.time.wait(100)
self.end_game()


where draw_screen is
    def draw_screen(self):
# Update game visuals
self.screen.fill((0, 0, 0))
self.draw_blocks()
pygame.display.flip()
self.clock.tick(60)


The problem is that I can make the trolls slow down by increasing the wait time between game cycles, but then the player moves too slowly. I'm looking for a fair way to slow down how frequently the trolls move. Any ideas?

Maybe I'm misunderstanding this, but I think what you want to do is often done by measuring how much time has passed since the last frame, and passing that value into your `move_creatures()`. Then you can scale that by movement speeds to get movement amounts:

last_time = pygame.time.get_time()
while not game_over:
time = pygame.time.get_time()
dt = time - last_time
self.move_creatures(dt)
last_time = time

// ...

def move_creatures(dt):
for c in self.creatures:
c.position += c.velocity * dt;

The creatures all move discrete distances. They have a speed, such as 1 or 2, and move that many squares per turn. Otherwise, yeah, that would make sense.

On November 24 2016 01:59 Manit0u wrote:
Have you tried tinkering with the frames? If I remember correctly you can speed up/slow down the game via the frames setting.

Yup. The frame rate is set to a maximum of 60 FPS, and it runs at that on my computer. If I lower that, then they move slower, but the player also now can move multiple times per draw. So I'm looking for a way to slow only the trolls down, without effecting the rest of the game, if that's possible.

On November 23 2016 13:49 meatpudding wrote:
Show nested quote +
On November 23 2016 13:23 WarSame wrote:
I'm making a dungeon game and my trolls around running around like they're on meth. I can't figure out how to calm them down. This is in pygame.

The heartbeat:
    def run_game(self):
# Heartbeat
while not (self.game_over or self.level.player.is_dead):
self.handle_events()
self.move_creatures()
self.draw_screen()
pygame.time.wait(100)
self.end_game()


where draw_screen is
    def draw_screen(self):
# Update game visuals
self.screen.fill((0, 0, 0))
self.draw_blocks()
pygame.display.flip()
self.clock.tick(60)


The problem is that I can make the trolls slow down by increasing the wait time between game cycles, but then the player moves too slowly. I'm looking for a fair way to slow down how frequently the trolls move. Any ideas?


Lots of ways to do this. In move_creatures you could add a counter like this
counter += 1
if counter < threshold: return
# reset the counter
counter = 0
...
# actual code here

This seems like a possibility. I'll give it a shot. Thanks!
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2016-11-23 20:22:10
November 23 2016 20:21 GMT
#16030
On November 23 2016 23:17 Nesserev wrote:
SMALL RANT
I'm really frustrated with the 4th Edition of 'The C++ Programming Language' by Bjarne Stroustrup. I loved the Special Edition, but it seems like the magic was lost a bit in this edition, and there's one thing that really fcking triggers me...

Uniform initialization... AKA ugly squiggly braces from hell... they're fucking ugly as shit, and the book is full of it.

This might sound dumb and shit, but it really ruins an otherwise perfectly good book for me.
END OF RANT


I actually really like the way C++ uses initialization lists. Everyone I show is like, whoa, neat, and it's very clear what its purpose is IMO. Also getting more usage in C++17 too so it's basically here to stay. What's wrong with the book?
There is no one like you in the universe.
Manit0u
Profile Blog Joined August 2004
Poland17540 Posts
November 23 2016 20:49 GMT
#16031
On November 24 2016 05:21 Blisse wrote:
Show nested quote +
On November 23 2016 23:17 Nesserev wrote:
SMALL RANT
I'm really frustrated with the 4th Edition of 'The C++ Programming Language' by Bjarne Stroustrup. I loved the Special Edition, but it seems like the magic was lost a bit in this edition, and there's one thing that really fcking triggers me...

Uniform initialization... AKA ugly squiggly braces from hell... they're fucking ugly as shit, and the book is full of it.

This might sound dumb and shit, but it really ruins an otherwise perfectly good book for me.
END OF RANT


I actually really like the way C++ uses initialization lists. Everyone I show is like, whoa, neat, and it's very clear what its purpose is IMO. Also getting more usage in C++17 too so it's basically here to stay. What's wrong with the book?


I agree that uniform initialization actually makes C++ a lot more concise and the code easier to write and follow. I see nothing wrong with that.
Time is precious. Waste it wisely.
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
Last Edited: 2016-11-24 05:19:29
November 24 2016 05:17 GMT
#16032
--- Nuked ---
Manit0u
Profile Blog Joined August 2004
Poland17540 Posts
Last Edited: 2016-11-24 13:23:35
November 24 2016 13:23 GMT
#16033

public static function bool2int($variable) {
if ($variable === TRUE) {
$result = (int) $variable;
} else if ($variable === FALSE) {
$result = (int) $variable;
} else {
$result = null;
}
return $result;
}


Kill me...
Time is precious. Waste it wisely.
icystorage
Profile Blog Joined November 2008
Jollibee19350 Posts
November 24 2016 13:38 GMT
#16034

if ($variable === TRUE) {
$result = (int) $variable;
} else if ($variable === FALSE) {
$result = (int) $variable;


sweet baby jesus
LiquidDota StaffAre you ready for a Miracle-? We are! The International 2017 Champions!
BluzMan
Profile Blog Joined April 2006
Russian Federation4235 Posts
November 24 2016 21:49 GMT
#16035
On November 24 2016 14:17 Nesserev wrote:
Show nested quote +
On November 24 2016 05:21 Blisse wrote:
I actually really like the way C++ uses initialization lists. Everyone I show is like, whoa, neat, and it's very clear what its purpose is IMO. Also getting more usage in C++17 too so it's basically here to stay. What's wrong with the book?

There's nothing wrong with the book, and I don't mind when initializer lists are used for actual "lists" (e.g. vectors, strings, etc.). But I genuinely dislike the use of the first line over the second.
int i {0};
int i = 0;

And the book is full of lines like the first one... that's all. This just feels so unnecessary... it's the only C++11/14/17 feature that I can think of that I really dislike.


Curly brackets as a habit save you from the dreaded vexing parse.
You want 20 good men, but you need a bad pussy.
BluzMan
Profile Blog Joined April 2006
Russian Federation4235 Posts
November 24 2016 21:52 GMT
#16036
On November 24 2016 22:23 Manit0u wrote:

public static function bool2int($variable) {
if ($variable === TRUE) {
$result = (int) $variable;
} else if ($variable === FALSE) {
$result = (int) $variable;
} else {
$result = null;
}
return $result;
}


Kill me...

Why would anyone write PHP these days? Quick and dirty stuff can be done with Node, and "proper" PHP looks a lot like a worse version of Java.
You want 20 good men, but you need a bad pussy.
Blitzkrieg0
Profile Blog Joined August 2010
United States13132 Posts
November 24 2016 21:59 GMT
#16037
On November 25 2016 06:52 BluzMan wrote:
Show nested quote +
On November 24 2016 22:23 Manit0u wrote:

public static function bool2int($variable) {
if ($variable === TRUE) {
$result = (int) $variable;
} else if ($variable === FALSE) {
$result = (int) $variable;
} else {
$result = null;
}
return $result;
}


Kill me...

Why would anyone write PHP these days? Quick and dirty stuff can be done with Node, and "proper" PHP looks a lot like a worse version of Java.


Because PHP has the biggest market share so if you're maintaining a system it was probably written in PHP.
I'll always be your shadow and veil your eyes from states of ain soph aur.
Manit0u
Profile Blog Joined August 2004
Poland17540 Posts
Last Edited: 2016-11-25 02:50:38
November 24 2016 22:12 GMT
#16038
On November 25 2016 06:52 BluzMan wrote:
Show nested quote +
On November 24 2016 22:23 Manit0u wrote:

public static function bool2int($variable) {
if ($variable === TRUE) {
$result = (int) $variable;
} else if ($variable === FALSE) {
$result = (int) $variable;
} else {
$result = null;
}
return $result;
}


Kill me...

Why would anyone write PHP these days? Quick and dirty stuff can be done with Node, and "proper" PHP looks a lot like a worse version of Java.


"Proper" PHP app can be developed much faster and much cheaper than its Java counterparts while still adhering to all the "enterprise" bullshit.

Also, I'd rather do PHP than JS or, gods forbid, Java... (I know, I'm biased but Java is actually at the bottom of programming languages I'd like to work with and I've tried out quite a lot of them over the past years)
Time is precious. Waste it wisely.
Birdie
Profile Blog Joined August 2007
New Zealand4438 Posts
November 25 2016 00:47 GMT
#16039
Anyone know of some good quality starter resources for responsive web design? Not using any libraries like bootstrap.
Red classic | A butterfly dreamed he was Zhuangzi | 4.5k, heading to 5k as support!
Manit0u
Profile Blog Joined August 2004
Poland17540 Posts
Last Edited: 2016-11-25 02:51:08
November 25 2016 02:47 GMT
#16040
On November 25 2016 09:47 Birdie wrote:
Anyone know of some good quality starter resources for responsive web design? Not using any libraries like bootstrap.


Bootstrap is probably the best for starters since many products are using it and many other libraries are based on it (foundation, materialize, etc.). As an added bonus you have plenty of resources for that online.

May I ask why no libraries? There is very little point to reinventing the wheel if it's not absolutely necessary.

What kind of resources do you need exactly? General tips and tricks? Something like Google's material design guides? html5rocks? csstricks?
Time is precious. Waste it wisely.
Prev 1 800 801 802 803 804 1032 Next
Please log in or register to reply.
Live Events Refresh
SC Evo League
12:30
#18
LiquipediaDiscussion
WardiTV 2025
11:00
Playoffs
Reynor vs MaxPaxLIVE!
SHIN vs TBD
TBD vs Cure
Solar vs herO
Classic vs TBD
TBD vs Clem
WardiTV1462
ComeBackTV 1108
TaKeTV 482
IndyStarCraft 240
Rex148
CosmosSc2 65
LiquipediaDiscussion
CranKy Ducklings
10:00
Master Swan Open #99
CranKy Ducklings34
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Lowko264
IndyStarCraft 240
Rex 148
BRAT_OK 74
CosmosSc2 65
MindelVK 30
trigger 11
StarCraft: Brood War
Horang2 1559
Stork 496
EffOrt 401
firebathero 349
Leta 318
Last 236
Larva 172
Zeus 170
ggaemo 110
Mong 38
[ Show more ]
zelot 30
ajuk12(nOOB) 25
Shinee 22
yabsab 19
SilentControl 9
ivOry 7
Noble 7
Dota 2
Gorgc4332
singsing3225
XcaliburYe346
qojqva61
League of Legends
rGuardiaN21
Counter-Strike
edward292
oskar165
Heroes of the Storm
Khaldor218
Other Games
B2W.Neo1688
Pyrionflax344
crisheroes326
DeMusliM247
XaKoH 128
Trikslyr24
KnowMe22
Organizations
Other Games
gamesdonequick925
StarCraft: Brood War
lovetv 11
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 13 non-featured ]
StarCraft 2
• C_a_k_e 2422
• Gemini_19 18
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Jankos2026
Upcoming Events
Ladder Legends
5h 42m
BSL 21
6h 42m
Sziky vs Dewalt
eOnzErG vs Cross
Sparkling Tuna Cup
20h 42m
Ladder Legends
1d 3h
BSL 21
1d 6h
StRyKeR vs TBD
Bonyth vs TBD
Replay Cast
1d 19h
Wardi Open
1d 22h
Monday Night Weeklies
2 days
WardiTV Invitational
3 days
Replay Cast
4 days
[ Show More ]
WardiTV Invitational
4 days
ByuN vs Solar
Clem vs Classic
Cure vs herO
Reynor vs MaxPax
Liquipedia Results

Completed

Acropolis #4 - TS3
RSL Offline Finals
Kuram Kup

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
Slon Tour Season 2
CSL Season 19: Qualifier 1
WardiTV 2025
META Madness #9
eXTREMESLAND 2025
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22

Upcoming

CSL Season 19: Qualifier 2
CSL 2025 WINTER (S19)
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Big Gabe Cup #3
OSC Championship Season 13
ESL Pro League Season 23
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.