January 27, 2021, 07:13:13 AM

Recent Posts

Pages: 1 ... 8 9 [10]
91
General Discussion / Re: Is it Spartacus or the Terminator...?
« Last post by Dabz on January 17, 2021, 03:26:35 PM »
Quote
Plenty of time to kill a lot of Sarah Connors as he's unlikely to ever know he's got the right one when he does.

Everyone needs a hobby though! ;) :D

Dabz
92
SmallBASIC / Re: Modules
« Last post by round157 on January 17, 2021, 02:37:05 PM »


Here is the 32-bit package of builds, please let me know if you find any issues

https://github.com/smallbasic/SmallBASIC/releases/download/v12.20/smallbasic_12_20_i686.zip

Enjoy!

I will try it. Thank you!
93
8-bit / 16-bit retro world / Re: TRSE
« Last post by Steve Elliott on January 17, 2021, 12:59:34 PM »
Quote
Imho Pascal is the superior language to C++

I always liked Pascal and C at College...C++ gets ever larger and larger, with change after change.

Quote
I threw the author £30 in Norwegian Krone so he could buy some beer for his efforts and it turns out that will just about buy 6 cans in his local supermarket.

 :o  crazy prices!

Looks like you're making progress Xerra, good stuff.
94
8-bit / 16-bit retro world / Re: TRSE
« Last post by Xerra on January 17, 2021, 12:48:30 PM »
Been working some more on the simple gamestate to start putting a simple Vic 20 game together, based on a listing I remember typing in my youth. I have a moving ship now and done some other simple stuff which has been a great learning curve. It's probably already a more advanced program when assembled than any of the simple 6502 routines I did back then. TRSE is getting better and better all the time.

I threw the author £30 in Norwegian Krone so he could buy some beer for his efforts and it turns out that will just about buy 6 cans in his local supermarket. Cost of living in Norway must be insane. I could get three cases of Heineken bottles for that.

Here's how the code is coming along, while it's still small enough to throw in a code block.

Code: [Select]
program SpaceSplat;

// *** Vic 20 unexpanded game ***

var 

// Strings
Title : cstring = ("Space  Splat");
Author : cstring = ("by Tony Brice,2021");
Player : cstring = ("(-O-)");

// Integers
Score : integer = 0; // Player score

// Bytes
Lives : byte = 3; // Player lives
Level : byte = 1; // Difficulty level
Timer : byte = 100; // Used with level to adjust game speed
playerX : byte = 10; // Players X position on fixed Y line
gameState: byte = 1; // 1 = title, 2 = game, 3 = game over
playerFired : byte = 0; // Has player fired

// -------------------------------------------------------------------------------
// **** Procedures ****
// -------------------------------------------------------------------------------
procedure RenderTitleScreen();
begin
// Display Title Screen
moveto(5,4,hi(screen_char_loc));
PrintString( #Title, 0, 12 );
moveto(2,7,hi(screen_char_loc));
PrintString( #Author, 0, 18 );
moveto(0,12,hi(screen_char_loc));
PrintString( "FIRE TO START THE GAME", 0, 22 );
end;

procedure HUD();
begin
// Display Hud Information
moveto(0,0,hi(screen_char_loc));
printString( "SCORE-", 0, 6 );
moveto(6,0,hi(screen_char_loc));
printdecimal(Score,4);
moveto(15,0,hi(screen_char_loc));
printString( "LIVES-", 0, 6 );
moveto(21,0,hi(screen_char_loc));
printdecimal(Lives,0);
moveto(0,1,hi(screen_char_loc));
printString( "PRESS UP TO QUIT GAME!", 0, 22);
end;

procedure BeginGame();
begin
// Set up a new game
Score:= 0;
Lives:= 3;
end;

procedure Delay();
var
i:byte = 0;
begin
// Pause to slow game down (if it worked...)
for i:=0 to Timer do wait(50);
end;

procedure PlayScreen();
begin
// Gameplay stuff
HUD();

// Show player ship
moveto(playerX,3,hi(screen_char_loc));
PrintString(#Player, 0, 5);

// Controls
readjoy1();
if (joy1 & JOY_LEFT) then
begin
if (playerX > 0) then
begin
playerX := playerX - 1;
moveto(playerX+5,3,hi(screen_char_loc));
printString(" ",0,1);
end;
end;
if (joy1 & JOY_RIGHT) then
begin
if (playerX < 17) then
begin
playerX := playerX + 1;
moveto(playerX-1,3,hi(screen_char_loc));
printString(" ",0,1);
end;
end;
Delay();
end;

procedure RenderGameOverScreen();
begin
// Display Game Over
moveto(2,11,hi(screen_char_loc));
printString( "G A M E -- O V E R",0,18);
end;

procedure ScreenClear();
begin
// Clear screen
ClearScreen( 32, #SCREEN_CHAR_LOC); // ^$1e00 - unexpanded screen location
ClearScreen( BLUE, #SCREEN_COL_LOC); // ^$9600 - unexpanded colour location
//AUX_COLOR_AND_VOLUME := %00000010;
SCREEN_BG_COLOR := BLACK + SCREEN_BG_WHITE;
screenmemory := #SCREEN_CHAR_LOC;
end;

// -------------------------------------------------------------------------------
// **** Main  Loop ****
// -------------------------------------------------------------------------------
begin
ScreenClear();
while (true) do
begin
readjoy1();
if (joy1pressed & JOY_UP) then
begin
if (gameState = 2) then
begin
ScreenClear();
gameState := 3;
end;
end;

if ( joy1pressed & JOY_FIRE ) then
begin
if (gameState = 1) then
begin
ScreenClear();
gameState := 2;
// Reset the score and lives on a new game
BeginGame();
end;

if ( gameState=2) then
begin
if (joy1pressed & JOY_FIRE) then
begin
// fire weapon
end;
end;

if (gameState=3) then
begin
ScreenClear();
gameState := 1;
end;
end;

if (gameState=1) then RenderTitleScreen();
if (gameState=2) then PlayScreen();
if (gameState=3) then RenderGameOverScreen();
end;
end.
95
General Discussion / Re: Is it Spartacus or the Terminator...?
« Last post by Xerra on January 17, 2021, 12:43:41 PM »
Yeah, not so sure that's a good idea. If you remember, the Terminator searched through a phone book and found three Sarah Connors and murdered the first two. Initially he wasn't murdering too many other people unless they got in his way but you imagine what he's going to do if all the women had that name. Remember, his battery lasts for nearly 120 years. Plenty of time to kill a lot of Sarah Connors as he's unlikely to ever know he's got the right one when he does.

96
General Discussion / Is it Spartacus or the Terminator...?
« Last post by Matty on January 17, 2021, 11:42:06 AM »
Good night peoples...here's an amusing twist to Terminator movie:

When Kyle Reese and Sarah Connor questioned by police psychiatrist they actually believe Kyle and put a strategy in place that every woman in the county will temporarily go by the name of Sarah Connor until the terminator is killed.
97
Worklogs / Re: Genetic Algorithms and Machine Learning in wargames
« Last post by Derron on January 17, 2021, 11:20:41 AM »
You already did the basics: give scores to achieved results. So each iteration ("simulation of a game") the score defines how good it reached the desired results.

If you want to take different tiles (slow movement etc) into consideration, then just give the movement a kind of "effectiveness" value - similar to your map and the distances. This way your AI can optimize for "effectiveness" too - and learns to move to a certain goal in less amount of time. BUT ... it also learns that it sometimes needs to move through a swam as it still is faster than cirvumenting it (more moves = less effective, more moves might allow the enemy to move too).
Give tiles bonus or malus on attacks to other tiles (mountain -> grassland) and the AI will effectively use that too.

At the end you get your neural network and you can use it to do movement and attacks.

Of course it surely misses a lot of steps but in theory this sounds as if it should work (I never simulated AI stuff for games, just for other purposes).


bye
Ron
98
Worklogs / Genetic Algorithms and Machine Learning in wargames
« Last post by Pakz on January 17, 2021, 09:14:52 AM »
I was looking for programming books and found a book titled "Genetic Algorithms and Machine Learning for Programmers: Create AI Models and Evolve Solutions" It was in a list of bought by others who bought "Mazes for programmers" This is a book I have and thought was readable.

When I was waiting for it to get delivered I decided to experiment with what I had learned from previous books. This a Genetic algorithm.

I wanted to see if I could put the algorithm in a strategy war game setting. This were it moves units to capture a city and take out as many enemy units as possible.  I had coded it so it has a small map set up in a multidimensional array. 4 vs 4 units and a city. The code picks random spots on the map and gives a movement instruction at the same time. All this gets stored. This gets done a x amount of times and than gets reviewed if anything worth while happens. Will any units get destroyed or any units get close to goal.
A number of the best scoring sets get copied and mutated. The mutating is done by redoing a percentage of the instuctions from %..end of the instructions. A number of new instruction sets get added also.

The results after a x amount of runs was that they were able to capture the objective and take out most or all of the enemy fortified units. Though when modding map later on it appeared the system did not seem to work on more complex maps. Even when I added a dijkstra map(a map with the distance on each grid to objective)

Here a video of the first working version :



I now have been reading the book for a day or two. It is a fun book I think. Not a academic book. You learn to understand what machine learning and Genetic algorithms are by coding particles/bees/ants/cannon balls etc. out of a paper bag. The first chapter is in the python language and it's turtle library. You learn to make the turtle escape out of a paper bag(2d rectangle on the canvas) Different programming languages are used like javascript, c++, python.

The chapters I liked most so far are the ones about creating a "ant colony optimization" Here you code ants and pheromones and their paths that eventually lead out of the paper bag. The chapter on bees is nice also. Here you make bees teach themselfs to find food sources and exchange knowledge. Inactive bees in their nests store locations and remember these and share this information with other bees.

There is a chapter about Cellular Automata and Conways game of life. You learn about it's history and how to code it.

The book is not thick. There is not a lot of overly complex code and math formula's. Though I think the code could be explained more as I have spent quite some time trying to understand it.

I have now been thinking of how to code ai that learns to optimize a map. Making roads and irrigation and mines and other cities.

I wish there were more books like this!
99
PureBasic / Re: New laptop
« Last post by Pakz on January 17, 2021, 08:27:57 AM »
I bought a new laptop last year. This when the (good reviewed) ones with the new Amd cpu's were in stock. The model is the Lenovo Legion 5 which has great reviews. Cpu Amd 8-core 4800H, 16Gb, 1tb ssd, nvidia 1650ti, 120Hz screen.

The refresh rate is really nice. Minecraft really plays a lot smoother. Scrolling through browser pages is really smooth also. The laptop does not get hot at all and I can not remember hearing the fan at all. I had recorded a 30 minute gameplay video and editing was smooth and the final render was ready in no time. I have not been making larger games or tools yet but compiling feels a lot faster also!

I think I wil get a new laptop during spring or early summer when the new Amd laptops are in stock. The new Amd 5800h cpu should be 23% faster. But it has been said there will be shortages this entire year. The amd laptop I have has only been in stock once since I bought it.

Pages: 1 ... 8 9 [10]
SimplePortal 2.3.6 © 2008-2014, SimplePortal