• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 10:17
CET 16:17
KST 00:17
  • 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 Preview5RSL 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
Weekly Cups (Dec 1-7): Clem doubles, Solar gets over the hump1Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2BGE Stara Zagora 2026 announced15[BSL21] Ro.16 Group Stage (C->B->A->D)4Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win3
StarCraft 2
General
RSL Revival - 2025 Season Finals Preview Weekly Cups (Dec 1-7): Clem doubles, Solar gets over the hump Chinese SC2 server to reopen; live all-star event in Hangzhou Maestros of the Game: Live Finals Preview (RO4) BGE Stara Zagora 2026 announced
Tourneys
RSL Offline Finals Info - Dec 13 and 14! Tenacious Turtle Tussle 2025 RSL Offline Finals Dates + Ticket Sales! Sparkling Tuna Cup - Weekly Open Tournament StarCraft2.fi 15th Anniversary Cup
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 503 Fowl Play Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress Mutation # 500 Fright night
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ FlaSh on: Biggest Problem With SnOw's Playstyle [BSL21] RO8 Bracket & Prediction Contest BW General Discussion Let's talk about Metropolis
Tourneys
[ASL20] Grand Finals [BSL21] RO8 - Day 2 - Sunday 21:00 CET [BSL21] RO8 - Day 1 - Saturday 21:00 CET Small VOD Thread 2.0
Strategy
Simple Questions, Simple Answers Fighting Spirit mining rates Current Meta Game Theory for Starcraft
Other Games
General Games
Dawn of War IV Path of Exile Stormgate/Frost Giant Megathread Awesome Games Done Quick 2026! Nintendo Switch Thread
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
Things Aren’t Peaceful in Palestine US Politics Mega-thread Russo-Ukrainian War Thread YouTube Thread European Politico-economics QA Mega-thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece Movie Discussion!
Sports
Formula 1 Discussion 2024 - 2026 Football Thread
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
TL+ Announced Where to ask questions and add stream?
Blogs
How Sleep Deprivation Affect…
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: 1123 users

The Big Programming Thread - Page 163

Forum Index > General Forum
Post a Reply
Prev 1 161 162 163 164 165 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.
Sub40APM
Profile Joined August 2010
6336 Posts
September 04 2012 05:47 GMT
#3241
Ya so, wasypants has a good point. If you want to 'truly' understand you should start with a language that builds everything up from scratch. But do you have the willpower to grind through that? Because like he also said, with python you can be doing legitimately useful programs from almost day 1 and ya there will be an element of 'magic' to it in the sense that you wont actually know how what you ordered python to do worked under the hood...

I have known many more people who gave up on C and general programming than Python...
phar
Profile Joined August 2011
United States1080 Posts
September 04 2012 07:25 GMT
#3242
I would argue that to get someone interested in programming, you shouldn't hit them with a sledgehammer (C) to begin with. Attrition is going to be a lot lower if you start out actually making stuff, instead of spending 95% of your time fighting with gcc.

I would also argue that C is not a bottom-up approach. If you really want to understand wtf is going on, go like... E&M -> transistors -> architecture -> C. But, not everybody is going to want to learn the really low-level stuff. There are some people who find it fascinating (I am one of those people), but people think it's boring as ungodly fuck.

Also, most of the low level shit just does not matter for 99.9% of the software you do at a high level. Being able to modularize your code, use good designs, and make it readable so other people can mess with it is much more important (where "other people" == "you in 6 months", after you've completely forgotten wtf those 10k loc do).



All that said, if you continue programming, you really should learn C eventually because it's good for you :p
Who after all is today speaking about the destruction of the Armenians?
wherebugsgo
Profile Blog Joined February 2010
Japan10647 Posts
September 04 2012 07:34 GMT
#3243
anyone have any tips on learning Java?

I come from a strong Lisp (Scheme specifically) background and I know Python fairly well in addition. I need to learn Java this semester. Very basic general stuff can be helpful for me. I like knowing the constraints or specifics of a language regarding its very basic ideas: things like, in Lisp everything has the value #t except for #f, whether doing tail-recursion has any benefits over regular recursion, (in Python tail-recursion has no benefit) syntax things to consider (parentheses in Lisp anyone? Also the fucking colons after all the loops in Python kept screwing me over lol)
Tobberoth
Profile Joined August 2010
Sweden6375 Posts
September 04 2012 07:54 GMT
#3244
On September 04 2012 16:34 wherebugsgo wrote:
anyone have any tips on learning Java?

I come from a strong Lisp (Scheme specifically) background and I know Python fairly well in addition. I need to learn Java this semester. Very basic general stuff can be helpful for me. I like knowing the constraints or specifics of a language regarding its very basic ideas: things like, in Lisp everything has the value #t except for #f, whether doing tail-recursion has any benefits over regular recursion, (in Python tail-recursion has no benefit) syntax things to consider (parentheses in Lisp anyone? Also the fucking colons after all the loops in Python kept screwing me over lol)

Generally, I'd say you'll want "high-level" books since you already know how to program and prefer the more technical aspects... I guess an o'rielly book or something like that.

It's also possible that Java has something like all of microsofts products, certification tests etc. The books etc for those, are the SHIT. Since the company which developed the framework etc aims to get you certified, they teach more or less everything from the ground up. Instead of going "How to start coding in X" you go "How to know everything about X".
wherebugsgo
Profile Blog Joined February 2010
Japan10647 Posts
September 04 2012 08:43 GMT
#3245
On September 04 2012 16:54 Tobberoth wrote:
Show nested quote +
On September 04 2012 16:34 wherebugsgo wrote:
anyone have any tips on learning Java?

I come from a strong Lisp (Scheme specifically) background and I know Python fairly well in addition. I need to learn Java this semester. Very basic general stuff can be helpful for me. I like knowing the constraints or specifics of a language regarding its very basic ideas: things like, in Lisp everything has the value #t except for #f, whether doing tail-recursion has any benefits over regular recursion, (in Python tail-recursion has no benefit) syntax things to consider (parentheses in Lisp anyone? Also the fucking colons after all the loops in Python kept screwing me over lol)

Generally, I'd say you'll want "high-level" books since you already know how to program and prefer the more technical aspects... I guess an o'rielly book or something like that.

It's also possible that Java has something like all of microsofts products, certification tests etc. The books etc for those, are the SHIT. Since the company which developed the framework etc aims to get you certified, they teach more or less everything from the ground up. Instead of going "How to start coding in X" you go "How to know everything about X".


Yeah so our "official" book is Head First Java (O'Reilly) and it's been recommended we check out the Gosling reference (since he created the language). I take it O'Reilly's text is a good book?

This stuff is a bit foreign to me as I didn't really use a text to learn Python and I used MIT's text to learn Scheme.
phar
Profile Joined August 2011
United States1080 Posts
Last Edited: 2012-09-05 04:05:40
September 05 2012 04:04 GMT
#3246
On September 04 2012 16:34 wherebugsgo wrote:
anyone have any tips on learning Java?

I come from a strong Lisp (Scheme specifically) background and I know Python fairly well in addition. I need to learn Java this semester. Very basic general stuff can be helpful for me. I like knowing the constraints or specifics of a language regarding its very basic ideas: things like, in Lisp everything has the value #t except for #f, whether doing tail-recursion has any benefits over regular recursion, (in Python tail-recursion has no benefit) syntax things to consider (parentheses in Lisp anyone? Also the fucking colons after all the loops in Python kept screwing me over lol)

Do you know C at all? If you know C, you already know many of the basic constraints in java, especially if you're talking about syntax. If you're any decent at the proper OO constructions in python, it won't be that hard to transition into java.

The official sun tutorials are pretty decent for a first start:

http://docs.oracle.com/javase/tutorial/

s/sun/oracle/


There's an excellent reference - Effective Java, but I'm not sure it's suitable for learning the basics. It's by Joshua Bloch, who wrote significant portions of the java language (the good parts too :p).

Yea reading through bits of it right now, doesn't seem like it'd be that useful for you. Start with a basic text or the official tutorials and see how it goes.


I also strongly suggest that you start off on the right foot and follow an actual style guide (pick one), even while you're first learning. It won't teach you anything about the language itself, but it will help other people be able to help you with your code when you inevitably have to ask for help (everyone does).

official one: http://www.oracle.com/technetwork/java/javase/documentation/codeconvtoc-136057.html



Really though, just start hacking with it. Reading a book or guide isn't gonna go that far. Mess around, build shit, break stuff, ask for help.
Who after all is today speaking about the destruction of the Armenians?
wherebugsgo
Profile Blog Joined February 2010
Japan10647 Posts
September 05 2012 07:50 GMT
#3247
yeah, I have 0 experience with C. Having programmed a bit in Java today (I finished a few small functions, one that finds sociable pairs) I feel more comfortable, but it's still a little weird having to denote what variables are before using them and whatnot.

Thanks for the references! I'll definitely check them out.
Frigo
Profile Joined August 2009
Hungary1023 Posts
September 05 2012 09:24 GMT
#3248
I also advise you to read Clean Code and learn how to use Eclipse and its various refactor options.
http://www.fimfiction.net/user/Treasure_Chest
wherebugsgo
Profile Blog Joined February 2010
Japan10647 Posts
September 05 2012 15:43 GMT
#3249
On September 05 2012 18:24 Frigo wrote:
I also advise you to read Clean Code and learn how to use Eclipse and its various refactor options.


Don't think I'll be using Eclipse, I like emacs too much :p
LukeNukeEm
Profile Joined February 2012
31 Posts
Last Edited: 2012-09-06 00:49:37
September 05 2012 23:38 GMT
#3250
Has anyone here implemented an Octree into a raytracer/pathtracer or something similar? I'm getting somewhat frustrated T_T

edit: as usual, you try to find the answer on your own for hours and get nothing. then you post your question and find the answer on your own 5 minutes later. ^_^
DarkGeneral
Profile Blog Joined September 2003
Canada328 Posts
Last Edited: 2012-09-06 00:05:16
September 06 2012 00:01 GMT
#3251
Hello TL Programmers

A few weeks ago I decided that I wanted to learn and master HTML/CSS/Javascript and SQL.

To solidify my learnings as I went forward, I started a web based game project.

My project is Knights of Drakon, a top down oldschool RPG written entirely in JavaScript/html/css.
Link to my game

The reason I come here is to ask for some advice from seasoned programmers regarding certain game parts.

Im gonna just ask my questions and hope someone will answer

1. How do I code an Armor mitigation function/class?
For example the player has 112 armor, and is level 4, the enemy is lvl 6. How do I make it that 112 turns into a certain % reduction?
such that more player/monster level difference affects the % and also the more the static armor, the less stacking effect it has, such as a diminishing return or a softcap

2. Same as above for a dodge system.

3. Whats the best way to code a turn based 1v1 combat versus a monster. Player attacks, then the monster attacks, so on so forth, untill one is dead. I know this one is a broad scope question, But ANY idea and input is greatly appreciated




Furthermore and possibly off topic, I have my hands full and would appreciate people partnering up with me and contributing to the site, Id love experienced people in all backgrounds, Arists, Coders, Webmaster, Gamedesigners, Level Designers, and someone to help me set up forums for the project, email me from the site or PM here

Thanks TL

"Everybody gotta die some time, righ'?" - Wraith Pilot
LukeNukeEm
Profile Joined February 2012
31 Posts
Last Edited: 2012-09-06 00:28:08
September 06 2012 00:27 GMT
#3252
On September 06 2012 09:01 DarkGeneral wrote:
1. How do I code an Armor mitigation function/class?
For example the player has 112 armor, and is level 4, the enemy is lvl 6. How do I make it that 112 turns into a certain % reduction?
such that more player/monster level difference affects the % and also the more the static armor, the less stacking effect it has, such as a diminishing return or a softcap


You could do something like:
dmgModifier = 100 / (100 + armor);
dmgOut = dmgModifier * dmgIn;

Adjust the numbers to what you feel works best for you.


DarkGeneral
Profile Blog Joined September 2003
Canada328 Posts
September 06 2012 00:46 GMT
#3253
On September 06 2012 09:27 LukeNukeEm wrote:
Show nested quote +
On September 06 2012 09:01 DarkGeneral wrote:
1. How do I code an Armor mitigation function/class?
For example the player has 112 armor, and is level 4, the enemy is lvl 6. How do I make it that 112 turns into a certain % reduction?
such that more player/monster level difference affects the % and also the more the static armor, the less stacking effect it has, such as a diminishing return or a softcap


You could do something like:
dmgModifier = 100 / (100 + armor);
dmgOut = dmgModifier * dmgIn;

Adjust the numbers to what you feel works best for you.




Sweet, I like that. Any ideas on how to play level difference into this calculation?
"Everybody gotta die some time, righ'?" - Wraith Pilot
LukeNukeEm
Profile Joined February 2012
31 Posts
September 06 2012 00:53 GMT
#3254
On September 06 2012 09:46 DarkGeneral wrote:
Show nested quote +
On September 06 2012 09:27 LukeNukeEm wrote:
On September 06 2012 09:01 DarkGeneral wrote:
1. How do I code an Armor mitigation function/class?
For example the player has 112 armor, and is level 4, the enemy is lvl 6. How do I make it that 112 turns into a certain % reduction?
such that more player/monster level difference affects the % and also the more the static armor, the less stacking effect it has, such as a diminishing return or a softcap


You could do something like:
dmgModifier = 100 / (100 + armor);
dmgOut = dmgModifier * dmgIn;

Adjust the numbers to what you feel works best for you.




Sweet, I like that. Any ideas on how to play level difference into this calculation?


Just do the same thing again - pretend that each level is worth 50 armor or so. either work it in the existing modifier, or create a new one and multiply both, e.g:
lvlDiffModifier = 100 / (100 + 50 * lvlDiff);
dmgOut = armorModifier * lvlDiffModifier * dmgIn
Brutland
Profile Joined February 2011
United States92 Posts
Last Edited: 2012-09-06 00:57:05
September 06 2012 00:54 GMT
#3255
dmgMod= LvlMod*(100/(100+cArmor)
dmgOut=dmgIn*dmgMod

LvlMod= abs(charLvl-oppLvl)*whatever percent or modifying fn here
"I drank What?"
LukeNukeEm
Profile Joined February 2012
31 Posts
September 06 2012 00:57 GMT
#3256
On September 06 2012 09:54 Brutland wrote:
dmgMod= abs((oppLvl-charLvl))*(100/(100+cArmor)
dmgOut=dmgIn*dmgMod


this would result in getting the same modifiers for lvl4 vs lvl6 / lvl 6 vs lvl 4
Craton
Profile Blog Joined December 2009
United States17274 Posts
September 06 2012 01:09 GMT
#3257
On September 05 2012 16:50 wherebugsgo wrote:
yeah, I have 0 experience with C. Having programmed a bit in Java today (I finished a few small functions, one that finds sociable pairs) I feel more comfortable, but it's still a little weird having to denote what variables are before using them and whatnot.

Thanks for the references! I'll definitely check them out.

It feels weird as hell not to when you started the other way.
twitch.tv/cratonz
DarkGeneral
Profile Blog Joined September 2003
Canada328 Posts
September 06 2012 01:10 GMT
#3258
On September 06 2012 09:53 LukeNukeEm wrote:
Show nested quote +
On September 06 2012 09:46 DarkGeneral wrote:
On September 06 2012 09:27 LukeNukeEm wrote:
On September 06 2012 09:01 DarkGeneral wrote:
1. How do I code an Armor mitigation function/class?
For example the player has 112 armor, and is level 4, the enemy is lvl 6. How do I make it that 112 turns into a certain % reduction?
such that more player/monster level difference affects the % and also the more the static armor, the less stacking effect it has, such as a diminishing return or a softcap


You could do something like:
dmgModifier = 100 / (100 + armor);
dmgOut = dmgModifier * dmgIn;

Adjust the numbers to what you feel works best for you.




Sweet, I like that. Any ideas on how to play level difference into this calculation?


Just do the same thing again - pretend that each level is worth 50 armor or so. either work it in the existing modifier, or create a new one and multiply both, e.g:
lvlDiffModifier = 100 / (100 + 50 * lvlDiff);
dmgOut = armorModifier * lvlDiffModifier * dmgIn


Beautiful simplcity,

now for the last aspect, how would I implement diminishing returns?

As the number increases and the % approaches lets say 70% the % amount per armor point would have to curve down, what is the best way to do that?
"Everybody gotta die some time, righ'?" - Wraith Pilot
phar
Profile Joined August 2011
United States1080 Posts
September 06 2012 04:16 GMT
#3259
On September 06 2012 00:43 wherebugsgo wrote:
Show nested quote +
On September 05 2012 18:24 Frigo wrote:
I also advise you to read Clean Code and learn how to use Eclipse and its various refactor options.


Don't think I'll be using Eclipse, I like emacs too much :p

Eclipse is a huge timesaver for Java. If you're not going to be writing that much code it won't matter, but if you have to crank out like 4k loc a week, Eclipse helps with the RSI :\

If this is for ar Uni class, just use whatever you're most comfortable with. But the default auto complete / auto import / auto getter/setter /etc stuff that's built in to Eclipse is really handy.
Who after all is today speaking about the destruction of the Armenians?
wherebugsgo
Profile Blog Joined February 2010
Japan10647 Posts
September 06 2012 05:46 GMT
#3260
On September 06 2012 13:16 phar wrote:
Show nested quote +
On September 06 2012 00:43 wherebugsgo wrote:
On September 05 2012 18:24 Frigo wrote:
I also advise you to read Clean Code and learn how to use Eclipse and its various refactor options.


Don't think I'll be using Eclipse, I like emacs too much :p

Eclipse is a huge timesaver for Java. If you're not going to be writing that much code it won't matter, but if you have to crank out like 4k loc a week, Eclipse helps with the RSI :\

If this is for ar Uni class, just use whatever you're most comfortable with. But the default auto complete / auto import / auto getter/setter /etc stuff that's built in to Eclipse is really handy.


yeah so it's for a university class (UC Berkeley) and our "official" text editor is emacs. We have been told that we can use Eclipse if we want to, but our prof made a list of things he hates about Eclipse and most of us learned on vim/emacs anyway so it's not a huge deal.

Prev 1 161 162 163 164 165 1032 Next
Please log in or register to reply.
Live Events Refresh
StarCraft2.fi
10:00
15V Cup / Offline Finals
starcraft2fi 273
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
LamboSC2 172
StarCraft: Brood War
Britney 34997
Bisu 1825
Horang2 1712
Light 1025
EffOrt 972
Stork 766
firebathero 384
hero 327
BeSt 313
Rush 237
[ Show more ]
Killer 206
Mini 200
Hyun 170
Last 118
Larva 108
Leta 81
Mind 74
sorry 48
Terrorterran 27
Noble 25
Mong 25
Rock 23
yabsab 22
soO 20
Aegong 20
Sacsri 14
Bale 14
ajuk12(nOOB) 13
Shine 9
NaDa 8
Dota 2
Gorgc6601
singsing3633
qojqva2013
XcaliburYe193
League of Legends
C9.Mang0375
Counter-Strike
edward197
Heroes of the Storm
Khaldor360
Other Games
Grubby3701
FrodaN3202
B2W.Neo1243
Lowko481
Beastyqt357
KnowMe115
XaKoH 85
Mew2King43
Trikslyr20
Organizations
StarCraft 2
ComeBackTV 796
Other Games
EGCTV714
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 13 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV397
League of Legends
• Jankos3421
Other Games
• Scarra1015
Upcoming Events
IPSL
1h 43m
Sziky vs JDConan
OSC
1h 43m
Solar vs Percival
Gerald vs Nicoract
Creator vs ByuN
BSL 21
4h 43m
Sziky vs StRyKeR
Hawk vs Dewalt
RSL Revival
13h 13m
Classic vs Reynor
herO vs Zoun
WardiTV 2025
21h 43m
herO vs ShoWTimE
SHIN vs herO
Clem vs herO
SHIN vs Clem
SHIN vs ShoWTimE
Clem vs ShoWTimE
IPSL
1d 1h
Tarson vs DragOn
BSL 21
1d 4h
Tech vs Cross
Bonyth vs eOnzErG
Replay Cast
1d 17h
Wardi Open
1d 20h
Monday Night Weeklies
2 days
[ Show More ]
Sparkling Tuna Cup
2 days
Replay Cast
4 days
The PondCast
4 days
CranKy Ducklings
6 days
SC Evo League
6 days
Liquipedia Results

Completed

Acropolis #4 - TS3
RSL Revival: Season 3
Kuram Kup

Ongoing

IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
Slon Tour Season 2
WardiTV 2025
RSL Offline Finals
META Madness #9
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

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Big Gabe Cup #3
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025
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.