Computer Webmaster Gaming Console Graphics Forum

Welcome to the Computer Webmaster Gaming Console Graphics Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

MK PitStop Main Earn $25 Earn Money Posting Extras Members Blogs Image Hosting User Pages
Go Back   Computer Webmaster Gaming Console Graphics Forum > Computer Forums > Software Programming
Register FAQ/Rules Become A V.I.P. Member Search Today's Posts Mark Forums Read

Software Programming Software programming talk, ask questions about computer software programming or help others

Google
Closed Thread
 
LinkBack Thread Tools Display Modes
Old 06-12-2007, 9:46 PM   #1
dn
 
dn's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Problems with a seperate thread for dinput

Basically I have 2D, tiled, turn based space game. I collect input
(keyboard and mouse) with a seperate thread that I currently have set to
collect 20 times per second.

The problem : Timing. Each of my screens (intro, character selection,
etc.) execute varying amounts of code (drawing, rule checking, etc.) so
keeping in mind the input collection at 20 seconds per second sometimes I'll
miss a mouse click and sometimes I'll have registered several mouse clicks.

For example on one of my screens I have a button that basically increments a
number each time it's clicked. Since there is not a whole lot of stuff
being drawn and/or other rule checking going on when I click the mouse
quickly the number will increment by 2 or 3 instead of the expected 1 per
click.

On a completely different screen that has more stuff going on if you will,
when I click the mouse on a button sometimes it doesn't register instead of
the expected 1 per click.

I know it's a timing issue and I can tweak it to work properly for a
particular screen, but obviously not for all the screens.

So I would like to have consistency along with appropriate input collection
frequency. How can I control this? My guess is by limiting the times
through the loop with something like gettickcount().

The flow of my program is basically like this. I'm leaving a lot out, but
enough to get the point across.

main()
{
loop(until user quit)
{
dispatch message
application->run();
}
}

application::run()
{
switch(what state am I in)
case : initialization
dointialization();
case : start_screen
dostart_screen();
case : char_selection
dochar_selection();
}

Using the example above the dostart_screen() subroutine has very little to
draw/do so clicks register quickly. Meanwhile, on the dochar_selection()
has a lot more stuff being drawn/checked so the clicks register slower.

My thoughts on how to fix this would be: (adjusting the top/main loop
only)

main()
{
loop(until user quit)
{
gettickcount
dispatch message
if(tickcount is >= 30 fps)
application->run();
}
}

Any thoughts?

Also I know I went overkill with spawning a seperate thread and doing action
mapping, but I was learning it at the time and thought I would use that
moving forward, especially if I was planning on ever doing a FPS/realtime
game. I think it would work out pretty well for a FPS/realtime game.

regards,
dn


 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Old 06-12-2007, 9:47 PM   #2
j.laflam
 
j.laflam's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Problems with a seperate thread for dinput

I tried the gettickcount() idea and it worked.


 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Featured Websites
Free Space
Free Space
Free Space Free Space
Closed Thread
Tags: , , ,




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can i save layers as seperate images? Łngelkott Graphics in general 5 06-11-2007 10:37 PM
Yet another GHII thread Bobby Internet Console Subjects 4 06-11-2007 12:59 AM
Deleted a thread MadKad Community Chat 0 11-04-2006 1:30 PM
Thread suggestions Scoot Bugs And Feedback 14 05-22-2006 6:22 PM
What is going on with these posts and thread Scoot Community Chat 11 04-13-2006 12:30 AM


Featured Websites




All times are GMT +1. The time now is 12:31 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.0.0
Cheap Computers
MK PitStop Copyright 2005 - 2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98