Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Not Quite Pong  (Read 31623 times)

0 Members and 1 Guest are viewing this topic.

l0calh05t

  • Full Member
  • ***
  • Posts: 200
    • View Profile
Not Quite Pong
« Reply #45 on: July 29, 2008, 10:25:49 pm »
Quote from: "remi.k2620"
It depends how you do it. I fear it to be too slow or too hard to control.
I think having two electrostatic sources - one at each end of the paddles and nothing between - would give an interesting result.


Well, this is what I was thinking of:
Each player can charge his/her paddle either positively or negatively (basically applying a current). Since both players can do this, this should create some interesting interactions (anyone remember plasma pong?). The ball itself could be treated as a point charge that is affected by the potential field of the paddles. (obviously the ball should always have a charge and never be neutral)

Quote
Edit : I tried to compile nqp but couldn't because I have libboost 1.34.1 and the lock and unlock methods you use in AsyncCallable.cpp are only in the new 1.35.0 version :(


the changes shouldn't be too complex:
where I do mutex.lock(), you have to open a scope ({) and create a lock object using that mutex. where I do mutex.unlock(), you simply close that scope (}). and since there are only two places where this has to be changed, it shouldn't be too difficult.

remi.k2620

  • Full Member
  • ***
  • Posts: 186
    • View Profile
    • http://remi.tuxfamily.org
Not Quite Pong
« Reply #46 on: July 30, 2008, 03:49:07 am »
Quote from: "l0calh05t"

Quote
Edit : I tried to compile nqp but couldn't because I have libboost 1.34.1 and the lock and unlock methods you use in AsyncCallable.cpp are only in the new 1.35.0 version :(


the changes shouldn't be too complex:
where I do mutex.lock(), you have to open a scope ({) and create a lock object using that mutex. where I do mutex.unlock(), you simply close that scope (}). and since there are only two places where this has to be changed, it shouldn't be too difficult.


MainTask.cpp: In member function ‘virtual void n71A10890::MainTask::init()’:
MainTask.cpp:85: error: ‘class boost::thread’ has no member named ‘swap’
MainTask.cpp: In member function ‘virtual void n71A10890::MainTask::fini()’:
MainTask.cpp:97: error: ‘class boost::thread’ has no member named ‘timed_join’
MainTask.cpp:97: error: ‘boost::posix_time’ has not been declared

:(

l0calh05t

  • Full Member
  • ***
  • Posts: 200
    • View Profile
Not Quite Pong
« Reply #47 on: July 30, 2008, 08:20:54 am »
wow, didn't even really notice I used so many new boost features... you could replace the timed join with a normal join. I'm less sure about the swap. Since threads are noncopyable, you would probably have to use a thread pointer and use new where i use swap.

Daazku

  • Hero Member
  • *****
  • Posts: 896
    • View Profile
Not Quite Pong
« Reply #48 on: July 30, 2008, 02:18:14 pm »
Download the new version :P
Pensez à mettre le tag [Résolu] une fois la réponse à votre question trouvée.
Remember to add the tag [Solved] when you got an answer to your question.

christoph

  • Full Member
  • ***
  • Posts: 102
    • View Profile
    • http://www.christoph-egger.org
Not Quite Pong
« Reply #49 on: August 01, 2008, 05:59:06 pm »
Hi

An Idea how to fix the following?

Code: [Select]
MainTask.cpp: In member function ‘virtual void n71A10890::MainTask::init()’:
MainTask.cpp:90: error: no matching function for call to ‘boost::thread::swap(boost::thread)’
/usr/include/boost/thread/pthread/thread.hpp:165: note: candidates are: void boost::thread::swap(boost::thread&)


The problem here is, that the boost::thread is an temporary which can't be used as non-const reference

Getting it to compile with following patch

Code: [Select]
diff -u a/MainTask.cpp b/MainTask.cpp
--- a/MainTask.cpp 2008-07-27 14:25:42.000000000 +0200
+++ b/MainTask.cpp 2008-08-01 18:02:55.000000000 +0200
@@ -83,11 +83,8 @@
  bindings.close();
 
  renderTask = new RenderTask_t(window,game);
- renderThread.swap(
- boost::thread(
- boost::bind(&GameTask::run,renderTask)
- )
- );
+ boost::thread thr(boost::bind(&GameTask::run,renderTask));
+ renderThread.swap(thr);
 
  accumulator = 0.f;
  clock.Reset();

l0calh05t

  • Full Member
  • ***
  • Posts: 200
    • View Profile
Not Quite Pong
« Reply #50 on: August 01, 2008, 07:48:39 pm »
Your fix looks fine and should work.