LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-11-2005, 01:38 PM   #1
NCC-1701&NCC-1701-D
Member
 
Registered: May 2005
Distribution: Debian Woody,Knoppix
Posts: 88

Rep: Reputation: 16
Question Writing a simulation?


Hi all,
simulations are one of the most interesting apps. You have a condition (ex. The door is locked from inside), you program it and you watch how the computer reacts... Wonderful in theory, but in practice? I want to create a simple war simulator, with some AI. You give country, weapons etc. and the computer tells you the conlcusion and causulties. But how can I implement it? NOTE: I know C quite well, Java learning C++ and OpenGL. OpenGL stands in case of visualising the app.

Any help would be V E R Y V E R Y useful!
Thanks!
 
Old 06-11-2005, 02:08 PM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Quote:
I want to create a simple war simulator
Exactly what the world needs actually...
Do not forget to add random attacks caused by terrorists
and mercenaries payed by some private companies...
 
Old 06-11-2005, 10:25 PM   #3
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Just a personal opinion here: What you're suggesting may be a whole lot more work than you anticipate. Just a warning...

The first thing you need to do is prepare and organize. Do not just sit down and start coding. You say you want a "simple war simulator", well how simple? Are you going to have a high-level outlook? Say, for instance, assign a "combat power" value to each side involved in the simulated conflict, where the higher the number, the more powerful? Or do you want to simulate all the way down to individual soldiers, vehicles, terrain, etc.? "Simple" can mean many different things: from numbers of "entities" involved to the equations governing interactions.

For simulations, detail is the key. The more accurately you model the situation (by taking into account as many aspects as possible), the more rational your results will be. The downside is, with greater detail comes greater programming complexity, and longer runtime. Think about it; if you want to simulate all the way to the soldier level, then the computer needs to take time to process every soldier in the simulation.

So start asking yourself questions. Put down what you want on paper, and start getting more specific. Once you think you have a workable, semi-final list, go through it again, and consider what it might take to implement it. I don't mean actually write code, but start thinking what it would require to accomplish. Say, for instance, you wanted to force the soldiers to obey line of sight. That implies your world has a coordinate system, and you'll be doing a lot of vector math. You'll have to calculate the line from soldier A and soldier B, determine how far away the soldiers are from each other, compare that distance with the maximum distance a soldier can see, decide what angle(s) determine field of vision, check that there are no objects between the two soldiers, etc. If you look at something you really want to include, but are afraid the implementation is way too complex, then compromise. To extend the previous example, maybe you'll say that soldiers can see an unlimited distance. Maybe you'll say that the battles will take place on a flat, 2D battlefield to make the math easier. Again, it's a tradeoff between rational results and complexity/runtime.

Once you've finally got a list of features you want that you think are realistically implementable, then start thinking about coding. It would probably do you some good to start planning out data structures and routines beforehand. Also, determining simulation milestones could help keep you focused as well.

Also, a note on AI. If you're not familiar with AI concepts already (like neural networks, genetic algorithms, etc.), you really need to do some reading. For starters, adding true AI requires "training" time to teach the AI structure(s) what is "good" behavior and "bad" behavior. Accomplishing that is a project itself.

I'm not trying to dissuade you from doing this, but to help you go in with eyes open. I've played around with the idea of writing a BattleTech simulator, but scrapped it when I realized how ridiculously complicated it would be (regarding AI). That doesn't mean it can't be done; I just don't have the time to devote to it. It is entirely possible you don't have the same constraints on your time.

Good luck.
 
Old 06-12-2005, 06:08 AM   #4
NCC-1701&NCC-1701-D
Member
 
Registered: May 2005
Distribution: Debian Woody,Knoppix
Posts: 88

Original Poster
Rep: Reputation: 16
Thanks!
 
Old 06-13-2005, 01:11 AM   #5
swatward
Member
 
Registered: Jan 2005
Distribution: slackware
Posts: 83

Rep: Reputation: 15
I think they used a war simulator called Massive for LOTR, if you have the two towers DVD special edition, its on there somewhere. Check that out for ideas or whatever. Its pretty cool, they actually just use that program for a lot of the battles in lord or the rings
 
Old 06-13-2005, 03:00 AM   #6
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Or just watch the part of War Games where the super computer plays tic-tac-toe against itself...
ta0kira
 
  


Reply



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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
C simulation shegay18 Programming 4 06-14-2005 07:49 AM
LcdDisplay simulation chrisstooss Linux - Software 2 05-28-2005 04:44 PM
Ossiloscope simulation software... TanelValdna Linux - Software 3 09-09-2004 01:28 PM
Simulation progam AquamaN Programming 2 03-15-2004 07:26 PM
Wake-On-Lan Simulation? Breezwell Linux - Networking 9 07-08-2001 01:09 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration