Jump to content




Virus gladiatorial arena


24 replies to this topic

#1 HDeffo

  • Members
  • 214 posts

Posted 03 March 2016 - 10:47 PM

pastebin get emphec23 arena

Posted Image(thanks bomb bloke for the gif)


One thing I have learned from these forums is CC users love viruses and pranks. Sadly malicious code is not allowed on here ;) nor is it really that possible in a sandboxed environment like this one. So now I present to you the next best thing! A game which lets you harmlessly vent your frustrations as you crush other programs in a virtual arena!

The gladiatorial arena features a semi sandboxed environment with an arbitrary file system. Instead of having file names all programs are stored in "blocks" which are numbered 1 to the size of the arena. Not even a program by default knows what its own location is. The functions for competing are simple and the goal even simpler. Be the last virus standing amongst the digital blood bath

fs.open(block,type)
block must always be a number and less than the size of the arena. the type is either "w" for write or "r" for read. However, this wouldn't be a game without a few catches
catches

fs.check(block)
returns -1 if a block has been deleted. 0 if a block is empty. and 1 if the block has a file in it currently (can't make this return something easy can I?
catches

fs.delete(block)
deletes a block. pretty straight forward
catches

fs.create(block)
creates a new block within the size of the arena
catches

fs.size()
returns the size of the arena. No catches and no sleeps.

fs.resetTimer(string)
Your most important function! A program must call this at least once every 10 seconds or they lose. to call it simply pass your programs original file name as a string no sleep in this either so if you can call it you may as well



USAGE:
arena size virus1 virus2

example
arena 1000 limbo abyss



Thanks for reading!

Edited by HDeffo, 03 March 2016 - 10:57 PM.


#2 Creator

    Mad Dash Victor

  • Members
  • 2,168 posts
  • LocationYou will never find me, muhahahahahaha

Posted 04 March 2016 - 07:50 AM

So we kind of create our own scripts that have to terminate other scripts.

This sounds awesome! Finally something with strategy.

#3 HDeffo

  • Members
  • 214 posts

Posted 04 March 2016 - 11:05 PM

Exactly :3 I might hold a contest using this program sometime soon

#4 Antelux

  • Members
  • 295 posts
  • LocationSomewhere in the middle of nowhere.

Posted 05 March 2016 - 06:29 PM

I like this idea quite a bit. So, I felt inclined to make it a bit more fun to watch. :P
Posted Image

Edited by Detective_Smith, 05 March 2016 - 06:29 PM.


#5 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 06 March 2016 - 12:00 AM

It sort of reminds me of ye olde defrag display, only I've got no idea what's going on... Still, it's got the same "lava lamp" quality that keeps you watching.

#6 HDeffo

  • Members
  • 214 posts

Posted 06 March 2016 - 04:57 AM

That's actually really cool. I might just tweak the code to display the battle in a similar fashion thank you for the idea!

I mostly left the screen boring because I figured viruses would want to have some fun with the screen while they attacked each other :P but could be a fun optional setting

Edited by HDeffo, 06 March 2016 - 05:04 AM.


#7 Antelux

  • Members
  • 295 posts
  • LocationSomewhere in the middle of nowhere.

Posted 06 March 2016 - 05:14 AM

I'm glad you liked it! I thought it was fairly interesting to watch.
Though, I've been working on some nicer displays for it. Perhaps I'll show it sometime when it's done. :P

#8 HDeffo

  • Members
  • 214 posts

Posted 06 March 2016 - 06:26 AM

Out of curiosity how do you handle varied sizes of arenas which don't perfectly fit the screen?

#9 Antelux

  • Members
  • 295 posts
  • LocationSomewhere in the middle of nowhere.

Posted 06 March 2016 - 01:49 PM

I don't have the most optimized implementation, but essentially, it's something like this:
local screen_width, screen_height = term.getSize()
local screen_y_max = math.floor(arena_size / 51)


local index = 1
for y = 1, screen_y_max do
	term.setCursorPos(1, y)
	for x = 1, screen_width do
		local b = blocks[index]; if not b then break end
		-- Draw code here based on b, which is the state of the current block
		index = index + 1
	end
end

Edited by Detective_Smith, 06 March 2016 - 01:51 PM.


#10 wilcomega

  • Members
  • 466 posts
  • LocationHolland

Posted 06 March 2016 - 04:01 PM

I love this concept! maybe there can be diffrent types of chalenges. Also you should implement an api that is accessable in the sandbox, to prevent people from damaging their systems. maybe something like this:
if not vga then exit() end -- or whatever the exit function is
if vga.version() == "1.1" then
    -- new features in 1.1, now its compatible with both 1.0 and 1.1!
end

maybe i can help out a bit here and there, send me a pm if intrested

#11 apemanzilla

  • Members
  • 1,421 posts

Posted 06 March 2016 - 05:19 PM

View Postwilcomega, on 06 March 2016 - 04:01 PM, said:

I love this concept! maybe there can be diffrent types of chalenges. Also you should implement an api that is accessable in the sandbox, to prevent people from damaging their systems. maybe something like this:
if not vga then exit() end -- or whatever the exit function is
if vga.version() == "1.1" then
	-- new features in 1.1, now its compatible with both 1.0 and 1.1!
end

maybe i can help out a bit here and there, send me a pm if intrested

Could just do
assert(fs.check, "This program should not be run outside of Virus Gladiatorial Arena!")


#12 wilcomega

  • Members
  • 466 posts
  • LocationHolland

Posted 06 March 2016 - 09:41 PM

View Postapemanzilla, on 06 March 2016 - 05:19 PM, said:

View Postwilcomega, on 06 March 2016 - 04:01 PM, said:

...

Could just do
assert(fs.check, "This program should not be run outside of Virus Gladiatorial Arena!")

Certainly possible, but i think my version might be a little more userfriendly

#13 HDeffo

  • Members
  • 214 posts

Posted 07 March 2016 - 04:52 AM

View Postwilcomega, on 06 March 2016 - 04:01 PM, said:

maybe i can help out a bit here and there, send me a pm if intrested

honestly the most help anyone can be is making suggestions for new features. :3 just because of how simple the version check is I have already added that thanks for the suggestion

#14 wilcomega

  • Members
  • 466 posts
  • LocationHolland

Posted 07 March 2016 - 04:34 PM

If i think of more game modes / arena's i will definatly suggest them or make them myself :D

#15 Dave-ee Jones

  • Members
  • 456 posts
  • LocationVan Diemen's Land

Posted 15 March 2016 - 10:51 AM

I am getting confused. From what I understand you have created an API that overrides the default fs API (file system). Maybe you should change that....? Or is it meant to be like that but then add fs functions?

Sorry this might sound a bit derpy but I don't quite understand how this works.

#16 Creator

    Mad Dash Victor

  • Members
  • 2,168 posts
  • LocationYou will never find me, muhahahahahaha

Posted 15 March 2016 - 10:56 AM

The fs for these programs is overwritten. Not the entire fs.

#17 Lupus590

  • Members
  • 2,029 posts
  • LocationUK

Posted 15 March 2016 - 12:34 PM

View PostDave-ee Jones, on 15 March 2016 - 10:51 AM, said:

I am getting confused. From what I understand you have created an API that overrides the default fs API (file system). Maybe you should change that....? Or is it meant to be like that but then add fs functions?

Sorry this might sound a bit derpy but I don't quite understand how this works.

View PostCreator, on 15 March 2016 - 10:56 AM, said:

The fs for these programs is overwritten. Not the entire fs.
What Creator probably means, and my educated guess, is that when the virus arena is ran it creates a virtual file system with dummy files (called blocks). The true file system is completely hidden and inaccessible from within the arena.

This method is more secure than conventional sandboxes as the programs within the arena can't even see the real file system. In a conventional sandbox you are moderating the interactions to the real file system. Where as this sandbox creates it's own (fake) file system, and gives programs within the arena free range on the fake files. It should be noted that if you want to be able to interact with stuff outside of the sand box then this is not the way to do it.

#18 HDeffo

  • Members
  • 214 posts

Posted 15 March 2016 - 11:30 PM

As lupus described it is exactly right. From the environment I place the programs in I tell it if they request the fs table to return my fake fs instead. This programs in the game from accessing the real file system as that would kind of break the game then.

#19 wilcomega

  • Members
  • 466 posts
  • LocationHolland

Posted 17 March 2016 - 08:42 PM

I thought of some gamemodes / ways to implement them

every contestant fights over control over the turtle, every contestant has to send the turtle back to the programs goal position ( this can be a virtual or a physical turtle ). Programs are scored by the closest distance they got the turtle to their goal position ( max - closest = score ).

There are several possible interfaces to implement (or all of them to see who can interface the best with their favorite interface)

So the first way to interface is the most simple, the programs give direct turtle commands and the turtle will do its thing, but of course it comes with a sleep cost.

Another way is to make a date sim where you convice the turtle to come to your house.

Another way is for the arena to generate a turtle program with its flaws and the programs literaly have to hack it and try to take control of it through rednet (like sql injection or buffer overflow like).

And you could probably think of way more cool ways to control a turtle. on the other hand here is another gamemode

The programs need to supply the king who runs the arena with the message from the Master of Coin (or another medieval imporant subject) by intercepting rednet messages and searching through files. The programs need to find the clues provided by the arena/king and return the correct message back to him. Every clue found must be reported back for points and the most points are awarded for brining back the original message.

Also maybe you could expand this to not only be focussed on Virusses but more on AI. So for example, games could be running on turtles and battle. Or leading a small army of turtles. And much more is possible with AI in general. Because really, this is more about AI than malicious code.

#20 Konlab

  • Members
  • 595 posts
  • LocationKerbin

Posted 09 April 2016 - 10:22 AM

Umm...
So this sandboxes sandboxed computers (CC) in sandboxed world (MC).





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users