View Full Version : Empire AI in C#
nvoigt
08-13-2001, 08:08 AM
Hi people,
I'm going to dive into C# and for a first testing project,
I'll write a game. Does anyone know Empire ? Back in
the Atari ST ages ? Strategy game, simple, about 8
different units and 2 terrains ( land & water ).
I'll go for it :)
I will post the game AI's class here, so everyone can
derive an AI of their own. In the end we could have a
nice AI fight... anyone interested ?
The development will take some time:rolleyes:
so it might be late october until I have a final version.
Please reply if you'd like to join in ...
Sounds good to me. It's a chance to do something fun and take a look at C#.
btw: is c# going to be able to compile for current systems, or is it only going to be .NET? And is .NET going to be like the old (and failed) plans to have a "computer utility", or will you still be able to buy and run standalone products? I don't think people want to "rent" products...
nvoigt
08-13-2001, 10:27 AM
There is a project under way to convert the .NET framework for Linux. If this succeeds, C# programs
will run in Linux environments as well.
C# is a programming language like any other.
You can sell standalone apps. You can rent
apps. You can print your sourcecode and use
as wallpaper... whatever you like.
:p
Witch_King
08-13-2001, 10:11 PM
An asteroids game would be a lot more fun. Do you know the game? It's the one where you are the ship that travels thorugh the asteroid field. You can fire lazers and you have sheilds, plus you can get weapon upgrades or energy upgrades and stuff like that. Now that would be the game! Arcade Style action.
nvoigt
08-14-2001, 02:12 AM
*g* yes, Asteroids might be more fun... I had that one
on my Atari, too. However, what made me play 'till dawn
were games like Empire :)
Plus it's not real time... some GDI+ graphics drawing
green and blue tiles and units on them shouldn't be
too hard ;)
Witch_King
08-14-2001, 02:39 AM
I've never played Empire although I am also a fan of role-playing games. I'm familiar with some titles on N64 such as Zelda64 and Mario64. Also, I tried out PSII, which was quite nice. Forgot which titles.
Whatever you come up with, I'd be happy to be a tester. Keep people updated, and good luck.
minime6696
08-21-2001, 01:54 PM
My god! Why is it everyone here is getting into C# and Java. Becouse you dont know graphics? Is C++ Too hard? Come ON! All of the net hype amounts to little, I would love to see a professional game or ANYTHING made in Java or C#, lolz I would SO LOVE to see an API written in C#. Microsoft and Sun are setting up to control everything with these things, you can't do anything without them wanting you to! I am not doing any C# and I hope the real programmers on this board agree! I do a bit of Java, becouse it has it's place. The Internet languages in my opinion belong doing what they are doing, makking menu's and little popup games, not becoming the main language. You all act like C++ is a stepping stone to the real languages, its the other way around, ASM, C++, and PASCEL are the real languages and the net stuff is the stepping stone, whtich I took in 5th grade.
SPH
LOLOLOLOLOLZOZOZLOLZOLOZLZ!!!1 @# ROOOOOOFLE!!! C! C! C!
nvoigt
08-22-2001, 03:33 AM
The Internet languages
When will you learn that Java and C# are not Internet languages ?
Could it be you are badmouthing things you never even tried ?
Why is it everyone here is getting into C# and Java
C# because I love to learn new things. I like to know
why I'm doing C++. You obviously use C++ because
you don't know how to use the other languages.
I like to have a reason why I use C++. I'm using it
because it's the best tool for the job. If a new tool
pops up, I have to test and reevaluate. Maybe the
new one is better.
Oh, and I use Java, because I have to. It's the best
tool for interfacing with our Oracle database when
creating stored procedures that are a little more
complex than normal.
I would love to see a professional game or ANYTHING made in Java
Well, install an Oracle database and administrate it.
All the tools are written in Java. Execution speed
sucks, but that's definetly a professional 'anything'
to notice.
I hope the real programmers on this board agree!
From my post starting this thread you might get the
impression I don't. And you are right. The 'real'
programmers, the professionals, the ones coding
40 hours a week will tell you to use the tool best
suited for the job. If that happens to be C#, tough
luck. But the 'real' coders don't have that much of
a problem switching languages. After all a language
is just a means of getting your program across.
The real work is not the syntax.
So, let's see... here are some easy questions for us.
Try to think about it.... how much basics do you know
about the languages in use today ?
Do
1) Java
2) C#
3) C++
4) VB
... have a keyword comparable to 'unsigned' ?
... have a keyword comparable to 'const' ?
... compilation products run on more than one system ?
... have libraries for Windows RAD ?
... have interfaces for DirectX ?
... have primitive datatypes ?
... have OOP ?
... have database tools that are part of the basic installation ?
... have the ability to create applets ?
... have the ability to drive webpages as 'codebehind' ?
... have opensource and/or free compilers available ?
Hint: C++ can NOT do all of it :p
minime6696
08-22-2001, 08:48 AM
You've misunderstood my post, the whole point of it WAS what you where just saying. I was saying that java and C# should be used for what they are good for. I know some VB, I know some Java, I've never tried c#, since it's new. C++ CAN have anything. You forget it is the creator of all that stuff, so it DOES have all of that stuff, just not in the same way. AND You forget C++ IS webpages, Not only are the browsers programmed in it (without that there would be no net languages) the interpreters, AND all of the drivers and such that support it!!! Theres an abuility to create "applets" its just not built it, you have to do it yourself. Make a dll that has a class wit han onButtonClick. Or make an applet interpreter it doesnt matter. Im saying java belongs on the internet, not makking professional programs. Its cool you made it, but its slow, so does it really belong as something you would sell and pur your name on? I didnt think so.
SPH
So you're saying there are no professional apps for the internet? Go to www.oracle.com (that's it, right?) and see. DBs are extremely important, and these "internet" languages make it easier to manipulate and deal with them. Sometimes you have to.
And those languages provide such great time wasters, such as rogue remade:
www.hexatron.com/rogue/index.html
mmmm
ski6ski
08-24-2001, 11:59 AM
I think that if anyone wants to make anything with any language and they have that ability to do so........then so be it! Just because you (anyone) can't do it, does not mean that someone else can't either. So if someone wants to create a game in C# GREAT!! I would like to learn C# just because it is new. I know java,VB,C++ and html. So adding C# would just make me a little more valuable.........;)
SilentStrike
08-24-2001, 03:07 PM
I don't think this is gonna be a professional game, more of a kind of hobby project to apply the langauge to. Regardless, I think it will be fun to see. I'd like to see more projects that people have completed/are working on from the posters on these boards.
nvoigt
08-24-2001, 03:34 PM
Just to clarify that, my "first testing project" is
definetly NOT a professional game. Once it's ready,
anyone interested can have the source.
It will be small and simple, maybe it'll suck.
The way I planned it so far there will be a server
and multiple clients. The server runs the game.
Each client can be driven by a program or a
User Interface. Program driven Clients are
obviously computer opponents.
no-one
08-25-2001, 12:15 AM
ignoring all posts except the original...
this sounds to be an excellent idea to me though i don't have time to learn C#(and it looks like java so i doubt i'd learn it any i just cant stomache the form/look of the language) so i cannot participate but its an excellent test for the language...
Witch_King
08-25-2001, 01:29 AM
I'd like to know if nv knows XML and SOAP. I hear that these are the best languages for web applications, infact after I learn C++ which will take some time yet, I plan to study C# and just as importantly XML.
In my opinion the question isn't C++, it's more C than anything. What I mean is that you have the definition of C, than you have C++,C#,Java, etc. All these lanuages are abstractions of C. Anyway C++ programmers do not solely depend on STL and the definition. Instead they use vendor libraries for graphics. I would think that the would invalidate any comparison of C++ with any other lanuages because most people think of C++ in terms of it's definition. This is not how it is being used though.
no-one
08-25-2001, 01:28 PM
which is in fact the beauty of it...
minime6696
08-25-2001, 01:42 PM
Okay everyone, I wasnt saying its impossible to make a game, I can make a game in java. I was trying to say if you want to be a sierious programmer you can't be doing Java or C#... Unless you're in webpage design. Like I was saying people shouldent go to net languages and BASIC becouse they look promising and easy results, it wont happen quite that easy...
And I am makking a language, i've been working on it 2 days now, it allready has import libraries functions, variables, arrays, winAPI, Console, and starting on OpenGL/DirectX (Once I have data structures). See what can be done in C++ ;) .
If anyone is interested, The lang should be done in about a week, of course its nice to have other peeps helping with import libz :). I'm not sure what I will call it, prolly something like cppapplet or something. I would never say "USe cppapplet and not C++", its just a nice little thing for its purpose: Portabuility, and of course net preofrmance, this has a lot more power than a lot of other "net languages". It is precompiled @ runtime and then partly interpreted, it has some nice features, and some annoying ones! If anyone is interested email me or goto the post im about to put up about it.
SPH
nvoigt
08-27-2001, 09:24 AM
I'd like to know if nv knows XML and SOAP.
I know XML. It's not a language, but rather a standard to define
standards. It's a way of implementing a unified data transfer.
From the draft W3C specification: SOAP is a lightweight protocol
for exchange of information in a decentralized, distributed
environment. It is an XML based protocol that consists of three
parts: an envelope that defines a framework for describing what
is in a message and how to process it, a set of encoding rules for
expressing instances of application-defined datatypes, and a
convention for representing remote procedure calls and
responses.
I was trying to say if you want to be a serious programmer you can't be doing Java or C#... Unless you're in webpage design.
hm... damn, I'm non-existent. I can't exist.
I agree with you that C++ is a better choice for most applications
that doesn't need to be cross-platform. But you will have to learn
that a 'serious' programmer is not someone who does what he
likes. A serious programmer should be able to do whatever his
employer likes. And that might well be VB, Java or maybe C#.
.NET has nothing, absolutly nothing to do with the net. It's just
a name. You CANNOT do webpages with .NET alone. You can
do it in ASP.NET, as well as you can make webpages in ASP
now. You can write C++.NET apps as well as you can write
C++ apps now. The .NET should make it easier, that's it.
And actually, for some occasions, Visual Basic is the tool that
gets the job done in half the time of a C++ programm.
So if a serious programmer has the option of doing his duty
in a week, or doing a load of overtime and maybe working
weekends for doing it in C++, do you really think he'd do it
in C++ ?
And what if you have no other choice ? What will the serious
programmer do if he has to create a stored procedure for the
corporations oracle database ? Quit his job ?
It's one thing to know what you like. But in reality, the best
allround tool might not be the best tool for a special job.
And serious people use the best tool for the job.
TerranFury
08-27-2001, 02:31 PM
Question: All versions of VB (and most BASIC languages) don't have pointers. How do you get anything done?! I know there's the VarPtr function and you can use, in conjunction with CopyMemoryRead, and CopyMemoryWrite, but - like everyone's been saying - you should use the right tool for the right job, and it doesn't seem to me that using WIndows API functions as pseudo-pointers is using the right tool for the right job when many other languages (C++, C, Java, and I assume C#) do have true pointers. I understand why you'd use VB - it makes creating Windows GUIs very, very easy. But most actual logic code, I find, is much <i>harder</i> to do in VB. So how do you "pros" do those kinds of things? Just with lots of DLLs; COM objects, perhaps?
Eber Kain
08-27-2001, 04:42 PM
I used to play the game Conflict for hours on end aginst my dad, we once had a game go on fo 13 hours. Now a revamp of that game would be nice. It was a turn based strat, with a limited number of vehicles and ground types.
nvoigt
08-28-2001, 07:21 AM
>Question: All versions of VB (and most BASIC languages) don't have pointers.
Question: What do you need pointers for ?
References in function parameters: ByRef keyword in VB
Linked List: Ready to use classes in VB
String manipulation: Ready to use classes in VB
Dynamic memory allocation: keyword redim can change arrays to any size dynamically
So for easy tasks that involve user interaction, VB can save
a lot of time. I hate it, but it has it's uses.
TerranFury
08-28-2001, 12:18 PM
nvoigt: You're right about linked lists, dynamic memory allocation, and references. I'm more comfortable with pointers to do those things, but you're right; functions do exist in VB.
But how, then, do you deal with trees? With the exception of simple binary trees (which you can use a linear array for), the only way I can think of doing that in VB is to use a "pseudo-pointer" long integer in a struct, and use the kludgy methods I mentioned before.
And, even with linked lists, whenever you want to do an insertion, you can't just change the values of a few pointers; you have to expand the array size by 1, shift everything after the insertion point down, and then put your item in.
So, basically, what it comes down to is this: If VB had pointers, it would be great. Even the speed concerns aren't as huge nowadays, assuming you have anything better than the Learning Edition, because you can compile to machine code - not the best machine code, I'm sure, but machine code nonetheless, so your code doesn't need to be interpreted - even if it still does need the runtimes. But the lack of pointers is the one thing I simply don't understand. How pople can deal with VB for anything more complicated than a "vector" type data structure is beyond me.
The only technique I can think of is to program all your logic code in C++, and use it from within VB in the form of DLLs. How common is that technique?
nvoigt
08-28-2001, 06:44 PM
Well, actually, VB has the same support for pointers Java and C#
have. All Objects are managed via pointers. Consider this lines
and the New keyword:
Dim db as Database
Set db = new Database
Very valid VB and in fact the only way.
So in theory you could create anything that requires pointers
in VB, too. But normally, for a typical VB program, no complex
structures are required. There are lots of programs that never
use a list or tree or hash table. Those programs using these
constructs almost always require speed. And speed is a
critical drawback of VB. As a user-interface it's acceptable.
As a server or running applications without anything that's even
slower ( user, database... ) it's next to unusable when speed
is required.
TerranFury
08-28-2001, 07:56 PM
So I wasn't mistaken; I really was just running head-first into VB-s limitations. I guess I'm just into the kind of programming that VB isn't designed for! (I was into DirectDraw 7 in Visual Basic. BAAD idea!! VB isn't for games! Good thing I'm now in C++.)
But I guess that's to be expected.
How many high-school juniors that program make business apps? ;)
Witch_King
08-30-2001, 05:24 AM
From what I've heard about VB, it is a RAD language. Rapid Application Development.
VB.NET is a lot more powerful than VB6. It is an OOP language now but C# likely is better. The literature for these brand new languages is just comming out now.
MrBurns
08-31-2001, 02:52 PM
I don't know how the heck this became a rant, but back to the original post:
>> I will post the game AI's class here, so everyone can
>> derive an AI of their own. In the end we could have a
>> nice AI fight... anyone interested ?
Anyone heard of C-Robots? (or P-robots for Pascal). It's kind of the same idea, where you program a robot to fight other programmer's robots. It's pretty ancienct though, and I haven't seen it in awhile. Might be kindof fun if someone could find it...
You can do trees with arrays, to make it dynamic you could resize the array but I have a feeling it would be very very ugly.
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.