Game in C++

Posts 1–8 of 8 · Page 1 of 1
Game in C++
Ok I am clueless where to put this since it doesn't seem to exist any forum where we can discuss game development so I decided to go with C++/C since I do code it in c++ lol, and also there are probably people here that knows assembly (which is not needed really to give me advices but it's a advantage, asm forum seems to be more dead also).

To the thing, sorry for the confusing beginning
I am making a game somewhat similar to Core Wars, link here if you don't know about it: Core War - Wikipedia, the free encyclopedia
My game is loosely based on Core Wars because I never really got into it, however I found it very interesting to try & develop my own version.

However the main idea is the same, release two warriors coded in a assembly like language into a "memory arena" and let them take turns executing their instructions until one of the warriors die by executing a faulty instruction.

Atm, I finished the basics of how I want it (game is still buggy but works). I emulate the memory by using a char array[1000] and I parse the warriors from text files and then drop them into a random position in the memory, with a specified minimum space between them. I also keep addresses to access for each instruction in a separate array.I have come up with 4 operations to use in the warriors so far, they are simplified asm operations:

*MOV 50 for example - moves the whole warrior 50 addresses ahead, it takes as many turns to perform as the number of instructions the warrior program got. Then it continue to execute from the new address.

*JMP 50 - jump 50 addresses ahead continue to execute any instruction found on that address.

*DAT 50 - Drops a faulty instruction, if the enemy tries to execute it, it will die =)

*NOP - Self explanatory, do nothing.

I understand it may seem a bit confusing if you never even got in touch with the concept by playing core wars so I will show it looks in my game right now (I print out the memory array on the screen for each turn, the DM/DDDJ is the warriors and - is empty memory addresses)

--------------------------------------DM---------------------------------
--------------------------------------------------------------------------
--------------------------------------------------------------------------
---------------------------DDDJ------------------------------------------

This is in the beginning of the game, you can see the both warriors represented in the memory by their signatures, the first has DM which means it has a DAT and then a MOV instruction, the other one has 3 DAT's and one JMP. So for example the second warrior would put a faulty instruction on 3 addresses and then jump back to the beginning of itself.

Maybe I should also mention that the memory wraps around itself, since you got 1000 addresses in total, if a instruction executed on address 900 to mov the warrior 400 addresses ahead it would end up on address 300.

Well I have no idea if someone even bothered to read this far but here comes the thing I would like some help/ideas on, atm I almost always get ties between the warriors. There are too few operations/options to choose between when coding the warriors, atm they just tend to move/jmp around in memory and DAT'ing the same addresses all the time, always missing each other. If anyone have same cool operations/options to come up with I would be really happy, they don't neccessary need to be connected to asm in any way. Just ask if it was something you didn't catch about how my game works and I'll explain it to you.

I'm thinking about adding a split process operation which the original Core Wars also have, that spawns a new process for the warrior and then it takes turn executing the warriors processes. Should make it a little more interesting. I think this whole game development thing is hard, on one hand I don't want to "control" the game too much and deciding exactly what approach would be best to win it because it's funnier for players to find their own strategys, on the other hand I don't want a boring game or a game where you can come up with one solution that always beats all the others.

Ty if you had the patience to read, and even more ty's if you give me some input/feedback
Very interesting project indeed. I don't quite understand what you're asking for and I have no idea how the game works. The way you explained it was confusing.

I couldn't find a working download for the game so if you'd be kind enough to post a link that would be nice.
Quote Originally Posted by Void View Post
Very interesting project indeed. I don't quite understand what you're asking for and I have no idea how the game works. The way you explained it was confusing.

I couldn't find a working download for the game so if you'd be kind enough to post a link that would be nice.
This one should work: http://www.koth.org/pmars/pmarsv.zip
Maybe have to put in compatibility mode for win98 though.

Yea I understand it was confusing, it's very confusing to explain also took me long time

Basically what I'm asking for is tips on what operations I should implement in my game. If you look up core wars it has got 10 different operations for the warriors to use in the original standard, then 18 in the updated standard etc. I wanted to make a different and more easy game to code warriors for, not having to know about so many asm operations or at least make them easier to use for the players.

Perhaps you understand better if you have a look at the game, documentation and some example warriors. Maybe I can also post a beta of my game later with a better readme etc.
Quote Originally Posted by ctpsolo View Post
This one should work: http://www.koth.org/pmars/pmarsv.zip
Maybe have to put in compatibility mode for win98 though.

Yea I understand it was confusing, it's very confusing to explain also took me long time

Basically what I'm asking for is tips on what operations I should implement in my game. If you look up core wars it has got 10 different operations for the warriors to use in the original standard, then 18 in the updated standard etc. I wanted to make a different and more easy game to code warriors for, not having to know about so many asm operations or at least make them easier to use for the players.

Perhaps you understand better if you have a look at the game, documentation and some example warriors. Maybe I can also post a beta of my game later with a better readme etc.
Well if you want to make it more complex ur going to need more instructions.... hmmm but at the same time you don't want to make it difficult huh? Well how about setting traps. for instance:

When you can put another other instructions other then the DAT instruction. Like a cmp. And this is in no way like real asm, but the opponent couldn't move until he used the right instruction.

So cmp jmp would only allow the opponent to move if he jumped, not mov.

And now mov ing and jmp ing are kind of the same. moving should involve the program moving forward in memory by touching every space in between its destination. and of course NOPing would defeat DAT correct?
Quote Originally Posted by zeco View Post
Hmm, This seems like a really cool game, I'm curious about how it is written. I'll be sure to give you suggestions of operations when I think of some. Be sure to release and Alpha or Beta =)
Thanks. Yep I will for sure release it when I finished a Beta with some more operations and I also need to wrap everything up because I yet have to add things like keep count on who has won most of the rounds, atm the whole game is scattered with debug info for me.

Quote Originally Posted by why06 View Post
Well if you want to make it more complex ur going to need more instructions.... hmmm but at the same time you don't want to make it difficult huh? Well how about setting traps. for instance:

When you can put another other instructions other then the DAT instruction. Like a cmp. And this is in no way like real asm, but the opponent couldn't move until he used the right instruction.

So cmp jmp would only allow the opponent to move if he jumped, not mov.

And now mov ing and jmp ing are kind of the same. moving should involve the program moving forward in memory by touching every space in between its destination. and of course NOPing would defeat DAT correct?
Thanks, your post was really useful!

These are good ideas. I've also been thinking about some sort of traps, I will definately add support for writing other instructions than the DAT because that way, one of the warriors could for example scatter the memory with pointers to itself, turning the other warrior into a zombie program . That already happened accidentely y-day when I had one warrior that simply moved 1 step ahead in memory every time (like the Imp for Core Wars) and another that stayed in the same position all the time putting DAT's, the Imp got caught up in the second warriors instructions when it reached it.

As for what you say about the moving, I suppose it could be done kinda easily. They do differ atm since you can jump immediately but have to wait a given time (depending on number of instructions) if you use mov. But it's too easy for small warriors to move around in the memory so I will think about switching it to your idea.

What do you guys think about some operation that let's you peek a memory address? Like, check if there is a DAT there and if so NOP it? It would be an advantage on one hand but it would also cost the warrior 2 turns to check and then nop if there was a DAT, which in the end costs the warrior a lot of turns in order to do this. Finally I'm also considering adding some operation to retrieve game info like what the current round number is, to allow the use of different strategies depending on eary-middle-late gameplay.
Thanks for the advice John, but usually its called "bumping" when you reply to a post, a little over a week old. Im not sure how fast topics might go on any forum you're used to, but if you want to tell the user this you can send him a PM (private message) by clicking on his/her name. Unfortunately I'm going to have to close this. =/
Hmm, This seems like a really cool game, I'm curious about how it is written. I'll be sure to give you suggestions of operations when I think of some. Be sure to release and Alpha or Beta =)
Posts 1–8 of 8 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us