[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4586: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4588: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4589: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4590: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
AI Challenge Forums • View topic - Game engine in C++

It is currently Sun Apr 23, 2017 5:36 am Advanced search

Game engine in C++

Code won't compile? Found a bug? Post here!

Game engine in C++

Postby albert » Sun Sep 12, 2010 9:18 pm

Hi,

I have reimplemented the game engine (i.e. PlayGame.jar) in C++. You can get the code here:
http://github.com/albertz/planet_wars-cpp

The implementation is currently very close to the Java one. However, I probably will refactor and extended it a bit because I will use it in my bot implementation.

I also reimplemented the game viewer. The code is at the same place. More details .

Maybe it is also useful for someone else.
Last edited by albert on Tue Sep 14, 2010 5:03 pm, edited 1 time in total.
albert
Lieutenant-Colonel
 
Posts: 44
Joined: Sun Sep 12, 2010 9:11 pm

Re: Game engine in C++

Postby codeRage » Sun Sep 12, 2010 9:37 pm

It might be useful.. but is it faster than the Java one?
codeRage
Major
 
Posts: 30
Joined: Sat Sep 11, 2010 6:13 pm

Re: Game engine in C++

Postby albert » Sun Sep 12, 2010 10:11 pm

I didn't really do any performance comparison but I am pretty sure it is. It basically mostly the same code, just translated to C++. And in most cases, this results in faster code. Also, you save the huge overhead of the JVM.

Also, if you need some game simulation code in your C++ bot, you don't really have any other choice.
albert
Lieutenant-Colonel
 
Posts: 44
Joined: Sun Sep 12, 2010 9:11 pm

Re: Game engine in C++

Postby DanielVonFange » Mon Sep 13, 2010 2:45 pm

Nice, albert.
DanielVonFange
Brigadier-General
 
Posts: 149
Joined: Wed Sep 08, 2010 1:15 pm

Re: Game engine in C++

Postby Stardragon » Mon Sep 13, 2010 3:36 pm

I think what I'd like best is if the game player were somehow merged with the visualiser: sometimes it can be a drag to play the game in one thing and load it into the next. I'd like to have more direct feedback on what my bot is doing. :-/
Stardragon
Cadet
 
Posts: 4
Joined: Thu Sep 09, 2010 9:41 pm

Re: Game engine in C++

Postby theli_ua » Tue Sep 14, 2010 3:47 pm

i sometimes get different match results with official java engine and this one

on a side note it would be nice to implement support for building natively on windows (it does not work atm due to some posix-specific things, i have it running in cygwin)
theli_ua
Lieutenant
 
Posts: 14
Joined: Tue Sep 14, 2010 7:45 am

Re: Game engine in C++

Postby albert » Tue Sep 14, 2010 5:02 pm

Uh, it gives different results? Can you post/attach two game replays which differ, one with Java and one with the C++ engine?

If it differs because of a timeout of one of the bots, that can be kind of random.

My code is based on the most recent Java code (from the Google Code project). I have read that the released Java tools may contain some bug when there are multiple fleets arriving at a planet at the same time. Maybe that is the case here. Check out if the current Java code produces also the same result.

I don't have Windows here, so I cannot really implement and test the code under Windows. You probably need to rewrite most of the Process class (see utils.{h,cpp}) (there is no fork under Windows but it may be work by just using CreateProcess instead; and then you must somehow get access to the stdin/stdout stream of that created process). Everything else should probably work.

If you do so, please send me a patch so I can include that.
Last edited by albert on Tue Sep 14, 2010 5:09 pm, edited 2 times in total.
albert
Lieutenant-Colonel
 
Posts: 44
Joined: Sun Sep 12, 2010 9:11 pm

Re: Game engine in C++

Postby petesimard » Tue Sep 14, 2010 5:05 pm

Can you post the instructions for compiling this on Cygwin? I'm a bit of a linux noob.
petesimard
Lieutenant
 
Posts: 11
Joined: Sun Sep 12, 2010 9:07 am

Re: Game engine in C++

Postby igner » Tue Sep 14, 2010 6:00 pm

Attachments
Albert.Engine.zip
(14.35 KiB) Downloaded 175 times
igner
Lieutenant
 
Posts: 10
Joined: Sun Sep 12, 2010 10:54 am

Re: Game engine in C++

Postby albert » Tue Sep 14, 2010 6:34 pm

Last edited by albert on Tue Sep 14, 2010 8:51 pm, edited 1 time in total.
albert
Lieutenant-Colonel
 
Posts: 44
Joined: Sun Sep 12, 2010 9:11 pm

Next

Return to Technical Issues

Who is online

Users browsing this forum: No registered users and 1 guest

cron