PDA

View Full Version : attempt to make a game client with simba



MakIAM
11-26-2014, 11:33 PM
Hello everyone. My name is Make.
I am new here. but been a scar user since 3.13.
I was wondering if anyone had some knowledge of reading/loading resource files. "resource hacker .egf file" and/or sending/receiveng packet data "sockets and stuff" with simba to a game server.and/or settransbitmap on forms?
i am attempting a remake of a game Client in simba for a game server "Meow/kalandra/eoserv".
its a 2d RPG multi player type game.based from a game called Endless online.
I have alot of the main stuff remade form/buttons/screens/artwork but almost at a stand still with the project untill i figure a few things out.
few screenshots of the project as of today.
24496
24497

Cnc Welcome

KeepBotting
11-27-2014, 12:00 AM
Is it a Java applet? If so, you *might* be able to load it inside SMART.

Olly
11-27-2014, 01:26 AM
Is it a Java applet? If so, you *might* be able to load it inside SMART.

Take a read.... again.

KeepBotting
11-27-2014, 02:16 AM
Take a read.... again.

Ouch, that was pretty bad.
I need to learn to read more than the title and first few words before I believe myself informed enough to formulate a response.

Thanks for catching me on that.

Incurable
11-27-2014, 02:21 AM
How many lines is that? Also, why not write it in C++/C#/Java/Python?

Daniel
11-27-2014, 02:53 AM
Check out Amethlion (https://villavu.com/forum/showthread.php?t=33693). :)

Similar to what you're doing.

Perhaps try to get into contact with solemn?

Looking forward to reading more about your project :D

MakIAM
11-27-2014, 02:54 AM
How many lines is that? Also, why not write it in C++/C#/Java/Python?
in its current state 3170 lines. im hope to keep it under 10k lines.

i dont know c or c++Java/Python?
i havent coded anything in 25 years. back when you turned the pc on it just blinked....
pascals fine for me. got to start somewhere right?

thanks for the reply's

Incurable
11-27-2014, 03:46 AM
in its current state 3170 lines. im hope to keep it under 10k lines.

i dont know c or c++Java/Python?
i havent coded anything in 25 years. back when you turned the pc on it just blinked....
pascals fine for me. got to start somewhere right?

thanks for the reply's

Eh, fair enough... well, why not learn then? You seem to know what you're doing, so learning another language will be fairly simple. Python is similar enough to Pascal that you could probably pick it up in a few days. :)

akarigar
11-27-2014, 05:55 AM
Hey Make, here is some example code I whipped up related to "sockets and stuff." The comments should explain what is going on in the code itself.
Simple Client:

{$f-}

var socket: integer;
begin
// Create & connect our socket
socket = CreateSocket();
ConnectSocket(socket, 'localhost', '4040');

// Say hello, and get a reply
SendSocket(socket, 'Hello!');
writeLn(RecvSocket(socket));

// Say bye and get a reply
SendSocket(socket, 'bye');
writeLn(RecvSocket(socket));

// Clean up
CloseSocket(socket);
FreeSocket(socket);
end.

Simple Server:

{$f-}

var
serverSocket, clientSocket: integer;
input: string;
begin
// Create & bind our socket so we can accept connections
serverSocket := CreateSocket();
BindSocket(serverSocket, 'localhost', '4040');

// Wait for a socket to connect
ListenSocket(serverSocket);
clientSocket := AcceptSocket(serverSocket);

// Keep listening and responding until client says 'bye'
repeat
input := RecvSocket(clientSocket);
SendSocket(clientSocket, 'Server says: ' + input);
writeLn('from client: ', input);
until input = 'bye';

// Clean up
CloseSocket(clientSocket);
CloseSocket(serverSocket);
FreeSocket(clientSocket);
FreeSocket(serverSocket);
end.


As for the egf files, you can read and interpret them. Do you want examples on how to read from files in Simba? Interpreting the files will be challenging, if my limited understanding of Elmer Front is correct.

MakIAM
11-27-2014, 07:23 AM
Hey Make, here is some example code I whipped up related to "sockets and stuff." The comments should explain what is going on in the code itself.
Simple Client:

{$f-}

var socket: integer;
begin
// Create & connect our socket
socket = CreateSocket();
ConnectSocket(socket, 'localhost', '4040');

// Say hello, and get a reply
SendSocket(socket, 'Hello!');
writeLn(RecvSocket(socket));

// Say bye and get a reply
SendSocket(socket, 'bye');
writeLn(RecvSocket(socket));

// Clean up
CloseSocket(socket);
FreeSocket(socket);
end.

Simple Server:

{$f-}

var
serverSocket, clientSocket: integer;
input: string;
begin
// Create & bind our socket so we can accept connections
serverSocket := CreateSocket();
BindSocket(serverSocket, 'localhost', '4040');

// Wait for a socket to connect
ListenSocket(serverSocket);
clientSocket := AcceptSocket(serverSocket);

// Keep listening and responding until client says 'bye'
repeat
input := RecvSocket(clientSocket);
SendSocket(clientSocket, 'Server says: ' + input);
writeLn('from client: ', input);
until input = 'bye';

// Clean up
CloseSocket(clientSocket);
CloseSocket(serverSocket);
FreeSocket(clientSocket);
FreeSocket(serverSocket);
end.


As for the egf files, you can read and interpret them. Do you want examples on how to read from files in Simba? Interpreting the files will be challenging, if my limited understanding of Elmer Front is correct.

Thank you very much for the examples. this is going to be very helpful.
this is for lape correct?
would the simba/pascal usage be about the same?

and yes please, if you have any examples of reading/loading graphics files.
that would be awsome...
here is a link to a sample gfx..egf file //under 5 post so i cant post a normal link.srry
h t t p s://w w w.mediafire.com/?ks6wp13pt1lv30v
it opens with reshacker and has rc data too?

i figured if i could'nt load them i would have to make a .ini file with the bitmap strings in it.

thank you again for the examples.

akarigar
11-28-2014, 12:32 AM
Thank you very much for the examples. this is going to be very helpful.
this is for lape correct?
would the simba/pascal usage be about the same?

and yes please, if you have any examples of reading/loading graphics files.
that would be awsome...
here is a link to a sample gfx..egf file //under 5 post so i cant post a normal link.srry
h t t p s://w w w.mediafire.com/?ks6wp13pt1lv30v
it opens with reshacker and has rc data too?

i figured if i could'nt load them i would have to make a .ini file with the bitmap strings in it.

thank you again for the examples.

No worries, glad to be of help. I would imagine the example should be about the same if you're using the Pascal interpreter, if it isn't, let me know and I can take a look.

The link doesn't seem to be working for me. If you can make ini files, it would be much simpler to work with since you can use the following ini related functions.

function ReadINI(const Section, KeyName, FileName: string): string;
procedure WriteINI(const Section, KeyName, FileName: string);
procedure DeleteINI(const Section, KeyName, FileName: string);

Daniel
12-01-2014, 11:53 AM
Check out the Simba documentation (http://docs.villavu.com/simba/scriptref/files.html) for reading from and writing to files. :)

MakIAM
12-05-2014, 07:21 PM
@ daniel
thank you. i will check these out more this week.
i have been working on trans bitmaps this past week. what a head ache.
@ akarigar
the socket stuff seems to be about the same. but i havent figured the usage out yet."time out errors and stuff.

thanks for the help so far.

MakIAM
12-14-2014, 09:17 AM
thank you both. i have spent the last weeks learning to draw in simba. will be working on the sockets and reading from resource more soon.

P1nky
12-14-2014, 10:57 AM
thank you both. i have spent the last weeks learning to draw in simba. will be working on the sockets and reading from resource more soon.

Looks great dude! Keep us updated, and I sure hope to try out the final piece :D!

MakIAM
12-31-2014, 08:01 AM
working on a ver of a map editor. got movement of player with attack and sit work on another script.
i need idea's on how to make it draw faster. maybe larger tile group draws at one time, or maybe multi timer thread draws.
C&C welcome on this script.
program MakesMapMessV20;
// you can change the map size at end of script mapsizx and mapsize y
var
DsgnForm:TForm;
TLabel0: TLabel;
Ground:TImage;
groundlayer,Tile,BmpW,BmpH:integer;
GroundPicture,bmps1: TMufasaBitmap;
bmp1,GroundRenderdPicture: TBitmap;
a,b,TileRowX,TileRowY,MapSizeX,MapSizeY,TileId:int eger;
c,d,filename,StringOutPut:string;
const
default = 'Comic Sans MS';

procedure YourClickProcedure(Sender: TObject);
begin
//GetBitmapSize(GroundLayer,Bmpw,BmpH);
//StringOutPut:= CreateBitmapstring(GroundLayer);
//WriteLn('This will be saved in a ini file ' + IntToStr(BmpW));
//WriteLn('This will be saved in a ini file ' + IntToStr(BmpH));
//WriteLn('This will be saved in a ini file ' +StringOutPut);
Ground.Left:=Ground.Left-32;
Ground.Picture.Bitmap.handle:=GroundRenderdPicture .handle;
end;
procedure YourClickProcedure2(Sender: TObject);
begin
TLabel0.Caption:='Done';
Ground.Left:=(DsgnForm.Width/(2))-a;//will be based from player x y from warp/or database login start x y info
SetTransparentColor(GroundLayer,clblack);
SetTransparentColor(Tile,clblack);
for TileRowY:= 0 to MapSizeY do //row drawing down/left
begin
for TileRowX:= 0 to MapSizeX do //row drawing right/down
begin
a:=a+32;
b:=b+16;
FastDrawTransparent(a,b,Tile,GroundLayer);
SetBitmapname(GroundLayer,'GroundLayer');
end;
a:= (a - (MapSizeX * (32))-(64));
b:= (b - (MapSizeX * (16)));
end;
GroundPicture:=GetMufasaBitmap(GroundLayer);
GroundRenderdPicture.free;
GroundRenderdPicture:=GroundPicture.ToTBitmap;
Ground.Picture.Bitmap.handle:=GroundRenderdPicture .handle;
Ground.onclick:=@YourClickProcedure;
end;
procedure InitForm;
begin
//DsgnForm\\
DsgnForm:=TForm.Create(nil);
with DsgnForm do
begin
Caption:='Render a Custom map V.20';
Left:=1;
Top:=1;
DsgnForm.Width:=820;
Height:=840;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=0;
color:=clblack;
onclick:=@YourClickProcedure2;
//onshow:=@YourClickProcedure2;
end;
GroundLayer:=CreateBitmap((MapSizey * 33)+(MapSizeX *33)+1000,(MapSizey * 33)+(MapSizey *33)+1000);
SetTransparentColor(GroundLayer,clblack);
SetTransparentColor(Tile,clblack);
a:=(MapSizey * 32)+1;
//Screen\\
Ground:=TImage.Create(DsgnForm);
with Ground do
begin
//TileId:= 4;
//d:= 'News Info';
//FileName := AppPath + 'NewsTest3.ini';
//c:=((ReadINI ((d),(IntToStr(TileId)), FileName)));
c:='meJzVWGtXWkcUPTwFhRoN4vAWTUzarP6E9kM+dEWDD1RQg i8EAggIiDxFnslKTdKsdrU/uHP25TaaNm1eajqL5boMc8/ss88+Z85IdFVDFEmckchd2QZXNu4MLL64UQTowe+Tok5ij0T1p jF92BAVElkS2ySekAiSqJFoMnhRIrFP4uCm8b1/iC6JFgAfAX+eRJJEiMQmiQiJHRJREqcknvGCr2pIzP6O2VHXMO wYqE4B/y4+8mEFyGVcTkj04GCf43LjgyEVmeeZrMmR1YgMiaeYjJM4ZuT ODa3/zMyA5eQW+atm13Mdfy1zXnOwTm4G+eQCi1kskziEvNdIhEkMAH uDxCqT7EkaHDEN819HRGLkOTA4C1oZC1dBe7dh4ZXryO6V60PO 2FbBs8S/SMx5gmSp4a8K8gg0s42EXcfnCLpaRRY0WGCOoMa1oePXt9SUb7 LvV4t8BUE/Aga5bwHUtfG3gJkGfs1hZR7Py3AwBgcfY2ULaGU40jIKOgnbkd fMN638uhKL4JdHbluBzvPYIgF4VXKsa9xhnf0R2QOAV8V8Amvy vF6+Nb0AqIsIzSaKagZOBVGOqkiEDXJv6XlNiJ3iyCbo29cTXw Q5c1gEvVVy5/XugZ4LyAkXEFddN9+xTm3qratkX2b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WJ+/A6Hiu4fkzQNoDCVFY6AFMFPxEkDUhuKa0TEdqFnTxaxnP5U9sj RTO/b+YXW0dc5WCqexQw76XRu/AwNul1FgUh+3cg18nXWfc2zD+pNqj1mn2tVm+KK35asbhveDiN SGFoMTYEXmbkHcKNt7+FOSXvDgC5wcMgOt/XstJF4NIlCazDFaz6mePZnomx55GKSnehsHXGVFy1v/KLCXkaui8fSMbicJsFuCPkSzKuZAheZuQd4rPhX7RC8RCFhxPT 89kJtRYLGLH0gX8YYQjCNea5Grp3C907EsX9X8PvZzitcJ8BzN K770BRwZfEPhlL8rQbRwq7VzAnFMfKshZRQwZ6EcpjE31dtOCo pSbZhiNxDqEtAMqIleF/JIXi5D08QX86zgpcjTXHZ352cQ/dej7P2wMNTF0wXmiZb9C7Ij/3Dwrk30b+OMwGLgO5Je8+At8Tb3XJNTLb5s8NYNsI4d93T7L5t 6rcWdXy1Wlj9BsqVeAa+H8vV7k6O5zi/eFUcrG2dd+92aC8adp/vwbdkpp7Y4g+zJ0VYBHUWgme5PILw5mvkvemvH+y3GuS8rBHQP gGvgPISMUd3CWfYXj3vk4A66itBaRpDX1thsH/1VyDj7uMnL9Y3gjiELhGfWSm/iq/3n498EN0j7UUidX791e8f8yZApc9fgTuiYN3g==';
Parent:=DsgnForm;
Ground.Left:=0;
Top:=0;
Width:=(MapSizey * 32)+(MapSizeX *32)+1000;
Height:=(MapSizey * 16)+(MapSizey *16)+1000;
bmps1:=GetMufasaBitmap(BitmapFromString(64,32,c));
bmp1:=bmps1.ToTBitmap;
GroundRenderdPicture:=bmp1;
Picture.Bitmap.handle:=GroundRenderdPicture.handle ;
onclick:=@YourClickProcedure2;
end;

//TLabel0\\
TLabel0:=TLabel.Create(DsgnForm);
with TLabel0 do
begin
Parent:=DsgnForm;
TLabel0.Caption:='Click Any Place To Start';
Left:=79;
Top:=74;
Width:=38;
Height:=14;
Font.Name:=default;
Font.Color:=clWhite;
Font.Size:=18;
end;
Tile:=CreateBitmap(64,32);
Tile:=BitmapFromString(64,32,c);
end;

procedure SafeInitForm;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('InitForm', v);
end;

procedure ShowFormModal;
begin
DsgnForm.ShowModal;
end;

procedure SafeShowFormModal;
var
v: TVariantArray;
begin
SetArrayLength(V, 0);
ThreadSafeCall('ShowFormModal', v);
end;
//start\\
begin
a:=(MapSizey * 32)+1;
b:=0;
MapSizeX:=65;//downright rows x //mapsize
MapSizeY:=65;//downleft rows y //mapsize
SafeInitForm;
SafeShowFormModal;
bmps1.free;
freebitmap(Tile);
GroundRenderdPicture.free;
freebitmap(2);
freebitmap(GroundLayer);
//DsgnForm.free;//crashes simba on clicking simba after DsgnForm.free hmm

//this timage "Ground" dont free but also it do not show as Notfreed in debug box ,but i see mem sticking in task manager if this not there//Ground.free\\. hmm
Ground.free; //this frees it from mem after you stop script.if not after running multi times mem loads up and crashes

end.

Frement
01-07-2015, 08:35 AM
Got any more of those pretty pictures of this project? :)

MakIAM
01-08-2015, 11:48 PM
Got any more of those pretty pictures of this project? :)
i do. but i will have to learn some more things before the code is updated where i can add the artwork./objects/walls/shadows ,things like that.
I have been drawing the last two years to get enough artwork to add in this project.
thanks for the feedback and interest