• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 13:16
CET 19:16
KST 03:16
  • 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
TL.net Map Contest #21: Winners11Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10[ASL20] Finals Preview: Arrival13TL.net Map Contest #21: Voting12[ASL20] Ro4 Preview: Descent11
Community News
StarCraft, SC2, HotS, WC3, Returning to Blizzcon!45$5,000+ WardiTV 2025 Championship7[BSL21] RO32 Group Stage4Weekly Cups (Oct 26-Nov 2): Liquid, Clem, Solar win; LAN in Philly2Weekly Cups (Oct 20-26): MaxPax, Clem, Creator win10
StarCraft 2
General
SC: Evo Complete - Ranked Ladder OPEN ALPHA Mech is the composition that needs teleportation t TL.net Map Contest #21: Winners StarCraft, SC2, HotS, WC3, Returning to Blizzcon! RotterdaM "Serral is the GOAT, and it's not close"
Tourneys
Constellation Cup - Main Event - Stellar Fest Sparkling Tuna Cup - Weekly Open Tournament $5,000+ WardiTV 2025 Championship Merivale 8 Open - LAN - Stellar Fest Sea Duckling Open (Global, Bronze-Diamond)
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 499 Chilling Adaptation Mutation # 498 Wheel of Misfortune|Cradle of Death Mutation # 497 Battle Haredened Mutation # 496 Endless Infection
Brood War
General
FlaSh on: Biggest Problem With SnOw's Playstyle BGH Auto Balance -> http://bghmmr.eu/ [ASL20] Ask the mapmakers — Drop your questions BW General Discussion Where's CardinalAllin/Jukado the mapmaker?
Tourneys
[Megathread] Daily Proleagues [ASL20] Grand Finals [BSL21] RO32 Group A - Saturday 21:00 CET [BSL21] RO32 Group B - Sunday 21:00 CET
Strategy
PvZ map balance Current Meta How to stay on top of macro? Soma's 9 hatch build from ASL Game 2
Other Games
General Games
Stormgate/Frost Giant Megathread Should offensive tower rushing be viable in RTS games? Nintendo Switch Thread Path of Exile Dawn of War IV
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
TL Mafia Community Thread SPIRED by.ASL Mafia {211640}
Community
General
Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine Canadian Politics Mega-thread US Politics Mega-thread The Games Industry And ATVI
Fan Clubs
White-Ra Fan Club The herO Fan Club!
Media & Entertainment
[Manga] One Piece Anime Discussion Thread Movie Discussion! Korean Music Discussion Series you have seen recently...
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion MLB/Baseball 2023 TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Learning my new SC2 hotkey…
Hildegard
Coffee x Performance in Espo…
TrAiDoS
Saturation point
Uldridge
DnB/metal remix FFO Mick Go…
ImbaTosS
Reality "theory" prov…
perfectspheres
Our Last Hope in th…
KrillinFromwales
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1391 users

The Big Programming Thread - Page 96

Forum Index > General Forum
Post a Reply
Prev 1 94 95 96 97 98 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.
Brotkrumen
Profile Joined May 2010
Germany193 Posts
November 19 2011 13:49 GMT
#1901
On November 19 2011 22:22 klo8 wrote:
Hi!

I'm currently doing a Java 2 Mobile Edition game (an RPG, also, my first real game) for a class and I'm having a bit of trouble with the game loop. Right now, it looks about like this (the game loop class is a Runnable)

public void run()
{
loadResources();
while(!gameOver)
{
updateScreen();
processKeys();
Thread.sleep(40);
}
}

So, the game loop sleeps for 40 ms at every iteration, which results in 25 fps. When processing the keys, I want to move the player character 1 tile (32x32) each time he hits one of the movement buttons. Now, I can obviously make it so the player can move 32 pixel per step (each method call to player.move() increments or decrements the position in x or y by 32) , therefore 32 * 25 pixel per second, which is way too fast. I'm kind of stumped right now on how to make it so the player character can only move between tiles while also making him move at a reasonable speed.


Hey,
Complete noob here that only codes a little in ahk, so ignore me if that doesnt work in java.

I would make a delay variable. Say, you want the player to be able to move every 20 iterations, the delay variable would be set to 0 every time keys are processed. after every iteration, the delay variable gets incremented by 1 and process keys are not executed until the delay variable is above 20.

less abstract, in ahk it would probably look a bit like this:

delay=20

loop,
{
if(gameOver!=1)
{
if(delay<20)
{
delay++
}
else
{
processKeys()
delay=0
}
}
updateScreen()
sleep,40
}
IMindI
Profile Joined May 2010
Germany10 Posts
November 19 2011 15:23 GMT
#1902
On November 19 2011 22:22 klo8 wrote:
Hi!

I'm currently doing a Java 2 Mobile Edition game (an RPG, also, my first real game) for a class and I'm having a bit of trouble with the game loop. Right now, it looks about like this (the game loop class is a Runnable)

public void run()
{
loadResources();
while(!gameOver)
{
updateScreen();
processKeys();
Thread.sleep(40);
}
}

So, the game loop sleeps for 40 ms at every iteration, which results in 25 fps. When processing the keys, I want to move the player character 1 tile (32x32) each time he hits one of the movement buttons. Now, I can obviously make it so the player can move 32 pixel per step (each method call to player.move() increments or decrements the position in x or y by 32) , therefore 32 * 25 pixel per second, which is way too fast. I'm kind of stumped right now on how to make it so the player character can only move between tiles while also making him move at a reasonable speed.


Why not simply only process arrowkeys, when your character is perfectly aligned on a square?
If a key is pressed, set a boolean in your character, that he has to move.
As soon as he is aligned with your grid / tiles, switch the boolean off again.
You can check for alignment with for example x % 32 == 0 && y % 32 == 0
japro
Profile Joined August 2010
172 Posts
Last Edited: 2011-11-19 15:58:56
November 19 2011 15:36 GMT
#1903
I usually do something along the lines of:

long now = System.nanotime();
if(now-lastmove >= moveInterval)
{
player.move();
lastmove += moveInterval;
}

This way the player will move at most every moveInterval nanoseconds...

Edit: also just always sleeping 40ms is a bad idea... just assume your game logic requires also 40ms... suddenly you are running only half the fps.

My standard java game loop looks something like this:

while(running)
{
long now = System.nanoTime();
if(now<nextUpdate)
{
Thread.sleep((nextUpdate-now)/1000000);
}
else
{
step();
nextUpdate += 1000000000/FPS;
if(now<nextUpdate)
{
draw();
}
}
}

This way the game is guaranteed to run the requested FPS if the computer can keep up, And it will automatically start to "undersample" by skipping the drawing to ensure the game logic keeps it's pace (you may want to skip that part...)
Frigo
Profile Joined August 2009
Hungary1023 Posts
November 19 2011 21:04 GMT
#1904
On November 19 2011 22:22 klo8 wrote:
Hi!

I'm currently doing a Java 2 Mobile Edition game (an RPG, also, my first real game) for a class and I'm having a bit of trouble with the game loop. Right now, it looks about like this (the game loop class is a Runnable)

public void run()
{
loadResources();
while(!gameOver)
{
updateScreen();
processKeys();
Thread.sleep(40);
}
}

So, the game loop sleeps for 40 ms at every iteration, which results in 25 fps. When processing the keys, I want to move the player character 1 tile (32x32) each time he hits one of the movement buttons. Now, I can obviously make it so the player can move 32 pixel per step (each method call to player.move() increments or decrements the position in x or y by 32) , therefore 32 * 25 pixel per second, which is way too fast. I'm kind of stumped right now on how to make it so the player character can only move between tiles while also making him move at a reasonable speed.


Well first of all, sleeping for 40ms results in at most 25 fps, and reaches that if and only if your physics and rendering calculations take exactly 0 time. It isn't enough to sleep for 40ms minus elapsedTime either, it consistently overstates the amount of sleep required for properly limiting the rendering to 25 fps. There is an algorithm that calculates it precisely based on previous predictions, but I have no idea what it is called or where to find it.

For the problem of too fast movement in a (non-continuous) tiled game, you need to introduce limitations of user control. Ideally, the user input should trigger a movement action (with optional animation) instead of just teleporting the character to the next tile. This action takes some predefined non-zero time, and the user control is disabled (or queued) until it is finished. You store all information about the action and its progress in some kind of state (which can be different from the game state if you define the game state in terms of tiles, it's up to the implementation), and process it with a constant rate.

Which leads us to another concern. It is never a good idea to run your rendering and game physics (and user control) in the same loop, or even in the same thread. The rendering can take unpredictable amounts of time, and should not influence the speed of the physics. The ideal solution would be to run them in separate threads at separate rates, with proper concurrency management. Say, the physics loop might run at 100fps, but the rendering only at 30 fps tops.

Some related reading material:
http://dewitters.koonsolo.com/gameloop.html
http://gafferongames.com/game-physics/fix-your-timestep/
http://www.fimfiction.net/user/Treasure_Chest
mmp
Profile Blog Joined April 2009
United States2130 Posts
November 22 2011 05:09 GMT
#1905
Are there any Javascript/Canvas/HTML5 hackers out there? I've been working on a framework for Canvas 2D Context for a while now and things are starting to come together (it's about 95% tested and 90% documented but there are some known holes, so be gentle).

The project is hosted at: http://gitorious.org/meta2d/core/trees/master/

If your browser is awesome (tested in FF7, Chrome14 -- Opera won't work right now, I assume IE will fail) you can try a demo of HTMLMouseEvent triggers here: http://mikemp.mit.edu/meta2d/demo/mouse.html

Unlike some other frameworks out there, this one is aimed at scalability of interactive applications without obfuscating the Context2D API. So you can port your existing canvas code over easily and use the extras that this framework provides to improve performance as needed.

It's a powerful utility if you want to write an HTML5 game, among other applications.

I'd appreciate some feedback & if you're interested in getting involved or have any questions feel free to pm me.
I (λ (foo) (and (<3 foo) ( T_T foo) (RAGE foo) )) Starcraft
Tiutababo
Profile Joined December 2010
Singapore11 Posts
November 22 2011 08:21 GMT
#1906
Just wondering if anyone is familiar with com programming and working with ifilters.

I used the following code to test:
http://sites.google.com/site/idisposable/ExtractText.zip

Anyway, I'm trying to make use of ifilter to read the contents of PDF files. The problem occurs when I've recently installed adobe reader 10.1.1. This comes with an ifilter dll for pdf files. It used to work fine with version 9.x and lower ifilters. (I'm testing this on Windows 7 x86.)

This installed ifilter seems to work fine for the built in windows search.

I then downloaded the MS ifilter test suite and tried to test the ifilter usign the filtdump tool, which uses the ILoadFilter::LoadIFilter method to load the Ifilter DLL appropriate for the specified file name extension and prints the results. This works fine and says it's using IPersistStream. (Running Ifilter Explorer suggests that only IPersistFile is implemented and not IPersistStream. However, this seems to contradict the ifiltdump test.)

However, in that code, I'm getting an error at the LoadIFilter API, which returns E_NOTIMPL error.

I suspect that perhaps this new ifilter did not implement the IPersistFile.load method. However, I'm very curious how filtdump is able to extract the contents.

Thanks for reading and I appreciate any help or ideas on how to fix this.
haduken
Profile Blog Joined April 2003
Australia8267 Posts
November 22 2011 13:00 GMT
#1907
This might be a shot in the dark, but does anyone know where I can get my hands on Access 2000?
I need it to view some ancient vba app..
Rillanon.au
Chillton
Profile Joined January 2011
Canada85 Posts
November 22 2011 14:43 GMT
#1908
Not sure where to start here but is anyone proficient in VBA for excel? I always need input as I'm self taught and I do macros for alot of reporting.
Terran Fo' Life - Now Swarm Fo' Life :D
Vin{MBL}
Profile Blog Joined September 2006
5185 Posts
November 22 2011 15:52 GMT
#1909
On November 22 2011 23:43 Chillton wrote:
Not sure where to start here but is anyone proficient in VBA for excel? I always need input as I'm self taught and I do macros for alot of reporting.


I know a bit about VBA and C# interop (i.e. macros for C#). I'm self taught as well though.
tarpman
Profile Joined February 2009
Canada719 Posts
November 22 2011 18:15 GMT
#1910
On November 22 2011 22:00 haduken wrote:
This might be a shot in the dark, but does anyone know where I can get my hands on Access 2000?
I need it to view some ancient vba app..


Do you need the whole thing? The runtime part is available: http://download.microsoft.com/download/office2000dev/art2kmin/1/win98/en-us/art2kmin.exe

Newer Access runtimes should also be able to open Access 2000 apps.
Saving the world, one kilobyte at a time.
dementrio
Profile Joined November 2010
678 Posts
November 22 2011 18:19 GMT
#1911
I need a report generation tool that
- is free,
- runs on both Linux and Windows,
- can connect to MS SQL server,
- lets me handcraft SQL queries,
- has some sort of WYSIWYG editor for eye candy (font, colors, images, and all the things a manager needs to fill his reports with)

do you know of any?
Brambled
Profile Joined July 2010
United States750 Posts
November 25 2011 06:05 GMT
#1912
So I have a hopefully simple question about a batch file I am trying to make.

@echo off
Start "Dwarf Therapist - Caste.exe" /d "C:\Users\Me\Desktop\DF\DwarfTherapist 0.6.10" "Dwarf Therapist - Caste.exe"

This is a piece of the batch I am having issues with. I can't get it to start minimized. I have tried /m practically everywhere in the line but it will either just not run or start normally.

Also is the something like a step up from batch files without getting too confusing for someone who has never done programming before? Batch files seem very very limited.
CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
Last Edited: 2011-11-26 18:33:33
November 26 2011 18:33 GMT
#1913
On November 25 2011 15:05 Brambled wrote:
So I have a hopefully simple question about a batch file I am trying to make.

@echo off
Start "Dwarf Therapist - Caste.exe" /d "C:\Users\Me\Desktop\DF\DwarfTherapist 0.6.10" "Dwarf Therapist - Caste.exe"

This is a piece of the batch I am having issues with. I can't get it to start minimized. I have tried /m practically everywhere in the line but it will either just not run or start normally.

Also is the something like a step up from batch files without getting too confusing for someone who has never done programming before? Batch files seem very very limited.

Batch files aren't too limited, you have control structures like if else and looping, subroutines, variables.

Have you tried creating a batch file to run a shortcut, with the shortcut containing the path + /m parameter?
Pawsom
Profile Blog Joined February 2009
United States928 Posts
Last Edited: 2011-11-27 06:34:49
November 27 2011 06:02 GMT
#1914
On November 25 2011 15:05 Brambled wrote:
So I have a hopefully simple question about a batch file I am trying to make.

@echo off
Start "Dwarf Therapist - Caste.exe" /d "C:\Users\Me\Desktop\DF\DwarfTherapist 0.6.10" "Dwarf Therapist - Caste.exe"

This is a piece of the batch I am having issues with. I can't get it to start minimized. I have tried /m practically everywhere in the line but it will either just not run or start normally.

Also is the something like a step up from batch files without getting too confusing for someone who has never done programming before? Batch files seem very very limited.


Try /min not /m

What about batch do you find limitted?
ArcticVanguard
Profile Blog Joined August 2010
United States450 Posts
November 27 2011 18:06 GMT
#1915
Does anyone have any suggestions for reading and manipulating PNG files with Python? PyPNG is outdated and PIM won't install on my computer.
"When I became a man I put away childish things, including the fear of childishness and the desire to be very grown up." ~C.S. Lewis
Azzur
Profile Blog Joined July 2010
Australia6260 Posts
November 27 2011 18:15 GMT
#1916
On November 23 2011 03:19 dementrio wrote:
I need a report generation tool that
- is free,
- runs on both Linux and Windows,
- can connect to MS SQL server,
- lets me handcraft SQL queries,
- has some sort of WYSIWYG editor for eye candy (font, colors, images, and all the things a manager needs to fill his reports with)

do you know of any?

Have a look at ireports and BIRT
guyabs
Profile Joined May 2010
Philippines103 Posts
Last Edited: 2011-11-28 00:58:17
November 28 2011 00:02 GMT
#1917
Good day to you guys,

I need help on ASM. Basically how can you store a double value then multiply it to an integer value or another double value?

heres another problem.
If somebody can help me with my code. here it is:


INVOKE printf,ADDR msg1fmt,ADDR msg1

.while row<=10

.while column<=10
mov eax,row
imul column
mov mulTot,eax
inc column
INVOKE printf,ADDR in1fmt, mulTot
.endw

mov column,1
INVOKE printf,ADDR msg1fmt, ADDR a
inc row
.endw


the problem is that the first printf outside the while loop keeps printing everytime the loop executes. I only want it to print in the start of the program. Thanks in advance
ArcticVanguard
Profile Blog Joined August 2010
United States450 Posts
November 28 2011 18:22 GMT
#1918
Guyabs, what OS and assembler are you using?
"When I became a man I put away childish things, including the fear of childishness and the desire to be very grown up." ~C.S. Lewis
guyabs
Profile Joined May 2010
Philippines103 Posts
November 29 2011 23:52 GMT
#1919
im using windows vista, visual c++ express. nevermind the code i got it sorted out. my only problem now is the double value.
ArcticVanguard
Profile Blog Joined August 2010
United States450 Posts
November 30 2011 16:40 GMT
#1920
On November 30 2011 08:52 guyabs wrote:
im using windows vista, visual c++ express. nevermind the code i got it sorted out. my only problem now is the double value.

If you've already got the double value stored, try changing the integer to a double and multiplying them. Typing is really picky (and sometimes weird) in assembly and C++.
"When I became a man I put away childish things, including the fear of childishness and the desire to be very grown up." ~C.S. Lewis
Prev 1 94 95 96 97 98 1032 Next
Please log in or register to reply.
Live Events Refresh
Wardi Open
12:00
#60
WardiTV2250
IndyStarCraft 235
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
IndyStarCraft 235
UpATreeSC 87
StarCraft: Brood War
Rain 3549
Horang2 1587
Shuttle 779
firebathero 160
scan(afreeca) 52
sSak 37
Mong 30
Aegong 22
JulyZerg 17
ivOry 6
[ Show more ]
SilentControl 5
Dota 2
Gorgc5362
qojqva3580
420jenkins277
BananaSlamJamma178
XcaliburYe153
League of Legends
rGuardiaN20
Counter-Strike
fl0m572
byalli525
Other Games
FrodaN1033
Beastyqt715
ceh9567
KnowMe280
Lowko263
Sick257
Hui .188
Mew2King150
Liquid`VortiX147
ArmadaUGS79
QueenE48
Trikslyr46
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 18 non-featured ]
StarCraft 2
• kabyraGe 105
• Reevou 1
• IndyKCrew
• LaughNgamezSOOP
• sooper7s
• AfreecaTV YouTube
• Migwel
• intothetv
• Kozan
StarCraft: Brood War
• Michael_bg 9
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• WagamamaTV218
League of Legends
• Nemesis3571
• TFBlade957
• imaqtpie471
Other Games
• Shiphtur284
Upcoming Events
Replay Cast
4h 44m
WardiTV Korean Royale
17h 44m
OSC
22h 44m
Replay Cast
1d 4h
Replay Cast
1d 14h
Kung Fu Cup
1d 17h
Classic vs Solar
herO vs Cure
Reynor vs GuMiho
ByuN vs ShoWTimE
Tenacious Turtle Tussle
2 days
The PondCast
2 days
RSL Revival
2 days
Solar vs Zoun
MaxPax vs Bunny
Kung Fu Cup
2 days
[ Show More ]
WardiTV Korean Royale
2 days
PiGosaur Monday
3 days
RSL Revival
3 days
Classic vs Creator
Cure vs TriGGeR
Kung Fu Cup
3 days
CranKy Ducklings
4 days
RSL Revival
4 days
herO vs Gerald
ByuN vs SHIN
Kung Fu Cup
4 days
BSL 21
5 days
Tarson vs Julia
Doodle vs OldBoy
eOnzErG vs WolFix
StRyKeR vs Aeternum
Sparkling Tuna Cup
5 days
RSL Revival
5 days
Reynor vs sOs
Maru vs Ryung
Kung Fu Cup
5 days
WardiTV Korean Royale
5 days
BSL 21
6 days
JDConan vs Semih
Dragon vs Dienmax
Tech vs NewOcean
TerrOr vs Artosis
Wardi Open
6 days
Monday Night Weeklies
6 days
Liquipedia Results

Completed

Proleague 2025-11-07
Stellar Fest: Constellation Cup
Eternal Conflict S1

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
SOOP Univ League 2025
YSL S2
BSL Season 21
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual

Upcoming

SLON Tour Season 2
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
RSL Revival: Season 3
META Madness #9
BLAST Bounty Winter 2026
BLAST Bounty Winter 2026: Closed Qualifier
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 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.